From dfdd7a7faa6f0ba3eed6bc7fdf727da957a7a772 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Wed, 9 Mar 2016 00:55:05 +0000 Subject: Request build-artifact job Change-Id: I50e61bae89b313a1ad473c2c81e4a254da061601 --- gear/client.py | 6 +++--- gear/worker.py | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gear/client.py b/gear/client.py index 9a7df6cc..f043af29 100644 --- a/gear/client.py +++ b/gear/client.py @@ -109,9 +109,9 @@ class theController(): logging.debug( 'Requesting worker-build of %s (%s)' % (artifact.name, artifact.cache_key)) - # TODO: launch build client print "Start building %s" % artifact.name - job = gear.Job("reverse", artifact.cache_key) + artifact_encoded = distbuild.encode_artifact_reference(artifact) + job = gear.Job("build-artifact", artifact_encoded) print "lock set as building" with self.lock: artifact.state = BUILDING @@ -203,7 +203,7 @@ class BuilderClient(gear.Client): def handleWorkComplete(self, packet): job = super(BuilderClient, self).handleWorkComplete(packet) print "workcomplete" - self.controller._mark_artifact_as_built(job.arguments) + self.controller._mark_artifact_as_built(job.data[-1]) return job diff --git a/gear/worker.py b/gear/worker.py index 35281ca3..b11f78bf 100644 --- a/gear/worker.py +++ b/gear/worker.py @@ -3,10 +3,12 @@ worker = gear.Worker('reverser') worker.addServer('localhost') worker.registerFunction("reverse") worker.registerFunction("build-graph") +worker.registerFunction("build-artifact") import time import json from subprocess import Popen, PIPE, STDOUT +import distbuild while True: print "DEBUG: Waiting for job" @@ -33,4 +35,7 @@ while True: print "=====" print "DEBUG: finished computing build graph" job.sendWorkComplete(output) - + elif job.name == "build-artifact": + artifact = distbuild.decode_artifact_reference(job.arguments) + print "building %s" % artifact.name + job.sendWorkComplete(artifact.cache_key) -- cgit v1.2.1