Hi Richard,
Thanks for your reply.
I tried code suggested by you
t = stackless.current
import traceback
traceback.print_stack(t.frame)
The above code only provides me a call stack of the thread I am actually in.
Let me elaborate my problem a little more:
- I have n no. of tasklets which I monitor from an external thread.
- The way you have suggested gives me the call stack of the external thread.
In my external thread I have a reference to all the currently running tasklets
and I want to get a call stack for each of these running tasklets.
When I try to get the call stack for any tasklet other than the current one, I
get the following exception:
<Job 107C5928 on <tavant.publisher.Publisher object at 0x10775F68>>I have given
the following console statements in my code that leads to the above error:
ALIVE True
Frame <stackless.cframe object at 0x10AEDF58>
Traceback (most recent call last):
File "..\..\..\Assets\InGame\Gameplay\Scripts\Debug\pydevd_comm.py", line
897,
in doIt
print("callstack: ",traceback.extract_stack(selectedJob.frame))
File "..\..\..\Assets\InGame\Gameplay\Scripts\lib\traceback.py", line 328, in
extract_stack
lineno = f.f_lineno
AttributeError: 'stackless.cframe' object has no attribute 'f_lineno'
print(selectedJob)
print("ALIVE", selectedJob.alive)
print("Frame", selectedJob.frame)
print("callstack: ",traceback.extract_stack(selectedJob.frame))
Note: selectedJob above is an object of a Job class and we have inherited Job
class from a stackless.tasklet.
Thanks and Regards,
Hussain Bohra
________________________________
From: "[email protected]" <[email protected]>
To: [email protected]
Sent: Wed, 6 July, 2011 3:30:01 PM
Subject: Stackless Digest, Vol 90, Issue 2
Send Stackless mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.stackless.com/mailman/listinfo/stackless
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Stackless digest..."
Today's Topics:
1. How do I get a callstack of a Tasklet ? (Hussain Bohra)
2. Re: How do I get a callstack of a Tasklet ? (Richard Tew)
----------------------------------------------------------------------
Message: 1
Date: Tue, 5 Jul 2011 05:38:02 -0700 (PDT)
From: Hussain Bohra <[email protected]>
To: [email protected]
Subject: [Stackless] How do I get a callstack of a Tasklet ?
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Hi All,
We are using stackless python for our application development.
We are creating many tasklets in our?application, I am developing an
application
to monitor?these tasklets.
I am able to get and display all the running tasklets in the UI. But I also
want
to?display the callstack for each tasklet. I am not able to generate a
callstack?for these tasklets.
Just FYI: We can determine callstack of running threads in Java.
Can any one please let me know?if there is a way out ?
Thanks and Regards,
Hussain Bohra
Tavant Technologies,
Bangalore-95
mail-to:[email protected]
mobile : +91 99867 95727
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.stackless.com/pipermail/stackless/attachments/20110705/cb863b1c/attachment-0001.html>
------------------------------
Message: 2
Date: Tue, 5 Jul 2011 21:48:56 +0800
From: Richard Tew <[email protected]>
To: The Stackless Python Mailing List <[email protected]>
Subject: Re: [Stackless] How do I get a callstack of a Tasklet ?
Message-ID:
<CAN=X-THjeL-yRydcm5WQAGGGnSjLguaoShC=ulzu04hkm6d...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
On Tue, Jul 5, 2011 at 8:38 PM, Hussain Bohra <[email protected]> wrote:
> I am able to get and display all the running tasklets in the UI. But I also
> want to?display the callstack for each tasklet. I am not able to generate a
> callstack?for these tasklets.
t = stackless.current
import traceback
traceback.print_stack(t.frame)
?
------------------------------
_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless
End of Stackless Digest, Vol 90, Issue 2
****************************************
_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless