Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Created flag for .root kinematics input file. #1760

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions MC/bin/o2_dpg_workflow_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
parser.add_argument('--cpu-limit', help='Set CPU limit (core count)', default=8, type=float)
parser.add_argument('--cgroup', help='Execute pipeline under a given cgroup (e.g., 8coregrid) emulating resource constraints. This m\
ust exist and the tasks file must be writable to with the current user.')
parser.add_argument('--kine-input', help='Use pre-existent event generation.', default="", type=str)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer not putting such treatment in the workflow runner because the runner shouldn't know about what it is running (just some topology).

Let's rather put such a flag in the actual MC workflow script generation part.
Or we provide a dedicated generator which will just do this and simply call this generator with existing flag --gen.


# run control, webhooks
parser.add_argument('--stdout-on-failure', action='store_true', help='Print log files of failing tasks to stdout,')
Expand Down Expand Up @@ -880,6 +881,19 @@ def __init__(self, workflowfile, args, jmax=100):
exit (0)
print ('Workflow is empty. Nothing to do')
exit (0)

# Gets the .root kinematic file path and passes it to the event simulation step
# the string appended to the filename is to take account of the current timeframe
# and to skip events accordingly
if args.kine_input:
kine_fn = args.kine_input
if os.path.isfile(kine_fn):
for stage in self.workflowspec['stages']:
if "sgngen" in stage['name']:
stage['cmd'] = stage['cmd'][:-1] + " --kine-input " + kine_fn + ':' + str(stage['timeframe']) + stage['cmd'][-1]
else:
print("Input kinematic file does not exist.")
exit(2)

# construct the DAG, compute task weights
workflow = build_dag_properties(self.workflowspec)
Expand Down