.s.GNU parallel, execution of commands from file few at a time

一笑奈何 提交于 2020-02-05 13:04:07

问题


I have a file called macse.cmd which contains 1000 commands to execute, 1 command per line.

I want to use parallel to execute 30 at a time. I don't care in what order they are executed as long as all are.

I tried "parallel -j 30 ./macse.cmd" but this caused them to run 1 by 1 and I am not even sure how to stop them.

Adrian

p.s.

Commands look like:

java -jar -Xmx5000m ~/programs/macse_v1.01b.jar -prog alignSequences -seq M715_2100035271/all_unaligned.fasta -out_NT M715_2100035271/aligned_nt.fasta -out_AA M715_2100035271/aligned_aa.fasta
java -jar -Xmx5000m ~/programs/macse_v1.01b.jar -prog alignSequences -seq M715_100078281/all_unaligned.fasta -out_NT M715_100078281/aligned_nt.fasta -out_AA M715_100078281/aligned_aa.fasta
java -jar -Xmx5000m ~/programs/macse_v1.01b.jar -prog alignSequences -seq M715_510001221/all_unaligned.fasta -out_NT M715_510001221/aligned_nt.fasta -out_AA M715_510001221/aligned_aa.fasta
java -jar -Xmx5000m ~/programs/macse_v1.01b.jar -prog alignSequences -seq M715_100094159/all_unaligned.fasta -out_NT M715_100094159/aligned_nt.fasta -out_AA M715_100094159/aligned_aa.fasta

So it's only the M715_ number that changes between commands.


回答1:


Is the command always the same? As in

echo "A"
echo "B"
echo "C"

?

Then you should change it to:

"A"
"B"
"C"

and run: parallel -j 30 -a macse.cmd echo where of course echo is your actuall command.




回答2:


parallel -j 30 < ./macse.cmd

or:

parallel java -jar -Xmx5000m ~/programs/macse_v1.01b.jar -prog alignSequences -seq {}/all_unaligned.fasta -out_NT {}/aligned_nt.fasta -out_AA {}/aligned_aa.fasta ::: M*/

Walk through the tutorial:

man parallel_tutorial


来源:https://stackoverflow.com/questions/28072857/s-gnu-parallel-execution-of-commands-from-file-few-at-a-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!