diff options
author | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2016-03-13 18:29:52 +0000 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2016-03-27 11:53:02 +0000 |
commit | e9edfeb6ef94fd69d3ae461cd8bb9127da6a6351 (patch) | |
tree | dc66415b9852da1f47d80625e4c0aa3746d2c886 | |
parent | 5daf9f5fe82df591ff553e430414cc797664ce27 (diff) | |
download | morph-e9edfeb6ef94fd69d3ae461cd8bb9127da6a6351.tar.gz |
Send live stdout of builds to client
Change-Id: I4fe8da68c224ee7f7c5be644c0c8b5192a944a1a
-rw-r--r-- | gear/client.py | 3 | ||||
-rw-r--r-- | gear/worker.py | 11 |
2 files changed, 8 insertions, 6 deletions
diff --git a/gear/client.py b/gear/client.py index 37e1d870..8d35b03b 100644 --- a/gear/client.py +++ b/gear/client.py @@ -208,7 +208,8 @@ class BuilderClient(gear.Client): def handleWorkData(self, packet): job = super(BuilderClient, self).handleWorkData(packet) - print job.data[-1] + print job.data[-1].strip() + # Cleanup previous data to speed up and save memory probably job.data = [] return job diff --git a/gear/worker.py b/gear/worker.py index 40c142b8..4e92be1d 100644 --- a/gear/worker.py +++ b/gear/worker.py @@ -83,8 +83,12 @@ while True: print "building %s" % artifact.name cmd = ['morph', 'worker-build', '--build-log-on-stdout', artifact.name] p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) - output = p.communicate(input=job.arguments)[0] - job.sendWorkData(output) + p.stdin.write(job.arguments) + p.stdin.close() + while True: + line = p.stdout.readline() + if not line: break + job.sendWorkData(line) kind = artifact.kind @@ -101,6 +105,3 @@ while True: suffixes.append(filename + '.meta') upload_files(artifact.cache_key, suffixes) job.sendWorkComplete(artifact.cache_key) - - - |