Also raise exception on child process, to get a traceback for debugging
I initially thought I could pass the traceback with the exception, but it seems transmitting exceptions around with their tracebacks intact is not so easy. There's a library which does this: https://github.com/ionelmc/python-tblib But this doesn't seem important enough to introduce a dependency..
This commit is contained in:
@@ -70,7 +70,7 @@ def subprocess_operator(cls: Operator, polling_interval=.01) -> Operator:
|
|||||||
try:
|
try:
|
||||||
if self.pipe[0].poll():
|
if self.pipe[0].poll():
|
||||||
resp = self.pipe[0].recv()
|
resp = self.pipe[0].recv()
|
||||||
assert(isinstance(resp, SubprocessMessage))
|
# assert(isinstance(resp, SubprocessMessage))
|
||||||
else:
|
else:
|
||||||
resp = None
|
resp = None
|
||||||
except EOFError:
|
except EOFError:
|
||||||
@@ -105,6 +105,7 @@ def subprocess_function(func, *args, pipe, **kwargs):
|
|||||||
except Exception as err:
|
except Exception as err:
|
||||||
log.debug("Caught exception from subprocess: %s", err)
|
log.debug("Caught exception from subprocess: %s", err)
|
||||||
pipe[1].send(SubprocessMessage(exception=err))
|
pipe[1].send(SubprocessMessage(exception=err))
|
||||||
|
raise
|
||||||
finally:
|
finally:
|
||||||
pipe[1].close()
|
pipe[1].close()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user