Skip to content

Commit

Permalink
operational options: add initfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Adelina Lintuluoto committed Jun 26, 2020
1 parent 64fb637 commit be7a6e8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion reana_workflow_engine_yadage/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import json
import logging
import os
import yaml

import click
import yadageschemas
Expand Down Expand Up @@ -53,6 +54,11 @@ def load_yadage_operational_options(ctx, param, operational_options):
operational_options["initdir"] = os.path.join(
workflow_workspace, operational_options.get("initdir", "")
)

operational_options["initfiles"] = operational_options.get("initfiles", [])
for i, initfile in enumerate(operational_options["initfiles"]):
operational_options["initfiles"][i] = os.path.join(workflow_workspace, initfile)

return operational_options


Expand Down Expand Up @@ -123,12 +129,18 @@ def run_yadage_workflow(
)
workflow_kwargs = dict(workflow_json=workflow_json)
dataopts = {"initdir": operational_options["initdir"]}

initdata = {}
for initfile in operational_options["initfiles"]:
initdata.update(**yaml.safe_load(open(initfile)))
initdata.update(workflow_parameters)

check_connection_to_job_controller()

with steering_ctx(
dataarg=workflow_workspace,
dataopts=dataopts,
initdata=workflow_parameters if workflow_parameters else {},
initdata=initdata,
visualize=True,
updateinterval=5,
loginterval=5,
Expand Down

0 comments on commit be7a6e8

Please sign in to comment.