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

[buildstream] 04/21: TEMP: MultiprocessingPdb, traceback in Job._child_action

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

not-in-ldap pushed a commit to branch aevri/win32
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit dcb63739058caa27f18cec1da27973833bb5b88b
Author: Angelos Evripiotis <je...@bloomberg.net>
AuthorDate: Tue Apr 2 13:22:51 2019 +0100

    TEMP: MultiprocessingPdb, traceback in Job._child_action
---
 src/buildstream/_scheduler/jobs/elementjob.py | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/buildstream/_scheduler/jobs/elementjob.py b/src/buildstream/_scheduler/jobs/elementjob.py
index a535f55..f51707f 100644
--- a/src/buildstream/_scheduler/jobs/elementjob.py
+++ b/src/buildstream/_scheduler/jobs/elementjob.py
@@ -23,6 +23,18 @@ from ..._message import MessageType
 from .job import Job, ChildJob
 
 
+import sys
+import pdb
+
+class MultiprocessingPdb(pdb.Pdb):
+    def interaction(self, *args, **kwargs):
+        _stdin = sys.stdin
+        try:
+            sys.stdin = open('/dev/stdin')
+            pdb.Pdb.interaction(self, *args, **kwargs)
+        finally:
+            sys.stdin = _stdin
+
 # ElementJob()
 #
 # A job to run an element's commands. When this job is started
@@ -105,7 +117,15 @@ class ChildElementJob(ChildJob):
                      detail=env_dump)
 
         # Run the action
-        return self._action_cb(self._element)
+        # MultiprocessingPdb().set_trace()
+        try:
+            result = self._action_cb(self._element)
+        except Exception as e:
+            print(e)
+            import traceback
+            traceback.print_exc()
+            raise
+        return result
 
     def child_process_data(self):
         data = {}