shenwei356 / rush

A cross-platform command-line tool for executing jobs in parallel
https://github.com/shenwei356/rush
MIT License
845 stars 63 forks source link

error handling #29

Open eccles opened 4 years ago

eccles commented 4 years ago

Not a bug but a request.

I would like to know the error status of all parallel jobs as a list that I can inspect in a shell to determine which has failed.

Also rush should exit with non-zero error code for:

  1. if any of the parallel jobs has failed.
  2. If all parallel jobs have failed - i.e if any of the jobs has succeeded rush reports zero

IS this possible using the current implementation ? My reading of the docs indicates not so.

bburgin commented 4 years ago

You could try specifying the -C argument. It will cause rush to write successes out to a file. You should be able to inspect the file to deduce which calls succeeded and thus which ones failed. Please ensure you are not specifying -e, --stop-on-error, so that rush will try each command before exiting.

For your request 1. above, rush should already be doing this. By default, rush has --propagate-exit-status enabled, which will cause it to propagate a failing child exit code up as rush's exit code. By looking at rush's exit code, you should be able to know that a child failed or not.

For your request 2. above, what is your specific use case? a. Are you wanting to do trials of the same child command? Or run different commands? b. Are you wanting to keep the first that succeeds and cancel the rest? Or stop after first error? Or run all to completion? (keep the results of any that succeed or fail?)

There are many possible combinations of behaviors. Without knowing your use case, it is hard to know if rush can/should do it or not. Also, I doubt rush will be able to cover all combinations. Currently, rush only runs commands to completion or stops after first error (-e, --stop-on-error).