summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2019-03-14 12:26:03 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2019-03-25 11:46:44 +0000
commitdf23ea3ee58334569744ebeef9cfc729c2ddafc4 (patch)
treec48f7103cb0fee7bca3c56470e4be2aa7027c313
parent46bc1d597cb14e3971a642a8cb99a58e58ca6893 (diff)
downloadbuildstream-df23ea3ee58334569744ebeef9cfc729c2ddafc4.tar.gz
sourcepushqueue.py: Add queue for pushing sources
Updates other queues and widget to have consistent naming and display, and tests have been updated to reflect this. Part of #440
-rw-r--r--buildstream/_frontend/widget.py2
-rw-r--r--buildstream/_scheduler/__init__.py1
-rw-r--r--buildstream/_scheduler/queues/sourcepushqueue.py42
-rw-r--r--buildstream/plugintestutils/runcli.py2
-rw-r--r--tests/artifactcache/expiry.py4
-rw-r--r--tests/frontend/buildtrack.py4
6 files changed, 49 insertions, 6 deletions
diff --git a/buildstream/_frontend/widget.py b/buildstream/_frontend/widget.py
index ef31b8ba7..f092cb5ec 100644
--- a/buildstream/_frontend/widget.py
+++ b/buildstream/_frontend/widget.py
@@ -201,7 +201,7 @@ class ElementName(Widget):
if not action_name:
action_name = "Main"
- return self.content_profile.fmt("{: >5}".format(action_name.lower())) + \
+ return self.content_profile.fmt("{: >8}".format(action_name.lower())) + \
self.format_profile.fmt(':') + self.content_profile.fmt(name)
diff --git a/buildstream/_scheduler/__init__.py b/buildstream/_scheduler/__init__.py
index 470859864..64eaa455a 100644
--- a/buildstream/_scheduler/__init__.py
+++ b/buildstream/_scheduler/__init__.py
@@ -20,6 +20,7 @@
from .queues import Queue, QueueStatus
from .queues.fetchqueue import FetchQueue
+from .queues.sourcepushqueue import SourcePushQueue
from .queues.trackqueue import TrackQueue
from .queues.buildqueue import BuildQueue
from .queues.pushqueue import PushQueue
diff --git a/buildstream/_scheduler/queues/sourcepushqueue.py b/buildstream/_scheduler/queues/sourcepushqueue.py
new file mode 100644
index 000000000..c38460e6a
--- /dev/null
+++ b/buildstream/_scheduler/queues/sourcepushqueue.py
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2019 Bloomberg Finance LP
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library. If not, see <http://www.gnu.org/licenses/>.
+#
+# Authors:
+# Raoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>
+
+from . import Queue, QueueStatus
+from ..resources import ResourceType
+from ..._exceptions import SkipJob
+
+
+# A queue which pushes staged sources
+#
+class SourcePushQueue(Queue):
+
+ action_name = "Src-push"
+ complete_name = "Sources pushed"
+ resources = [ResourceType.UPLOAD]
+
+ def process(self, element):
+ # Returns whether a source was pushed or not
+ if not element._source_push():
+ raise SkipJob(self.action_name)
+
+ def status(self, element):
+ if element._skip_source_push():
+ return QueueStatus.SKIP
+
+ return QueueStatus.READY
diff --git a/buildstream/plugintestutils/runcli.py b/buildstream/plugintestutils/runcli.py
index c08dd0ff3..71d4b4039 100644
--- a/buildstream/plugintestutils/runcli.py
+++ b/buildstream/plugintestutils/runcli.py
@@ -225,7 +225,7 @@ class Result():
# (list): A list of element names
#
def get_tracked_elements(self):
- tracked = re.findall(r'\[track:(\S+)\s*]', self.stderr)
+ tracked = re.findall(r'\[\s*track:(\S+)\s*]', self.stderr)
if tracked is None:
return []
diff --git a/tests/artifactcache/expiry.py b/tests/artifactcache/expiry.py
index 38c0e21f0..7ada656ab 100644
--- a/tests/artifactcache/expiry.py
+++ b/tests/artifactcache/expiry.py
@@ -435,10 +435,10 @@ def test_cleanup_first(cli, datafiles):
res = cli.run(project=project, args=['build', 'target2.bst'])
res.assert_success()
- # Find all of the activity (like push, pull, fetch) lines
+ # Find all of the activity (like push, pull, src-pull) lines
results = re.findall(r'\[.*\]\[.*\]\[\s*(\S+):.*\]\s*START\s*.*\.log', res.stderr)
- # Don't bother checking the order of 'fetch', it is allowed to start
+ # Don't bother checking the order of 'src-pull', it is allowed to start
# before or after the initial cache size job, runs in parallel, and does
# not require ResourceType.CACHE.
results.remove('fetch')
diff --git a/tests/frontend/buildtrack.py b/tests/frontend/buildtrack.py
index 2d8d0e383..5a3781dc6 100644
--- a/tests/frontend/buildtrack.py
+++ b/tests/frontend/buildtrack.py
@@ -303,11 +303,11 @@ def test_build_track_track_first(cli, datafiles, tmpdir, strict):
# Assert that 1.bst successfully tracks before 0.bst builds
track_messages = re.finditer(r'\[track:1.bst\s*]', result.stderr)
- build_0 = re.search(r'\[build:0.bst\s*] START', result.stderr).start()
+ build_0 = re.search(r'\[\s*build:0.bst\s*] START', result.stderr).start()
assert all(track_message.start() < build_0 for track_message in track_messages)
# Assert that 2.bst is *only* rebuilt if we are in strict mode
- build_2 = re.search(r'\[build:2.bst\s*] START', result.stderr)
+ build_2 = re.search(r'\[\s*build:2.bst\s*] START', result.stderr)
if strict == '--strict':
assert build_2 is not None
else: