diff options
author | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2016-03-10 01:00:57 +0000 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2016-03-27 11:53:02 +0000 |
commit | c527bf1c7da1f54cced68e7af25483e9db89baf5 (patch) | |
tree | 5e137c53af943dbfc657129fde62342d9cb4a80c | |
parent | dfdd7a7faa6f0ba3eed6bc7fdf727da957a7a772 (diff) | |
download | morph-c527bf1c7da1f54cced68e7af25483e9db89baf5.tar.gz |
Send build log and prepare artifact suffixes
Change-Id: I8df5f2050d6d51002c31b4bb559f5bc5053b1ddc
-rw-r--r-- | gear/client.py | 5 | ||||
-rw-r--r-- | gear/worker.py | 19 |
2 files changed, 24 insertions, 0 deletions
diff --git a/gear/client.py b/gear/client.py index f043af29..37e1d870 100644 --- a/gear/client.py +++ b/gear/client.py @@ -206,6 +206,11 @@ class BuilderClient(gear.Client): self.controller._mark_artifact_as_built(job.data[-1]) return job + def handleWorkData(self, packet): + job = super(BuilderClient, self).handleWorkData(packet) + print job.data[-1] + job.data = [] + return job controller = theController() client = controller.graph_client diff --git a/gear/worker.py b/gear/worker.py index b11f78bf..d1e961aa 100644 --- a/gear/worker.py +++ b/gear/worker.py @@ -38,4 +38,23 @@ while True: elif job.name == "build-artifact": artifact = distbuild.decode_artifact_reference(job.arguments) 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) + + kind = artifact.kind + + if kind == 'chunk': + artifact_names = artifact.source_artifact_names + + suffixes = ['%s.%s' % (kind, name) for name in artifact_names] + suffixes.append('build-log') + else: + filename = '%s.%s' % (kind, job.artifact.name) + suffixes = [filename] + + if kind == 'stratum': + suffixes.append(filename + '.meta') + job.sendWorkComplete(artifact.cache_key) |