You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.
I am trying to use pyflame to profile requests to a web server.
The web server is written in Flask, so what I'm currently doing is adding a "before every request" hook which currently spawns a pyflame process and attaches to the Flask process using its own PID.
I then have an "after every request" hook which I want to use to terminate pyflame at the end of the request, and get my profiling information for that request.
Unfortunately, I've tried sending SIGTERM and various other signals, but pyflame does not seem to want to output anything until its full completion. It creates the output file, but I obviously cannot predict how long each request is going to run for, so currently I'm passing -s 60 as any request would time out after 60 seconds anyways.
I think it would be really useful to make pyflame to accept a SIGTERM signal which would cause it to spit out its output at the end. This is similar to #25 which makes pyflame spit out output when the process it is profiling terminates; however, I think terminating pyflame itself is also useful in cases like mine.
I cannot use the tracing (-t) mode because my web server runs constantly instead of from start to finish - it is the requests that come and go and require individual profiling sessions.
If anyone has any advice on what I can do prior to having to modify pyflame myself, I'd be very grateful!
Many thanks,
Norbert
The text was updated successfully, but these errors were encountered:
Norbo11
changed the title
Invoking pyflame programmatically for an undefined period of time
Make pyflame create output after itself being terminated
Feb 12, 2019
Hi,
I am trying to use pyflame to profile requests to a web server.
The web server is written in Flask, so what I'm currently doing is adding a "before every request" hook which currently spawns a pyflame process and attaches to the Flask process using its own PID.
I then have an "after every request" hook which I want to use to terminate pyflame at the end of the request, and get my profiling information for that request.
Unfortunately, I've tried sending SIGTERM and various other signals, but pyflame does not seem to want to output anything until its full completion. It creates the output file, but I obviously cannot predict how long each request is going to run for, so currently I'm passing
-s 60
as any request would time out after 60 seconds anyways.I think it would be really useful to make pyflame to accept a SIGTERM signal which would cause it to spit out its output at the end. This is similar to #25 which makes pyflame spit out output when the process it is profiling terminates; however, I think terminating pyflame itself is also useful in cases like mine.
I cannot use the tracing (
-t
) mode because my web server runs constantly instead of from start to finish - it is the requests that come and go and require individual profiling sessions.If anyone has any advice on what I can do prior to having to modify pyflame myself, I'd be very grateful!
Many thanks,
Norbert
The text was updated successfully, but these errors were encountered: