Skip to content

Commit

Permalink
Added configuration file for network layout.
Browse files Browse the repository at this point in the history
  • Loading branch information
danalex97 committed Jun 20, 2018
1 parent f1135eb commit 18d2a53
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 5 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ The CacheTorrent system extends the [BitTorrent protocol](https://en.wikipedia.o

### Quick Start

- Prerequisites: [Golang](https://golang.org/) >= 1.6
- [Installation](docs/install.md) guide
- [Usage](docs/usage.md) instructions
- [Testing](docs/testing.md)
Expand All @@ -19,7 +18,7 @@ The general documentation is provided in Markdown, while the code uses [GoDoc](h

#### Protocols
- **[BitTorrent](docs/torrent.md)** - a simplified implementation of the BitTorrent protocol
- **[CacheTorrent](docs/cache.md)** - a BitTorrent extension aimed to make the protocol mode network friendly by reducing the inter-ISP traffic
- **[CacheTorrent](docs/cache.md)** - a BitTorrent extension aimed to reduce the inter-ISP traffic
- **[Extensions](docs/extension.md)** - extensions on top of CacheTorrent based on emperical results

#### Tools
Expand Down
34 changes: 34 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Install

#### Prerequisites
- [Golang](https://golang.org/) >= 1.6
- Python >= 3.5

#### Install

To install the basic packages:
```
go get github.com/danalex97/Speer
go get github.com/danalex97/nfsTorrent
```

To install the visualization tools:
```
apt install python3-pip
pip install Flask
pip install flask-cors
pip install requests
```

To install the remote run tools:
```
apt install python3-pip
pip install Flask
pip install requests
```

#### Setting up remote runs

To be able to run simulations remotely you need:
- a network file system
- ability to log in using SSH
9 changes: 7 additions & 2 deletions remote/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import random

class Pool:
def __init__(self):
def __init__(self, pool=None):
def app(id, idx):
if idx < 10:
id = id + "0"
Expand All @@ -18,7 +18,12 @@ def app(id, idx):
[app("point", i) for i in range(1, 61)] + \
[app("voxel", i) for i in range(1, 27)] + \
[app("graphic", i) for i in range(1, 13)]
self.pool = POOL[:]
try:
with open(pool, 'r') as f:
self.pool = f.read().splitlines()
except Exception:
# Use the default Pool configuration.
self.pool = POOL[:]
random.shuffle(self.pool)

def next(self):
Expand Down
8 changes: 7 additions & 1 deletion remote/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

from coordinator import Coordinator

from pool import Pool

import os
import threading
import string
Expand Down Expand Up @@ -59,6 +61,8 @@ def onDone(coordinator):
help="The PID of process to be notified when all jobs were dispached.")
parser.add_argument("-k", "--kill", nargs='?', action="store", dest="kill", default=[],
help="Use this flag to kill all remote jobs.")
parser.add_argument("-pool", type=str, default="",
help="Path to a .txt file containing IPs(or names) for the machine pool.")
parser.add_argument('command', nargs='*')
parser.set_defaults(kill=False)

Expand All @@ -68,6 +72,7 @@ def onDone(coordinator):
runs = args.runs
name = args.name
kill = args.kill
pool = args.pool

if kill != False:
if kill == None:
Expand All @@ -85,7 +90,8 @@ def onDone(coordinator):
command = command,
times = runs,
name = name,
notify = notify) \
notify = notify,
pool = Pool(pool))

coordinator.onDone(lambda: onDone(coordinator))
coordinator.run()

0 comments on commit 18d2a53

Please sign in to comment.