summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2016-03-09 00:55:05 +0000
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2016-03-27 11:53:02 +0000
commitdfdd7a7faa6f0ba3eed6bc7fdf727da957a7a772 (patch)
tree775e176a6b62f1da8cfccf3b4c749d40b3237f14
parent442d00fcb041bbd8eb355288e2354d9de9430ecd (diff)
downloadmorph-dfdd7a7faa6f0ba3eed6bc7fdf727da957a7a772.tar.gz
Request build-artifact job
Change-Id: I50e61bae89b313a1ad473c2c81e4a254da061601
-rw-r--r--gear/client.py6
-rw-r--r--gear/worker.py7
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)