diff options
author | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2016-03-20 12:49:41 +0000 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2016-03-27 11:53:02 +0000 |
commit | 4443bd116899e3e62bbd3e4ec8e3e767a08b0c9c (patch) | |
tree | b685100df81169c2a8a2d54fae3890ba3a8ed0fd /gear/client.py | |
parent | 7101a42e85cd793fe0bc450cbe184adc0fb9e776 (diff) | |
download | morph-4443bd116899e3e62bbd3e4ec8e3e767a08b0c9c.tar.gz |
fix code for tests
Change-Id: I5106328eab0c7b472f6e5058787623bd049d1b8c
Diffstat (limited to 'gear/client.py')
-rw-r--r-- | gear/client.py | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/gear/client.py b/gear/client.py index 2da25571..d14edd31 100644 --- a/gear/client.py +++ b/gear/client.py @@ -26,11 +26,11 @@ class theController(): self.builder_client = BuilderClient(self) self.cache_client = CacheRequestClient(self) self.builder_client.addServer('localhost') - self.builder_client.waitForServer() # Wait for at least one server to be connected + self.builder_client.waitForServer() self.graph_client.addServer('localhost') - self.graph_client.waitForServer() # Wait for at least one server to be connected + self.graph_client.waitForServer() self.cache_client.addServer('localhost') - self.cache_client.waitForServer() # Wait for at least one server to be connected + self.cache_client.waitForServer() self.artifact = None self.build_started = False @@ -53,8 +53,6 @@ class theController(): print "Setting them as unbuilt" self._map_build_graph(self.artifact, set_initial_state) print "Setting them as unbuilt done" - # TODO: check cache before marking as started: - # http://stackoverflow.com/questions/9110593/asynchronous-requests-with-python-requests self._check_cache_state(self.artifact) @@ -107,13 +105,14 @@ class theController(): mapped_components.append(a) return result, mapped_components - def find_artifacts_that_are_ready_to_build(self, root_artifact, components=[]): + def find_artifacts_that_are_ready_to_build(self, root_artifact, + components=[]): '''Return unbuilt artifacts whose dependencies are all built. - The 'root_artifact' parameter is expected to be a tree of ArtifactReference - objects. These must have the 'state' attribute set to BUILT or UNBUILT. If - 'components' is passed, then only those artifacts and their dependencies - will be built. + The 'root_artifact' parameter is expected to be a tree of + ArtifactReference objects. These must have the 'state' attribute set + to BUILT or UNBUILT. If 'components' is passed, then only those + artifacts and their dependencies will be built. ''' def is_ready_to_build(artifact): @@ -155,7 +154,7 @@ class theController(): # we're also building all the chunk artifacts # in this source same_chunk_artifacts = [a for a in artifacts - if a.cache_key == artifact.cache_key] + if a.cache_key == artifact.cache_key] for a in same_chunk_artifacts: a.state = BUILDING artifacts.remove(a) @@ -285,6 +284,6 @@ while True: import time time.sleep(0.0001) if controller.artifact != None and controller.build_started == True: - to_build = controller.find_artifacts_that_are_ready_to_build(controller.artifact) - #print to_build + to_build = controller.find_artifacts_that_are_ready_to_build( + controller.artifact) controller._queue_worker_builds(to_build) |