You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 07:14:01 UTC

[buildstream] 10/11: 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.

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

commit 00659deff4a391e93d395ac353a0ecfb36af66a4
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 adff992..b253c1b 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
-
-        elif 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
@@ -572,8 +565,8 @@ class ChildJob:
                         MessageType.FAIL, str(e), elapsed=elapsed, detail=e.detail, logfile=filename, 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.
                 #
@@ -623,23 +616,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