49 """Implementation of `parallel` command, relying on homemade `prefix` lib."""
54 "Runs the command in parallel on local machine. Only commands "
55 "running over n-tuples may be prefixed, and must natively output "
56 "a ROOT file. The prefix command will replace the single ROOT "
57 "file with a directory containing a series of ROOT files, as well "
58 "as the standard output stream in hidden text files. Note: be nice "
59 "with your colleagues, and don't use all cores for a too long time "
60 "unless you are sure that the machine is free."
73 if cmds.help
or cmds.git:
76 pref_parallel.parse(args)
77 pref_parallel.prepare_io()
78 pref_parallel.prepare_fire_and_forget()
80 with open(pref_parallel.absoutput /
"parallel",
"w")
as backup:
83 + [pref_parallel.cmds.exec]
84 + pref_parallel.inputs
85 + [pref_parallel.output]
88 if pref_parallel.splittable:
89 shell_cmd += [
"-j", str(pref_parallel.nSplit)]
90 print(
" ".join(shell_cmd), file=backup)
93 print(f
"Run in parallel with `{pref_parallel.absoutput}/parallel`")
96 with Pool(pref_parallel.nSplit)
as pool:
99 run, [(shell_cmd, pref_parallel.output)
for shell_cmd
in shell_cmds]
103 print(
"Check the status of your tasks with `top` (or `htop` if available).")