diff options
author | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2016-03-22 01:28:07 +0000 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2016-03-27 11:53:02 +0000 |
commit | b500ae772f301166b61181351294fda2be4e590f (patch) | |
tree | 2091c1952dcbabdfe10a0ae1a64dfd8ccc3397b4 | |
parent | d7fa7e1a5e2749ad18aa9506239862a8837daee7 (diff) | |
download | morph-b500ae772f301166b61181351294fda2be4e590f.tar.gz |
don't try to do anything with not started requests
Change-Id: I45f10538519582ea45a0161f14830de0207bddac
-rw-r--r-- | gear/client.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/gear/client.py b/gear/client.py index 795bacf6..cd21eeb8 100644 --- a/gear/client.py +++ b/gear/client.py @@ -287,10 +287,12 @@ class RequestsController(): def mark_as_built(self, cache_key): with self.build_status_lock: for request in self.build_requests: - artifacts = request['controller']._find_artifacts(cache_key) - for artifact in artifacts: - artifact.state = BUILT - print "TO %s: Artifact %s built" % (request['id'],artifact.name) + controller = request['controller'] + if controller.artifact != None and controller.build_started == True: + artifacts = request['controller']._find_artifacts(cache_key) + for artifact in artifacts: + artifact.state = BUILT + print "TO %s: Artifact %s built" % (request['id'],artifact.name) if self.lock_queue.locked(): self.lock_queue.release() @@ -298,10 +300,12 @@ class RequestsController(): def mark_as_building(self, cache_key): with self.build_status_lock: for request in self.build_requests: - artifacts = request['controller']._find_artifacts(cache_key) - for artifact in artifacts: - artifact.state = BUILDING - print "TO %s: Artifact %s building" % (request['id'],artifact.name) + controller = request['controller'] + if controller.artifact != None and controller.build_started == True: + artifacts = request['controller']._find_artifacts(cache_key) + for artifact in artifacts: + artifact.state = BUILDING + print "TO %s: Artifact %s building" % (request['id'],artifact.name) #consider chunks case @@ -318,5 +322,6 @@ request['ref'] = "fbce45e45da79e5c35341845ec3b3d7c321e6ff2" request['system'] = "systems/minimal-system-x86_64-generic.morph" requests_controller = RequestsController() requests_controller.add_request(request) +requests_controller.add_request(request) requests_controller.loop() |