Skip to content
This repository has been archived by the owner on Jul 14, 2020. It is now read-only.

Commit

Permalink
Add machine info to log: src addr and hostname
Browse files Browse the repository at this point in the history
pokes at #17
  • Loading branch information
AnotherKamila committed Oct 10, 2019
1 parent caf9bd9 commit 96cb3a4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions master/buildbot-master/viscon.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,25 @@ def webserver_dir(what, id):
def player_factory_factory(player_id):
player_factory = util.BuildFactory()

src_addr = PLAYERS[player_id][0]
src_name = player_id[len('source-'):]
nowstr = datetime.now().strftime('%Y-%m-%d-%H-%M-%S')
source_dir = webserver_dir('source', PLAYERS[player_id][0])
source_dir = webserver_dir('source', src_addr)
task_file = os.path.join(source_dir, 'round.txt')
code_file = os.path.join(source_dir, 'submit.py')
log_file = os.path.join(source_dir, 'log') # why not at least output.log or something
run_cmd = ['sh', '-c', 'python3 ./submit.py < ./round.txt > ./output.log 2>&1 || true'] # :D
run_cmd = ['sh', '-c', 'python3 ./submit.py < ./round.txt >> ./output.log 2>&1 || true'] # :D

# 1. put the task file and user's code on the worker
player_factory.addStep(steps.FileDownload(mastersrc=task_file,
workerdest='./round.txt'))
player_factory.addStep(steps.FileDownload(mastersrc=code_file,
workerdest='./submit.py'))
loghdr = '# running on: {} ({})\n'.format(src_addr, src_name)
player_factory.addStep(steps.StringDownload(loghdr,
workerdest="output.log"))



# 2. run it
# player_factory.addStep(steps.ShellCommand(command=['cp']+API_FILES+['.']))
Expand Down

0 comments on commit 96cb3a4

Please sign in to comment.