jodal / pykka

🌀 Pykka makes it easier to build concurrent Python applications.

Home Page:https://pykka.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cross-actor tracebacks on gevent

arnuschky opened this issue · comments

When a traceback is thrown in an actor, is there any way to report the original traceback in the calling actor? Debugging is very hard in Pykka as an exception is shown only with the traceback from the calling actor rather than the traceback leading to the actual cause of the exception.

Taking the counter.py example, let's assume there's an exception in the Adder actor. What we see is:

Traceback (most recent call last):
  File "counter.py", line 45, in <module>
    bookkeeper.count_to(10).get()
  File "/local/lib/python2.7/site-packages/pykka/gevent.py", line 47, in get
    return self.async_result.get(timeout=timeout)
  File "/local/lib/python2.7/site-packages/gevent/event.py", line 385, in get
    return self.get(block=False)
  File "/local/lib/python2.7/site-packages/gevent/event.py", line 375, in get
    return self._raise_exception()
  File "/local/lib/python2.7/site-packages/gevent/event.py", line 355, in _raise_exception
    reraise(*self.exc_info)
  File "/local/lib/python2.7/site-packages/gevent/_util_py2.py", line 8, in reraise
    raise type, value, tb
KeyError: 'arg'

What I would love to see is:

Traceback (most recent call last):
  File "counter.py", line 37, in <module>
    raise KeyError('arg')
  File "counter.py", line 35, in <module>
    adder.add_one()
  File "counter.py", line 45, in <module>
    bookkeeper.count_to(10).get()
  File "/local/lib/python2.7/site-packages/pykka/gevent.py", line 47, in get
    return self.async_result.get(timeout=timeout)
  File "/local/lib/python2.7/site-packages/gevent/event.py", line 385, in get
    return self.get(block=False)
  File "/local/lib/python2.7/site-packages/gevent/event.py", line 375, in get
    return self._raise_exception()
  File "/local/lib/python2.7/site-packages/gevent/event.py", line 355, in _raise_exception
    reraise(*self.exc_info)
  File "/local/lib/python2.7/site-packages/gevent/_util_py2.py", line 8, in reraise
    raise type, value, tb
KeyError: 'arg'

Is this somehow possible? Am I missing something, or are cross-actor tracebacks not possible?