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:18:21 UTC

[buildstream] 09/13: job.py: Dont' pass the errors through the queue, we can set it directly

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

github-bot pushed a commit to branch bschubert/no-multiprocessing-full
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 8b72daf0e0712a876d977d8546ca04d856218e17
Author: Benjamin Schubert <co...@benschubert.me>
AuthorDate: Wed Jul 8 10:05:54 2020 +0000

    job.py: Dont' pass the errors through the queue, we can set it directly
    
    We are now running in threads so we can set the global ourselves without
    having to go through all the current hoops
---
 src/buildstream/_scheduler/jobs/job.py | 28 ++--------------------------
 1 file changed, 2 insertions(+), 26 deletions(-)

diff --git a/src/buildstream/_scheduler/jobs/job.py b/src/buildstream/_scheduler/jobs/job.py
index 30308a9..5369ae3 100644
--- a/src/buildstream/_scheduler/jobs/job.py
+++ b/src/buildstream/_scheduler/jobs/job.py
@@ -67,7 +67,6 @@ class _Envelope:
 
 
 class _MessageType(FastEnum):
-    ERROR = 2
     RESULT = 3
 
 
@@ -387,12 +386,6 @@ class Job:
     def _parent_process_envelope(self, envelope):
         if not self._listening:
             return
-
-        if envelope.message_type is _MessageType.ERROR:
-            # For regression tests only, save the last error domain / reason
-            # reported from a child task in the main process, this global state
-            # is currently managed in _exceptions.py
-            set_last_task_error(envelope.message["domain"], envelope.message["reason"])
         elif envelope.message_type is _MessageType.RESULT:
             assert self._result is None
             self._result = envelope.message
@@ -566,8 +559,8 @@ class ChildJob:
                 else:
                     self.message(MessageType.FAIL, str(e), elapsed=elapsed, detail=e.detail, sandbox=e.sandbox)
 
-                # Report the exception to the parent (for internal testing purposes)
-                self._child_send_error(e)
+                # Register the error for internal testing purposes
+                set_last_task_error(e.domain, e.reason)
 
                 # Set return code based on whether or not the error was temporary.
                 #
@@ -617,23 +610,6 @@ class ChildJob:
     def _send_message(self, message_type, message_data):
         self._pipe_w.send(_Envelope(message_type, message_data))
 
-    # _child_send_error()
-    #
-    # Sends an error to the main process through the message pipe
-    #
-    # Args:
-    #    e (Exception): The error to send
-    #
-    def _child_send_error(self, e):
-        domain = None
-        reason = None
-
-        if isinstance(e, BstError):
-            domain = e.domain
-            reason = e.reason
-
-        self._send_message(_MessageType.ERROR, {"domain": domain, "reason": reason})
-
     # _child_send_result()
     #
     # Sends the serialized result to the main process through the message pipe