简体   繁体   English

GNU parallel 可以打印出它调用的脚本的进度条吗?

[英]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 :给定一个打印出它自己的进度条的 RScript,比如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?我可以使用 GNU 并行工具从我的脚本中打印出进度条吗? 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. --ungroup/-u将直接传递所有 output。

It is probably not ideal: The progress bar from each process will overwrite the previous job's progress bar.这可能并不理想:每个进程的进度条将覆盖前一个作业的进度条。

Or try using --tmux :或者尝试使用--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.这将在tmux window 中启动每个作业,因此您可以从每个作业中看到 output。 --bar will give a progress bar based on completed jobs. --bar将根据已完成的作业给出进度条。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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