bash - GNU Parallel - Detecting that a command run in parallel has completed -
so have situation i'm running numerous commands parallel , piping output script consumes output. problem i'm having script processing of output needs know when particular command has finished executing.
i'm using --tag option know command has generated output have wait until parallel done running commands before can know i'm not going anymore output particular command. understanding of parallel see following possible solutions none suit me.
i group output lines
--line-bufferoption looks ran sequentially. whenever see output next command know previous has finished, doing way slows me 1 command may take 30 seconds complete while after there may 20 other commands took 1 second , wish process them in close real-time possible.i wrap command in tiny bash script outputs 'process id done' notification command completed. don't because i'm running several hundred commands @ time , don't want add bash processes.
i hoping i'm missing in docs , there flag in there i'm looking for.
my understanding parallel implemented in perl, i'm comfortable with, rather not have add functionality myself unless necessary.
any or suggestions appreciated.
the default behaviour --tag should work perfectly. not output until job done. , postprocessor can grab argument start of line.
example:
parallel -j3 --tag 'echo job {} start; sleep {}; echo job {} ended' ::: 7 1 3 5 2 4 6 if want keep order:
parallel -j3 --keep-order --tag 'echo job {} start; sleep {}; echo job {} ended' ::: 7 1 3 5 2 4 6 notice how jobs mix if output done immediately. compare --ungroup (which not want):
parallel -j3 --ungroup 'echo job {} start; sleep {}; echo job {} ended' ::: 7 1 3 5 2 4 6
Comments
Post a Comment