Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GNU parallel show jobs remaining

I guess this question/problem can be tackled by the satisfaction of one (or more) of the below problems

1) How do I show jobs remaining? 2) How do I pretty the output of --eta

1) I've checked the man page, and I am presently using $PARALLEL_SEQ in my function, but how can I get the jobs remaining? Parallel is help me to compile about 800 files, and I'd would like to know my jobs remaining.

2) Alternatively, is there a better (nicer) way to output --eta? My output looks really messy. I would only like to see a single ETA.

The parallel flags I am using: --no-notice --keep-order --group

Example of output:

819: Compiling form: USER_Q                         ok
ETA: 8s 13left 0.61avg  local:4/819/100%/0.6s

820: Compiling form: USER_RESERVE_STOCK             ok
ETA: 7s 12left 0.61avg  local:4/820/100%/0.6s

821: Compiling form: USERS_AUTO                     ok
ETA: 7s 11left 0.61avg  local:4/821/100%/0.6s

822: Compiling form: USERS                          ok
ETA: 6s 10left 0.61avg  local:4/822/100%/0.6s

823: Compiling form: USERS_MENU                     ok
ETA: 6s 9left 0.61avg  local:4/823/100%/0.6s

824: Compiling form: USER_SUPP                      ok
ETA: 4s 8left 0.61avg  local:4/824/100%/0.6s

825: Compiling form: VARIANCE_L                     ok
ETA: 4s 7left 0.61avg  local:4/825/100%/0.6s

826: Compiling form: VAR_L                          ok
ETA: 3s 6left 0.61avg  local:4/826/100%/0.6s

827: Compiling form: WASTE                          ok
ETA: 3s 5left 0.61avg  local:4/827/100%/0.6s

828: Compiling form: WASTE_L                        ok
ETA: 2s 2left 0.61avg  local:2/830/100%/0.6s

829: Compiling form: WEATHER                        ok
like image 510
Felipe Alvarez Avatar asked Oct 21 '22 19:10

Felipe Alvarez


1 Answers

You will need to redirect the output of your jobs to have --eta look nice:

seq 10 | parallel --eta 'echo foo; sleep .{}'  >/dev/null

That will also show number of jobs left. You may also find --bar usable:

seq 10 | parallel --bar 'echo foo; sleep .{}'  >/dev/null

Or a more advanced example:

seq 1000 |
  parallel -j30 --bar '(echo {};sleep 0.3)' \
  2> >(perl -pe 'BEGIN{$/="\r";$|=1};s/\r/\n/g' |
       zenity --progress --auto-kill) | wc
like image 127
Ole Tange Avatar answered Oct 23 '22 22:10

Ole Tange