Skip to content

Add an option in python runner to execute an arbitrary script after fork

Rafal Bielski requested to merge rbielski/HLTMPPU:script-after-fork into master

Another new feature to facilitate debugging and profiling. Allow to execute an arbitrary script in the python runner just after forking. The script may contain a format string {pid} which will be replaced with the PID of the corresponding process. There are three options to execute: for the mother process, for the first fork, or for each fork in a sequence. The script process is started in the background and its outputs are redirected to files.

I plan to map this option to athenaHLT.py command line argument --scriptAfterFork, mirroring the option provided in this MR for runHLTMPPy.py.

Potential use cases:

# profile memory in one fork
athenaHLT.py --scriptAfterFork "firstFork:heaptrack -p {pid}" <other-args>

# run vtune collection for one fork
athenaHLT.py --scriptAfterFork "firstFork:vtune -collect hotspots -target-pid {pid}" <other-args>

# run perf collection for all forks
athenaHLT.py --scriptAfterFork "allForks:perf record -o perf_{pid}.data -p {pid}" <other-args>

Plus anything you can imagine.

@fwinkl, @wiedenma, @ssottoco, @smh please let me know if you would like this feature to be merged.

Edited by Rafal Bielski

Merge request reports