27 """Implementation of `try` command, relying on homemade `prefix` lib."""
32 f
"Runs the command for {MAX_N_EVENTS} events. Only commands "
33 "running over n-tuples may be prefixed, and must natively "
46 if cmds.help
or cmds.git:
50 pref_try.prepare_io(multi=
False)
52 output = str(pref_try.absoutput)
54 if os.path.isdir(pref_try.output):
55 pref_try.output += f
"/0{pref_try.extension}"
57 shell_cmd = [pref_try.cmds.exec] + pref_try.inputs + [output] + pref_try.args
59 if pref_try.splittable
and len(pref_try.inputs) > 0:
60 nevents = pref_try.get_entries(pref_try.inputs[0])
62 pref_try.nSplit = max(nevents // MAX_N_EVENTS, 1)
63 shell_cmd += [
"-j", str(pref_try.nSplit)]
65 print(
" ".
join(shell_cmd))
66 subprocess.run(shell_cmd, check=
True)