From 24b1a19409ad432db658db5c97696919862cb1ee Mon Sep 17 00:00:00 2001 From: Ellwood Zwovic Date: Sun, 9 Jul 2017 15:10:00 -0700 Subject: [PATCH] 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.. --- subprocess_adapter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subprocess_adapter.py b/subprocess_adapter.py index 0a04def..468d6f7 100644 --- a/subprocess_adapter.py +++ b/subprocess_adapter.py @@ -70,7 +70,7 @@ def subprocess_operator(cls: Operator, polling_interval=.01) -> Operator: try: if self.pipe[0].poll(): resp = self.pipe[0].recv() - assert(isinstance(resp, SubprocessMessage)) + # assert(isinstance(resp, SubprocessMessage)) else: resp = None except EOFError: @@ -105,6 +105,7 @@ def subprocess_function(func, *args, pipe, **kwargs): except Exception as err: log.debug("Caught exception from subprocess: %s", err) pipe[1].send(SubprocessMessage(exception=err)) + raise finally: pipe[1].close()