N
N
niko832012-03-30 18:38:59
Django
niko83, 2012-03-30 18:38:59

WSGI, Django. How to see which part of the code each worker is executing at a particular moment?

There is a Django application running under UWSGI.
4 workers.
I want to be able to see exactly which part of the code each worker performs at any time.
Found this thing projects.unbit.it/uwsgi/wiki/TipsAndTricks (first point Retrieving a stack trace on request)
Pasted this code into the wsgi.py of the project,
and…
it doesn’t work a bit as expected
If the worker does some work, and I send a signal at this point in time (since I want to see what exactly my worker is doing right now), then my worker is working as usual and only then a traceback is shown for the point in time when the worker has already worked, of course there is no useful information there just something like
# ThreadID: -1224046912 (MainThread)
File: "./wsgi.py", line 56, in thread_dump
What did I do wrong, or is there any other way I could try.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
svetlov, 2012-04-02
@svetlov

Your handlers are short, obviously.
In Python, signals fire asynchronously with a slight delay.
I think the worker has time to finish its dirty work before control passes to the signal handler.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question