diff options
author | Jürg Billeter <j@bitron.ch> | 2020-09-29 17:33:54 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2020-09-29 17:52:24 +0200 |
commit | c83217694faf365f3a94be03bb684a5a3e1c2d5a (patch) | |
tree | 39b8d0465e9a1f0e16982317b0e50e347af9e1d1 /src | |
parent | d1885eafaf002f6f8c30cefa89d9c75fd352e444 (diff) | |
download | buildstream-c83217694faf365f3a94be03bb684a5a3e1c2d5a.tar.gz |
element.py: Add skip_uncached parameter to _skip_push()
This allows proper error handling when pushing an uncached element
should result in a failure (bst artifact push), not a skipped job
(bst build).
Diffstat (limited to 'src')
-rw-r--r-- | src/buildstream/_scheduler/queues/artifactpushqueue.py | 7 | ||||
-rw-r--r-- | src/buildstream/element.py | 16 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/buildstream/_scheduler/queues/artifactpushqueue.py b/src/buildstream/_scheduler/queues/artifactpushqueue.py index 071c6fe74..6ed79a5ba 100644 --- a/src/buildstream/_scheduler/queues/artifactpushqueue.py +++ b/src/buildstream/_scheduler/queues/artifactpushqueue.py @@ -32,11 +32,16 @@ class ArtifactPushQueue(Queue): complete_name = "Artifacts Pushed" resources = [ResourceType.UPLOAD] + def __init__(self, scheduler, *, skip_uncached=True): + super().__init__(scheduler) + + self._skip_uncached = skip_uncached + def get_process_func(self): return ArtifactPushQueue._push_or_skip def status(self, element): - if element._skip_push(): + if element._skip_push(skip_uncached=self._skip_uncached): return QueueStatus.SKIP return QueueStatus.READY diff --git a/src/buildstream/element.py b/src/buildstream/element.py index ff7dcbbbb..57aa37a85 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -1971,22 +1971,24 @@ class Element(Plugin): # # Determine whether we should create a push job for this element. # + # Args: + # skip_uncached (bool): Whether to skip elements that aren't cached + # # Returns: # (bool): True if this element does not need a push job to be created # - def _skip_push(self): + def _skip_push(self, *, skip_uncached): if not self.__artifacts.has_push_remotes(plugin=self): # No push remotes for this element's project return True # Do not push elements that aren't cached, or that are cached with a dangling buildtree # ref unless element type is expected to have an an empty buildtree directory - if not self._cached_buildtree() and self._buildtree_exists(): - return True - - # Do not push tainted artifact - if self.__get_tainted(): - return True + if skip_uncached: + if not self._cached(): + return True + if not self._cached_buildtree() and self._buildtree_exists(): + return True return False |