diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-07-12 17:32:49 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-07-12 17:32:49 +0900 |
commit | aa0ec80255bee0771a0d0fe5d9401b9f34d7036f (patch) | |
tree | d3c257c9b51fc23395c8d8d159a9c63407ec1f07 | |
parent | 611c8515b7d8048c4aaaf33983b975b446cffe97 (diff) | |
download | buildstream-aa0ec80255bee0771a0d0fe5d9401b9f34d7036f.tar.gz |
_scheduler: Changed return value of Queue.done() around
Previously it returned True to record an element as 'skipped',
this seems backwards; instead return True to indicate an element
was 'processed' and False to indicate an element was 'skipped'
-rw-r--r-- | buildstream/_scheduler/buildqueue.py | 2 | ||||
-rw-r--r-- | buildstream/_scheduler/fetchqueue.py | 4 | ||||
-rw-r--r-- | buildstream/_scheduler/pullqueue.py | 2 | ||||
-rw-r--r-- | buildstream/_scheduler/pushqueue.py | 2 | ||||
-rw-r--r-- | buildstream/_scheduler/queue.py | 9 | ||||
-rw-r--r-- | buildstream/_scheduler/trackqueue.py | 13 |
6 files changed, 18 insertions, 14 deletions
diff --git a/buildstream/_scheduler/buildqueue.py b/buildstream/_scheduler/buildqueue.py index 04c4963dd..7da4bfedc 100644 --- a/buildstream/_scheduler/buildqueue.py +++ b/buildstream/_scheduler/buildqueue.py @@ -45,3 +45,5 @@ class BuildQueue(Queue): if returncode == 0: element._set_cached() element._set_built() + + return True diff --git a/buildstream/_scheduler/fetchqueue.py b/buildstream/_scheduler/fetchqueue.py index db9f3c35a..8fc19d283 100644 --- a/buildstream/_scheduler/fetchqueue.py +++ b/buildstream/_scheduler/fetchqueue.py @@ -55,9 +55,11 @@ class FetchQueue(Queue): def done(self, element, result, returncode): if returncode != 0: - return + return False for source in element.sources(): # Successful fetch, we must be CACHED now source._bump_consistency(Consistency.CACHED) + + return True diff --git a/buildstream/_scheduler/pullqueue.py b/buildstream/_scheduler/pullqueue.py index c5113bd0c..9ad08053e 100644 --- a/buildstream/_scheduler/pullqueue.py +++ b/buildstream/_scheduler/pullqueue.py @@ -48,4 +48,4 @@ class PullQueue(Queue): # Element._pull() returns True if it downloaded an artifact, # here we want to appear skipped if we did not download. - return not result + return result diff --git a/buildstream/_scheduler/pushqueue.py b/buildstream/_scheduler/pushqueue.py index 1c0ab9824..a339f5604 100644 --- a/buildstream/_scheduler/pushqueue.py +++ b/buildstream/_scheduler/pushqueue.py @@ -49,4 +49,4 @@ class PushQueue(Queue): # Element._push() returns True if it uploaded an artifact, # here we want to appear skipped if the remote already had # the artifact. - return not result + return result diff --git a/buildstream/_scheduler/queue.py b/buildstream/_scheduler/queue.py index 6f82d3266..04e559eee 100644 --- a/buildstream/_scheduler/queue.py +++ b/buildstream/_scheduler/queue.py @@ -126,9 +126,8 @@ class Queue(): # returncode (int): The process return code, 0 = success # # Returns: - # (bool): True if the element should appear to be skipped, - # this is useful in cases where we can only determine - # "skipped" status after processing. + # (bool): True if the element should appear to be processsed, + # Otherwise False will count the element as "skipped" # def done(self, element, result, returncode): pass @@ -195,9 +194,9 @@ class Queue(): # and determine if it should be considered as processed # or skipped. if self.done(element, job.result, returncode): - skip = True - else: skip = False + else: + skip = True if returncode == 0: self.done_queue.append(element) diff --git a/buildstream/_scheduler/trackqueue.py b/buildstream/_scheduler/trackqueue.py index 126bc8604..e45fb2db2 100644 --- a/buildstream/_scheduler/trackqueue.py +++ b/buildstream/_scheduler/trackqueue.py @@ -42,8 +42,6 @@ class TrackQueue(Queue): def __init__(self): super(TrackQueue, self).__init__() - self.changed_sources = [] - def process(self, element): return element._track() @@ -54,16 +52,16 @@ class TrackQueue(Queue): def done(self, element, result, returncode): if returncode != 0: - return + return False + + changed = False # Set the new refs in the main process one by one as they complete for unique_id, new_ref in result: source = _plugin_lookup(unique_id) if source._set_ref(new_ref, source._Source__origin_node): - # Successful update of ref, we're at least resolved now - self.changed_sources.append(source) - + changed = True project = source.get_project() toplevel = source._Source__origin_toplevel filename = source._Source__origin_filename @@ -86,3 +84,6 @@ class TrackQueue(Queue): context._push_message_depth(True) element._consistency(recalculate=True) context._pop_message_depth() + + # We'll appear as a skipped element if tracking resulted in no change + return changed |