[IPython-User] Empty tb field in taskresult.failure

Fernando Perez fperez.net@gmail....
Thu Jul 15 20:59:10 CDT 2010


Hi Chris,

On Wed, Jul 14, 2010 at 6:46 AM, Chris Filo Gorgolewski
<chris.gorgolewski@gmail.com> wrote:
>
> Let me know what do you think. I guess the main problem is caused by
> using StringTask - is there another way to get the same functionality?

Actually that failure object comes from Twisted itself, and it has its
own methods for getting the traceback and printing it.  I'm not sure
why it doesn't set the .tb attribute (that's not part of our code but
within Twisted), but it does pickle some basic traceback info.  I
simplified your test to this:

#
from IPython.kernel import client
taskclient = client.TaskClient()
cmd = """
def fail():
    raise IOError('failure test')

result = fail()
"""
task = client.StringTask(cmd, pull = 'result')
res = taskclient.run(task, block = True)

print res
if res.failure:
    print 'Failure traceback:', res.failure.tb
### eof

If you start ipcluster separately, you can run this in IPython and
then  here are the various traceback access things you can use:

In [16]: res.failure.printDetailedTraceback()
*--- Failure #6 (pickled) ---
Failure: exceptions.IOError: failure test
*--- End of Failure #6 ---

In [17]: res.failure.printTraceback()
Traceback (most recent call last):
Failure: exceptions.IOError: failure test

In [18]: res.failure.get
res.failure.getBriefTraceback   res.failure.getTraceback
res.failure.getErrorMessage     res.failure.getTracebackObject

In [18]: res.failure.getTraceback()
Out[18]: 'Traceback (most recent call last):\nFailure:
exceptions.IOError: failure test\n'


Play with that and let us know if this is enough for your needs.

If so, we'd only have the SGE support left Satra is working on to cut 0.10.1.

Cheers,

f


More information about the IPython-User mailing list