benfred / py-spy

Sampling profiler for Python programs
MIT License
12.14k stars 400 forks source link

Is it possible to trigger writing the output file without terminating the process? #604

Open Stono opened 10 months ago

Stono commented 10 months ago

I'm experimenting with py-spy in a container, it doesn't run as root, so i'm using the py-spy record -- whatever type option. It works great, but i have to kill the container to generate the dump.

This is a bit fiddly on kubernetes, because i need to write it somewhere that will persist the container restart.

I'm wondering if there's any way to get it to write its data either periodically to disk, or with a process signal, rather than on process exit?

Thanks!