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.
Currently, if the process being profiled terminates before Pyflame has finished, the Pyflame process errors rather than printing what has been profiled up until that point.
Ideally, if the process being profiled terminates before Pyflame has finished, the Pyflame process would exit cleanly and the output be as normal.
I'm not sure of the feasibility of this request so feel free to close the issue if appropriate.
Reproducible example
Running the following will demonstrate the error:
$ python -c "from time import sleep; sleep(1)"& sudo pyflame "$!" -s 5
[1] 11075
Failed to attach to PID 11075: No such process
Use case
I'm trying to profile a set of tests that are invoked with py.test ....
Currently, I start this process in the background with py.test ... &. I determine the PID of the process (by writing and reading from a file) and then call Pyflame on this PID. Given that I want to profile the whole test suite, I have to match the time that Pyflame is called for with the time the test suite should take to run (which is naturally variable).
It would be especially convenient to call Pyflame for longer than necessary to ensure the whole test suite is profiled.
The text was updated successfully, but these errors were encountered:
So I fixed this in the sense that if the process exits early pyflame will just print the results it has so far. However, there's something even better that can be done for your use case. Ptrace has a special "trace me" mode for observing the entire lifetime of a process. This is how the strace command works, e.g. when you do strace ls it will watch the ls process from the moment it starts until it ends. The use case you have here (profiling a test suite) is pretty interesting and I think it should be supported with the trace mode.
Thanks @eklitzke for the rapid work. I'm still seeing the same issue though (after pulling from master):
$ python -c "from time import sleep; sleep(1)"& sudo pyflame "$!" -s 5
[1] 19824
Failed to attach to PID 19824: No such process
[1]+ Done python -c "from time import sleep; sleep(1)"
Regarding the trace mode, that sounds like a great idea! I'll take a look to see if I can assist but this might be beyond me...
Currently, if the process being profiled terminates before Pyflame has finished, the Pyflame process errors rather than printing what has been profiled up until that point.
Ideally, if the process being profiled terminates before Pyflame has finished, the Pyflame process would exit cleanly and the output be as normal.
I'm not sure of the feasibility of this request so feel free to close the issue if appropriate.
Reproducible example
Running the following will demonstrate the error:
Use case
I'm trying to profile a set of tests that are invoked with
py.test ...
.Currently, I start this process in the background with
py.test ... &
. I determine the PID of the process (by writing and reading from a file) and then call Pyflame on this PID. Given that I want to profile the whole test suite, I have to match the time that Pyflame is called for with the time the test suite should take to run (which is naturally variable).It would be especially convenient to call Pyflame for longer than necessary to ensure the whole test suite is profiled.
The text was updated successfully, but these errors were encountered: