Can GNU parallel print out the progress bar for scripts it calls?

Viewed 149

Given an RScript that prints out it's own progress bar, say myscript.R:

pBar <- txtProgressBar(style = 1)
L <- 10L

for (m1 in seq_len(L)) {
  Sys.sleep(0.5)
  setTxtProgressBar(pb = pBar,
                    value = m1 / L)
}

Can I get GNU parallel tools to print out the progress bars from my script? Will it manage new sets of progress bars?

My typical usage of parallel something like:

parallel --jobs 5 --progress "RScript ~/myrscript.R {#}" ::: `seq 20`

I'd like to be able to see each progress bar print out, and then either bars for the next set replace the first, or print underneath on new lines.

1 Answers

Try:

parallel --jobs 5 -u RScript ~/myrscript.R {#} ::: `seq 20`

--ungroup/-u will pass all output directly.

It is probably not ideal: The progress bar from each process will overwrite the previous job's progress bar.

Or try using --tmux:

parallel --jobs 5 --tmux --bar RScript ~/myrscript.R {#} ::: `seq 20`

This will start each job in a tmux window, so you can see the output from each job. --bar will give a progress bar based on completed jobs.

Related