Skip to content

Proposed enhancements to GNU Parallel

martinda edited this page Apr 16, 2015 · 3 revisions

Enhancement 1: Do no kill the whole the process tree when timing out

When the --timeout val value expires, GNU parallel sends signals to the entire process tree using the following termination sequence: SIGTERM, wait 200ms, SIGTERM, wait 200ms, SIGKILL

In some cases you might want to cooperatively dismantle the process tree starting by terminating the children processes and ending by terminating the parent processes. This termination process is documented as the WUE and WCE methods. Since right now GNU parallel broadcasts the termination sequence to the entire process tree at once, an option is needed to turn this broadcast into a targeted operation that signals only the top processes of the process tree.

I propose to add the --limit-term-seq-to-parent option to GNU Parallel. When this option is set, GNU Parallel only sends the termination sequence to the parent of each process tree it manages. It is the responsibility of the parent processes to propagate the termination sequence to their children processes. Since it is possible for any process in the process tree to be unresponsive, we do not want to lock up GNU parallel. So if there are still processes running in the process tree once GNU parallel has applied the termination sequence to the parents, GNU parallel will fall back to the default behaviour and reapply the termination sequence to the entire process tree.

TODO

  • deal with --halt in the same way?
  • provide option to change the termination sequence
  • provide option to propagate the termination sequence when GNU parallel receives the TERM signal (so as to interrupt the running jobs)
Clone this wiki locally