Skip to content

Commit

Permalink
Updated remote.py.
Browse files Browse the repository at this point in the history
  • Loading branch information
danalex97 committed May 2, 2018
1 parent cbbacb2 commit 1edf155
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ def __init__(self, pool, command, times):

self.id = random_id()

os.system("mkdir results/{}".format(self.id))
os.system("mkdir results/{}/single".format(self.id))
os.system("mkdir results/{}/additional".format(self.id))
os.system("mkdir -p results/{}".format(self.id))
os.system("mkdir -p results/{}/runs".format(self.id))

def run(self):
def run(host):
Expand All @@ -79,17 +78,12 @@ def run(host):
pass

if res != None:
out = None

self.lock.acquire()
self.runs += 1
runs = self.runs
self.lock.release()

if runs <= self.times:
out = open("results/{}/single/{}.txt".format(self.id, runs), 'w')
else:
out = open("results/{}/additional/{}.txt".format(self.id, runs), 'w')
out = open("results/{}/runs/{}.txt".format(self.id, runs), 'w')

print("===========================", file=out)
print("Job: {} -- run".format(self.command), file=out)
Expand All @@ -104,7 +98,7 @@ def run(host):
self.lock.release()

print("Running job: {}".format(self.command))
for _ in range(int(self.times * 2.5)):
for _ in range(int(self.times)):
host = self.pool.next()
threading.Thread(target=run, args=[host]).start()
return self
Expand Down

0 comments on commit 1edf155

Please sign in to comment.