简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM