rust-parallel
rust-parallel copied to clipboard
Alternative error behaviours to `--exit-on-error`
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+SIGHUPto 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
SIGKILLto 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!