rust-parallel icon indicating copy to clipboard operation
rust-parallel copied to clipboard

Alternative error behaviours to `--exit-on-error`

Open zakstucke opened this issue 1 year ago • 0 comments

As mentioned in #21:

Current usecase:

  • Running multiple processes from a single docker instance, e.g. a webserver + background task processor.
  • I used to do this using GNU parallel, but for various reasons it's caused me problems, and I wanted a simple binary parallel runner instead, so rust-parallel sounded like a good fit.

--exit-on-error currently doesn't meet this usecase: given each process is infinite, unless a termination is sent to the other processes, the docker container will not exit on error, this usecase requires the container to exit if any process dies. (a container exits when it's entrypoint command finishes)

In my scenario ideally rust-parallel could:

  • If any process errors, instantly send SIGTERM+SIGHUP to all running processes, allowing the processes the ability to "cleanly" exit.
  • After a period of time, e.g. 15 seconds, remaining processes that have not exited after the soft kill, are sent SIGKILL to forcefully end the processes.

That's the ideal scenario, the exact cli params that offer that generically I don't claim to be 100% sure of!

zakstucke avatar May 16 '24 16:05 zakstucke