You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by gi...@apache.org on 2020/12/29 13:24:06 UTC

[buildstream] 23/25: TEMP: bst-job-replay

This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch aevri/win32_minimal
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 8cb9d860ac0971c20531d4ae0b5276cb3257a8e7
Author: Angelos Evripiotis <je...@bloomberg.net>
AuthorDate: Tue Jul 9 11:38:48 2019 +0100

    TEMP: bst-job-replay
---
 setup.py                                      |  1 +
 src/buildstream/_jobreplay.py                 | 13 +++++++++++++
 src/buildstream/_scheduler/jobs/jobpickler.py |  4 ++++
 3 files changed, 18 insertions(+)

diff --git a/setup.py b/setup.py
index 04038c6..2280b49 100755
--- a/setup.py
+++ b/setup.py
@@ -158,6 +158,7 @@ if not os.environ.get('BST_ARTIFACTS_ONLY', ''):
     bst_install_entry_points['console_scripts'] += [
         'bst = buildstream._frontend:cli',
         'bst-buildboxcasd-test = buildstream.buildboxcasdtest:cli',
+        'bst-job-replay = buildstream._jobreplay:cli',
     ]
 
 #####################################################
diff --git a/src/buildstream/_jobreplay.py b/src/buildstream/_jobreplay.py
new file mode 100644
index 0000000..07782e4
--- /dev/null
+++ b/src/buildstream/_jobreplay.py
@@ -0,0 +1,13 @@
+import multiprocessing
+import pickle
+
+import click
+
+from ._scheduler.jobs.job import _do_pickled_child_job
+
+
+@click.command(name='bst-job-replay', short_help="Replay a bst job")
+@click.argument('replayfile', type=click.File("rb"))
+def cli(replayfile):
+    queue = multiprocessing.Queue()
+    _do_pickled_child_job(replayfile, queue)
\ No newline at end of file
diff --git a/src/buildstream/_scheduler/jobs/jobpickler.py b/src/buildstream/_scheduler/jobs/jobpickler.py
index 0edf88c..7de8404 100644
--- a/src/buildstream/_scheduler/jobs/jobpickler.py
+++ b/src/buildstream/_scheduler/jobs/jobpickler.py
@@ -94,6 +94,10 @@ def pickle_child_job(child_job, projects):
     pickler.dump(child_job)
     data.seek(0)
 
+    path = f"{child_job.action_name}_{child_job._message_element_name}_{child_job._message_element_key[1]}"
+    with open(path, "wb") as f:
+        f.write(data.getvalue())
+
     return data