diff --git a/pydra/engine/core.py b/pydra/engine/core.py index 723b5493f1..d84274f576 100644 --- a/pydra/engine/core.py +++ b/pydra/engine/core.py @@ -125,7 +125,6 @@ def __init__( if TaskBase._etelemetry_version_data is None: TaskBase._etelemetry_version_data = check_latest_version() - # raise error if name is same as of attributes if name in dir(self): raise ValueError("Cannot use names of attributes or methods as task name") @@ -166,7 +165,6 @@ def __init__( self.inputs = attr.evolve(self.inputs, **inputs) self.inputs.check_metadata() self.state_inputs = inputs - self.audit = Audit( audit_flags=audit_flags, messengers=messengers, @@ -664,6 +662,7 @@ class Workflow(TaskBase): def __init__( self, name, + inputs: ty.Optional[ty.Union[ty.Text, File, ty.Dict]] = None, audit_flags: AuditFlag = AuditFlag.NONE, cache_dir=None, cache_locations=None, @@ -730,7 +729,7 @@ def __init__( super(Workflow, self).__init__( name=name, - inputs=kwargs, + inputs=inputs, cache_dir=cache_dir, cache_locations=cache_locations, audit_flags=audit_flags, diff --git a/pydra/engine/specs.py b/pydra/engine/specs.py index b69620a89a..8eec02b6b3 100644 --- a/pydra/engine/specs.py +++ b/pydra/engine/specs.py @@ -432,7 +432,7 @@ def _file_check(self, field): pass # if this is a local path, checking if the path exists elif file.exists(): - if self.bindings is None: + if self.bindings in [None, attr.NOTHING]: self.bindings = [] self.bindings.append((file.parent, f"/pydra_inp_{field.name}", "ro")) else: diff --git a/pydra/engine/task.py b/pydra/engine/task.py index b16984cc2c..007c58a074 100644 --- a/pydra/engine/task.py +++ b/pydra/engine/task.py @@ -67,6 +67,7 @@ class FunctionTask(TaskBase): def __init__( self, func: ty.Callable, + inputs: ty.Optional[ty.Union[ty.Text, File, ty.Dict]] = None, audit_flags: AuditFlag = AuditFlag.NONE, cache_dir=None, cache_locations=None, @@ -138,7 +139,7 @@ def __init__( name = func.__name__ super(FunctionTask, self).__init__( name, - inputs=kwargs, + inputs=inputs, audit_flags=audit_flags, messengers=messengers, messenger_args=messenger_args, @@ -244,6 +245,9 @@ def __new__(cls, container_info=None, *args, **kwargs): def __init__( self, + inputs: ty.Optional[ty.Union[ty.Text, File, ty.Dict]] = None, + executable: ty.Optional[ty.Union[ty.List, str]] = None, + args: ty.Optional[ty.Union[ty.List, str, File]] = None, audit_flags: AuditFlag = AuditFlag.NONE, cache_dir=None, input_spec: ty.Optional[SpecInfo] = None, @@ -283,12 +287,21 @@ def __init__( self.input_spec = input_spec if output_spec is None: output_spec = SpecInfo(name="Output", fields=[], bases=(ShellOutSpec,)) + if inputs is None: + inputs = {} + # adding executable and args to inputs + inputs["executable"] = executable + inputs["args"] = args + if isinstance(self, ContainerTask): + # adding image and bindings when ContainerTask + inputs["image"] = kwargs["image"] + inputs["bindings"] = kwargs["bindings"] self.output_spec = output_spec super(ShellCommandTask, self).__init__( name=name, - inputs=kwargs, + inputs=inputs, audit_flags=audit_flags, messengers=messengers, messenger_args=messenger_args, @@ -350,6 +363,8 @@ def _command_args_single(self, state_ind, ind=None): if f.type is bool: if value is not True: break + elif value in [None, attr.NOTHING]: + continue else: cmd_add += ensure_list(value, tuple2list=True) if cmd_add is not None: @@ -419,6 +434,8 @@ class ContainerTask(ShellCommandTask): def __init__( self, name, + image: ty.Optional[str] = None, + bindings: ty.Optional[ty.List] = None, audit_flags: AuditFlag = AuditFlag.NONE, cache_dir=None, input_spec: ty.Optional[SpecInfo] = None, @@ -468,6 +485,8 @@ def __init__( cache_dir=cache_dir, strip=strip, rerun=rerun, + image=image, + bindings=bindings, **kwargs, ) @@ -479,14 +498,14 @@ def container_check(self, container_type): raise AttributeError( f"Container type should be {container_type}, but {self.inputs.container} given" ) - if self.inputs.image is attr.NOTHING: + if self.inputs.image in [None, attr.NOTHING]: raise AttributeError("Container image is not specified") def bind_paths(self, ind=None): """Return bound mount points: ``dict(lpath: (cpath, mode))``.""" bind_paths = {} output_dir_cpath = None - if self.inputs.bindings is None: + if self.inputs.bindings in [None, attr.NOTHING]: self.inputs.bindings = [] if ind is None: output_dir = self.output_dir diff --git a/pydra/engine/tests/test_boutiques.py b/pydra/engine/tests/test_boutiques.py index b2ea022b77..90d4615cc9 100644 --- a/pydra/engine/tests/test_boutiques.py +++ b/pydra/engine/tests/test_boutiques.py @@ -51,8 +51,7 @@ def test_boutiques_spec_1(): btask = BoshTask( name="NA", zenodo_id="1482743", - infile=Infile, - maskfile="test_brain.nii.gz", + inputs={"infile": Infile, "maskfile": "test_brain.nii.gz"}, input_spec_names=["infile", "maskfile"], output_spec_names=["outfile", "out_outskin_off"], ) @@ -76,8 +75,7 @@ def test_boutiques_spec_2(): btask = BoshTask( name="NA", zenodo_id="1482743", - infile=Infile, - maskfile="test_brain.nii.gz", + inputs={"infile": Infile, "maskfile": "test_brain.nii.gz"}, input_spec_names=["infile"], output_spec_names=[], ) @@ -107,8 +105,7 @@ def test_boutiques_wf_1(maskfile, plugin): BoshTask( name="bet", zenodo_id="1482743", - infile=wf.lzin.infile, - maskfile=wf.lzin.maskfile, + inputs={"infile": wf.lzin.infile, "maskfile": wf.lzin.maskfile}, ) ) @@ -138,13 +135,14 @@ def test_boutiques_wf_2(maskfile, plugin): BoshTask( name="bet", zenodo_id="1482743", - infile=wf.lzin.infile, - maskfile=wf.lzin.maskfile, + inputs={"infile": wf.lzin.infile, "maskfile": wf.lzin.maskfile}, ) ) wf.add( BoshTask( - name="stat", zenodo_id="3240521", input_file=wf.bet.lzout.outfile, v=True + name="stat", + zenodo_id="3240521", + inputs={"input_file": wf.bet.lzout.outfile, "v": True}, ) ) wf.add(ShellCommandTask(name="cat", executable="cat", args=wf.stat.lzout.output)) diff --git a/pydra/engine/tests/test_dockertask.py b/pydra/engine/tests/test_dockertask.py index e442d7d31e..1b2dcd154f 100644 --- a/pydra/engine/tests/test_dockertask.py +++ b/pydra/engine/tests/test_dockertask.py @@ -689,7 +689,7 @@ def test_docker_inputspec_1(plugin, tmpdir): name="docky", image="busybox", executable=cmd, - file=filename, + inputs={"file": filename}, input_spec=my_input_spec, strip=True, ) @@ -776,7 +776,7 @@ def test_docker_inputspec_2(plugin, tmpdir): name="docky", image="busybox", executable=cmd, - file1=filename_1, + inputs={"file1": filename_1}, input_spec=my_input_spec, strip=True, ) @@ -826,7 +826,7 @@ def test_docker_inputspec_2a_except(plugin, tmpdir): name="docky", image="busybox", executable=cmd, - file2=filename_2, + inputs={"file2": filename_2}, input_spec=my_input_spec, strip=True, ) @@ -878,7 +878,7 @@ def test_docker_inputspec_2a(plugin, tmpdir): name="docky", image="busybox", executable=cmd, - file2=filename_2, + inputs={"file2": filename_2}, input_spec=my_input_spec, strip=True, ) @@ -919,7 +919,7 @@ def test_docker_inputspec_3(plugin, tmpdir): name="docky", image="busybox", executable=cmd, - file=filename, + inputs={"file": filename}, input_spec=my_input_spec, strip=True, ) @@ -963,7 +963,7 @@ def test_docker_inputspec_3a(plugin, tmpdir): name="docky", image="busybox", executable=cmd, - file=filename, + inputs={"file": filename}, input_spec=my_input_spec, strip=True, ) @@ -1020,7 +1020,7 @@ def test_docker_cmd_inputspec_copyfile_1(plugin, tmpdir): image="busybox", executable=cmd, input_spec=my_input_spec, - orig_file=str(file), + inputs={"orig_file": str(file)}, ) res = docky() @@ -1073,7 +1073,7 @@ def test_docker_inputspec_state_1(plugin, tmpdir): name="docky", image="busybox", executable=cmd, - file=filename, + inputs={"file": filename}, input_spec=my_input_spec, strip=True, ).split("file") @@ -1122,7 +1122,7 @@ def test_docker_inputspec_state_1b(plugin, tmpdir): name="docky", image="busybox", executable=cmd, - file=filename, + inputs={"file": filename}, input_spec=my_input_spec, strip=True, ).split("file") @@ -1168,7 +1168,7 @@ def test_docker_wf_inputspec_1(plugin, tmpdir): name="docky", image="busybox", executable=wf.lzin.cmd, - file=wf.lzin.file, + inputs={"file": wf.lzin.file}, input_spec=my_input_spec, strip=True, ) @@ -1223,7 +1223,7 @@ def test_docker_wf_state_inputspec_1(plugin, tmpdir): name="docky", image="busybox", executable=wf.lzin.cmd, - file=wf.lzin.file, + inputs={"file": wf.lzin.file}, input_spec=my_input_spec, strip=True, ) @@ -1280,7 +1280,7 @@ def test_docker_wf_ndst_inputspec_1(plugin, tmpdir): name="docky", image="busybox", executable=wf.lzin.cmd, - file=wf.lzin.file, + inputs={"file": wf.lzin.file}, input_spec=my_input_spec, strip=True, ).split("file") diff --git a/pydra/engine/tests/test_helpers.py b/pydra/engine/tests/test_helpers.py index 45b3c08e87..58287d7c7b 100644 --- a/pydra/engine/tests/test_helpers.py +++ b/pydra/engine/tests/test_helpers.py @@ -18,7 +18,7 @@ def test_save(tmpdir): outdir = Path(tmpdir) with pytest.raises(ValueError): save(tmpdir) - foo = multiply(name="mult", x=1, y=2) + foo = multiply(name="mult", inputs={"x": 1, "y": 2}) # save task save(outdir, task=foo) del foo @@ -203,7 +203,7 @@ def test_load_and_run(tmpdir): """ testing load_and_run for pickled task""" task_pkl = Path(tmpdir.join("task_main.pkl")) - task = multiply(name="mult", x=[1, 2], y=10).split("x") + task = multiply(name="mult", inputs={"x": [1, 2], "y": 10}).split("x") task.state.prepare_states(inputs=task.inputs) task.state.prepare_inputs() with task_pkl.open("wb") as fp: @@ -221,7 +221,7 @@ def test_load_and_run(tmpdir): def test_load_and_run_exception_load(tmpdir): """ testing raising exception and saving info in crashfile when when load_and_run""" task_pkl = Path(tmpdir.join("task_main.pkl")) - task = raise_xeq1(name="raise", x=[1, 2]).split("x") + task = raise_xeq1(name="raise", inputs={"x": [1, 2]}).split("x") with pytest.raises(FileNotFoundError) as excinfo: task_0 = load_and_run(task_pkl=task_pkl, ind=0) @@ -230,7 +230,7 @@ def test_load_and_run_exception_run(tmpdir): """ testing raising exception and saving info in crashfile when when load_and_run""" task_pkl = Path(tmpdir.join("task_main.pkl")) - task = raise_xeq1(name="raise", x=[1, 2]).split("x") + task = raise_xeq1(name="raise", inputs={"x": [1, 2]}).split("x") task.state.prepare_states(inputs=task.inputs) task.state.prepare_inputs() @@ -262,7 +262,7 @@ def test_load_and_run_wf(tmpdir): wf_pkl = Path(tmpdir.join("wf_main.pkl")) wf = Workflow(name="wf", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) wf.split(("x")) wf.inputs.x = [1, 2] wf.inputs.y = 10 diff --git a/pydra/engine/tests/test_node_task.py b/pydra/engine/tests/test_node_task.py index 02afde89f7..b0c14ed67f 100644 --- a/pydra/engine/tests/test_node_task.py +++ b/pydra/engine/tests/test_node_task.py @@ -49,7 +49,7 @@ def test_task_init_1a(): def test_task_init_2(): """ task with a name and inputs""" - nn = fun_addtwo(name="NA", a=3) + nn = fun_addtwo(name="NA", inputs={"a": 3}) # adding NA to the name of the variable assert getattr(nn.inputs, "a") == 3 assert nn.state is None @@ -61,7 +61,7 @@ def test_task_init_2(): ) def test_task_init_3(splitter, state_splitter, state_rpn, states_ind, states_val): """ task with inputs and splitter""" - nn = fun_addtwo(name="NA", a=[3, 5]).split(splitter=splitter) + nn = fun_addtwo(name="NA", inputs={"a": [3, 5]}).split(splitter=splitter) assert np.allclose(nn.inputs.a, [3, 5]) assert nn.state.splitter == state_splitter @@ -103,7 +103,9 @@ def test_task_init_3(splitter, state_splitter, state_rpn, states_ind, states_val ) def test_task_init_3a(splitter, state_splitter, state_rpn, states_ind, states_val): """ task with inputs and splitter""" - nn = fun_addvar(name="NA", a=[3, 5], b=[10, 20]).split(splitter=splitter) + nn = fun_addvar(name="NA", inputs={"a": [3, 5], "b": [10, 20]}).split( + splitter=splitter + ) assert np.allclose(nn.inputs.a, [3, 5]) assert np.allclose(nn.inputs.b, [10, 20]) @@ -117,7 +119,7 @@ def test_task_init_3a(splitter, state_splitter, state_rpn, states_ind, states_va def test_task_init_4(): """ task with interface and inputs. splitter set using split method""" - nn = fun_addtwo(name="NA", a=[3, 5]) + nn = fun_addtwo(name="NA", inputs={"a": [3, 5]}) nn.split(splitter="a") assert np.allclose(nn.inputs.a, [3, 5]) @@ -277,7 +279,7 @@ def test_task_init_5c(): def test_task_init_6(): """ task with splitter, but the input is an empty list""" - nn = fun_addtwo(name="NA", a=[]) + nn = fun_addtwo(name="NA", inputs={"a": []}) nn.split(splitter="a") assert nn.inputs.a == [] @@ -299,7 +301,7 @@ def test_task_init_7(tmpdir): with open(file2, "w") as f: f.write("from pydra\n") - nn1 = fun_file_list(name="NA", filename_list=[file1, file2]) + nn1 = fun_file_list(name="NA", inputs={"filename_list": [file1, file2]}) output_dir1 = nn1.output_dir # changing the content of the file @@ -307,7 +309,7 @@ def test_task_init_7(tmpdir): with open(file2, "w") as f: f.write("from pydra") - nn2 = fun_file_list(name="NA", filename_list=[file1, file2]) + nn2 = fun_file_list(name="NA", inputs={"filename_list": [file1, file2]}) output_dir2 = nn2.output_dir # the checksum should be different - content of file2 is different @@ -322,17 +324,17 @@ def test_task_init_8(): def test_task_init_9(): """ task without setting the input, but using the default avlue from function""" - nn1 = fun_addvar_default(name="NA", a=2) + nn1 = fun_addvar_default(name="NA", inputs={"a": 2}) assert nn1.inputs.b == 1 - nn2 = fun_addvar_default(name="NA", a=2, b=1) + nn2 = fun_addvar_default(name="NA", inputs={"a": 2, "b": 1}) assert nn2.inputs.b == 1 # both tasks should have the same checksum assert nn1.checksum == nn2.checksum def test_task_error(): - func = fun_div(name="div", a=1, b=0) + func = fun_div(name="div", inputs={"a": 1, "b": 0}) with pytest.raises(ZeroDivisionError): func() assert (func.output_dir / "_error.pklz").exists() @@ -342,7 +344,7 @@ def test_odir_init(): """ checking if output_dir is available for a task without init before running the task """ - nn = fun_addtwo(name="NA", a=3) + nn = fun_addtwo(name="NA", inputs={"a": 3}) assert nn.output_dir @@ -352,7 +354,7 @@ def test_odir_init(): @pytest.mark.flaky(reruns=2) # when dask def test_task_nostate_1(plugin_dask_opt): """ task without splitter""" - nn = fun_addtwo(name="NA", a=3) + nn = fun_addtwo(name="NA", inputs={"a": 3}) assert np.allclose(nn.inputs.a, [3]) assert nn.state is None @@ -380,7 +382,7 @@ def test_task_nostate_1(plugin_dask_opt): def test_task_nostate_1_call(): """ task without splitter""" - nn = fun_addtwo(name="NA", a=3) + nn = fun_addtwo(name="NA", inputs={"a": 3}) nn() # checking the results results = nn.result() @@ -392,7 +394,7 @@ def test_task_nostate_1_call(): @pytest.mark.flaky(reruns=2) # when dask def test_task_nostate_1_call_subm(plugin_dask_opt): """ task without splitter""" - nn = fun_addtwo(name="NA", a=3) + nn = fun_addtwo(name="NA", inputs={"a": 3}) assert np.allclose(nn.inputs.a, [3]) assert nn.state is None @@ -409,7 +411,7 @@ def test_task_nostate_1_call_subm(plugin_dask_opt): @pytest.mark.flaky(reruns=2) # when dask def test_task_nostate_1_call_plug(plugin_dask_opt): """ task without splitter""" - nn = fun_addtwo(name="NA", a=3) + nn = fun_addtwo(name="NA", inputs={"a": 3}) assert np.allclose(nn.inputs.a, [3]) assert nn.state is None @@ -424,7 +426,7 @@ def test_task_nostate_1_call_plug(plugin_dask_opt): def test_task_nostate_1_call_updateinp(): """ task without splitter""" - nn = fun_addtwo(name="NA", a=30) + nn = fun_addtwo(name="NA", inputs={"a": 30}) # updating input when calling the node nn(a=3) @@ -437,7 +439,7 @@ def test_task_nostate_1_call_updateinp(): def test_task_nostate_2(plugin): """ task with a list as an input, but no splitter""" - nn = moment(name="NA", n=3, lst=[2, 3, 4]) + nn = moment(name="NA", inputs={"n": 3, "lst": [2, 3, 4]}) assert np.allclose(nn.inputs.n, [3]) assert np.allclose(nn.inputs.lst, [2, 3, 4]) assert nn.state is None @@ -454,7 +456,7 @@ def test_task_nostate_2(plugin): def test_task_nostate_3(plugin): """ task with a dictionary as an input""" - nn = fun_dict(name="NA", d={"a": "ala", "b": "bala"}) + nn = fun_dict(name="NA", inputs={"d": {"a": "ala", "b": "bala"}}) assert nn.inputs.d == {"a": "ala", "b": "bala"} with Submitter(plugin=plugin) as sub: @@ -473,7 +475,7 @@ def test_task_nostate_4(plugin, tmpdir): with open(file1, "w") as f: f.write("hello from pydra\n") - nn = fun_file(name="NA", filename=file1) + nn = fun_file(name="NA", inputs={"filename": file1}) with Submitter(plugin) as sub: sub(nn) @@ -495,7 +497,8 @@ def test_task_nostate_5(plugin, tmpdir): with open(file2, "w") as f: f.write("from pydra\n") - nn = fun_file_list(name="NA", filename_list=[file1, file2]) + nn = fun_file_list(name="NA") + nn.inputs.filename_list = [file1, file2] with Submitter(plugin=plugin) as sub: sub(nn) @@ -509,7 +512,7 @@ def test_task_nostate_5(plugin, tmpdir): def test_task_nostate_6(): """ checking if the function gets the None value""" - nn = fun_addvar_none(name="NA", a=2, b=None) + nn = fun_addvar_none(name="NA", inputs={"a": 2, "b": None}) assert nn.inputs.b is None nn() assert nn.result().output.out == 2 @@ -517,7 +520,7 @@ def test_task_nostate_6(): def test_task_nostate_6a_exception(): """ checking if the function gets the attr.Nothing value""" - nn = fun_addvar_none(name="NA", a=2) + nn = fun_addvar_none(name="NA", inputs={"a": 2}) assert nn.inputs.b is attr.NOTHING with pytest.raises(TypeError) as excinfo: nn() @@ -526,7 +529,7 @@ def test_task_nostate_6a_exception(): def test_task_nostate_7(): """ using the default value from the function for b input""" - nn = fun_addvar_default(name="NA", a=2) + nn = fun_addvar_default(name="NA", inputs={"a": 2}) assert nn.inputs.b == 1 nn() assert nn.result().output.out == 3 @@ -539,7 +542,8 @@ def test_task_nostate_7(): def test_task_nostate_cachedir(plugin_dask_opt, tmpdir): """ task with provided cache_dir using pytest tmpdir""" cache_dir = tmpdir.mkdir("test_task_nostate") - nn = fun_addtwo(name="NA", a=3, cache_dir=cache_dir) + nn = fun_addtwo(name="NA", cache_dir=cache_dir) + nn.inputs.a = 3 assert np.allclose(nn.inputs.a, [3]) assert nn.state is None @@ -558,7 +562,8 @@ def test_task_nostate_cachedir_relativepath(tmpdir, plugin_dask_opt): cache_dir = "test_task_nostate" tmpdir.mkdir(cache_dir) - nn = fun_addtwo(name="NA", a=3, cache_dir=cache_dir) + nn = fun_addtwo(name="NA", cache_dir=cache_dir) + nn.inputs.a = 3 assert np.allclose(nn.inputs.a, [3]) assert nn.state is None @@ -581,11 +586,13 @@ def test_task_nostate_cachelocations(plugin_dask_opt, tmpdir): cache_dir = tmpdir.mkdir("test_task_nostate") cache_dir2 = tmpdir.mkdir("test_task_nostate2") - nn = fun_addtwo(name="NA", a=3, cache_dir=cache_dir) + nn = fun_addtwo(name="NA", cache_dir=cache_dir) + nn.inputs.a = 3 with Submitter(plugin=plugin_dask_opt) as sub: sub(nn) - nn2 = fun_addtwo(name="NA", a=3, cache_dir=cache_dir2, cache_locations=cache_dir) + nn2 = fun_addtwo(name="NA", cache_dir=cache_dir2, cache_locations=cache_dir) + nn2.inputs.a = 3 with Submitter(plugin=plugin_dask_opt) as sub: sub(nn2) @@ -607,11 +614,13 @@ def test_task_nostate_cachelocations_forcererun(plugin, tmpdir): cache_dir = tmpdir.mkdir("test_task_nostate") cache_dir2 = tmpdir.mkdir("test_task_nostate2") - nn = fun_addtwo(name="NA", a=3, cache_dir=cache_dir) + nn = fun_addtwo(name="NA", cache_dir=cache_dir) + nn.inputs.a = 3 with Submitter(plugin=plugin) as sub: sub(nn) - nn2 = fun_addtwo(name="NA", a=3, cache_dir=cache_dir2, cache_locations=cache_dir) + nn2 = fun_addtwo(name="NA", cache_dir=cache_dir2, cache_locations=cache_dir) + nn2.inputs.a = 3 with Submitter(plugin=plugin) as sub: sub(nn2, rerun=True) @@ -632,10 +641,12 @@ def test_task_nostate_cachelocations_nosubmitter(tmpdir): cache_dir = tmpdir.mkdir("test_task_nostate") cache_dir2 = tmpdir.mkdir("test_task_nostate2") - nn = fun_addtwo(name="NA", a=3, cache_dir=cache_dir) + nn = fun_addtwo(name="NA", cache_dir=cache_dir) + nn.inputs.a = 3 nn() - nn2 = fun_addtwo(name="NA", a=3, cache_dir=cache_dir2, cache_locations=cache_dir) + nn2 = fun_addtwo(name="NA", cache_dir=cache_dir2, cache_locations=cache_dir) + nn2.inputs.a = 3 nn2() # checking the results @@ -656,10 +667,12 @@ def test_task_nostate_cachelocations_nosubmitter_forcererun(tmpdir): cache_dir = tmpdir.mkdir("test_task_nostate") cache_dir2 = tmpdir.mkdir("test_task_nostate2") - nn = fun_addtwo(name="NA", a=3, cache_dir=cache_dir) + nn = fun_addtwo(name="NA", cache_dir=cache_dir) + nn.inputs.a = 3 nn() - nn2 = fun_addtwo(name="NA", a=3, cache_dir=cache_dir2, cache_locations=cache_dir) + nn2 = fun_addtwo(name="NA", cache_dir=cache_dir2, cache_locations=cache_dir) + nn2.inputs.a = 3 nn2(rerun=True) # checking the results @@ -682,11 +695,13 @@ def test_task_nostate_cachelocations_updated(plugin, tmpdir): cache_dir1 = tmpdir.mkdir("test_task_nostate1") cache_dir2 = tmpdir.mkdir("test_task_nostate2") - nn = fun_addtwo(name="NA", a=3, cache_dir=cache_dir) + nn = fun_addtwo(name="NA", cache_dir=cache_dir) + nn.inputs.a = 3 with Submitter(plugin=plugin) as sub: sub(nn) - nn2 = fun_addtwo(name="NA", a=3, cache_dir=cache_dir2, cache_locations=cache_dir) + nn2 = fun_addtwo(name="NA", cache_dir=cache_dir2, cache_locations=cache_dir) + nn2.inputs.a = 3 # updating cache location to non-existing dir with Submitter(plugin=plugin) as sub: sub(nn2, cache_locations=cache_dir1) @@ -881,7 +896,9 @@ def test_task_state_3(plugin): def test_task_state_4(plugin): """ task with a list as an input, and a simple splitter """ - nn = moment(name="NA", n=3, lst=[[2, 3, 4], [1, 2, 3]]).split(splitter="lst") + nn = moment(name="NA", inputs={"n": 3, "lst": [[2, 3, 4], [1, 2, 3]]}).split( + splitter="lst" + ) assert np.allclose(nn.inputs.n, 3) assert np.allclose(nn.inputs.lst, [[2, 3, 4], [1, 2, 3]]) assert nn.state.splitter == "NA.lst" @@ -901,7 +918,9 @@ def test_task_state_4(plugin): def test_task_state_4a(plugin): """ task with a tuple as an input, and a simple splitter """ - nn = moment(name="NA", n=3, lst=[(2, 3, 4), (1, 2, 3)]).split(splitter="lst") + nn = moment(name="NA", inputs={"n": 3, "lst": [(2, 3, 4), (1, 2, 3)]}).split( + splitter="lst" + ) assert np.allclose(nn.inputs.n, 3) assert np.allclose(nn.inputs.lst, [[2, 3, 4], [1, 2, 3]]) assert nn.state.splitter == "NA.lst" @@ -921,7 +940,7 @@ def test_task_state_4a(plugin): def test_task_state_5(plugin): """ task with a list as an input, and the variable is part of the scalar splitter""" - nn = moment(name="NA", n=[1, 3], lst=[[2, 3, 4], [1, 2, 3]]).split( + nn = moment(name="NA", inputs={"n": [1, 3], "lst": [[2, 3, 4], [1, 2, 3]]}).split( splitter=("n", "lst") ) assert np.allclose(nn.inputs.n, [1, 3]) @@ -945,9 +964,9 @@ def test_task_state_5_exception(plugin): """ task with a list as an input, and the variable is part of the scalar splitter the shapes are not matching, so exception should be raised """ - nn = moment(name="NA", n=[1, 3, 3], lst=[[2, 3, 4], [1, 2, 3]]).split( - splitter=("n", "lst") - ) + nn = moment( + name="NA", inputs={"n": [1, 3, 3], "lst": [[2, 3, 4], [1, 2, 3]]} + ).split(splitter=("n", "lst")) assert np.allclose(nn.inputs.n, [1, 3, 3]) assert np.allclose(nn.inputs.lst, [[2, 3, 4], [1, 2, 3]]) assert nn.state.splitter == ("NA.n", "NA.lst") @@ -960,7 +979,7 @@ def test_task_state_5_exception(plugin): def test_task_state_6(plugin): """ ask with a list as an input, and the variable is part of the outer splitter """ - nn = moment(name="NA", n=[1, 3], lst=[[2, 3, 4], [1, 2, 3]]).split( + nn = moment(name="NA", inputs={"n": [1, 3], "lst": [[2, 3, 4], [1, 2, 3]]}).split( splitter=["n", "lst"] ) assert np.allclose(nn.inputs.n, [1, 3]) @@ -982,7 +1001,7 @@ def test_task_state_6(plugin): def test_task_state_6a(plugin): """ ask with a tuple as an input, and the variable is part of the outer splitter """ - nn = moment(name="NA", n=[1, 3], lst=[(2, 3, 4), (1, 2, 3)]).split( + nn = moment(name="NA", inputs={"n": [1, 3], "lst": [(2, 3, 4), (1, 2, 3)]}).split( splitter=["n", "lst"] ) assert np.allclose(nn.inputs.n, [1, 3]) @@ -1347,7 +1366,9 @@ def test_task_state_cachelocations_forcererun(plugin, tmpdir): cache_dir = tmpdir.mkdir("test_task_nostate") cache_dir2 = tmpdir.mkdir("test_task_nostate2") - nn = fun_addtwo(name="NA", a=3, cache_dir=cache_dir).split(splitter="a", a=[3, 5]) + nn = fun_addtwo(name="NA", inputs={"a": 3}, cache_dir=cache_dir).split( + splitter="a", a=[3, 5] + ) with Submitter(plugin=plugin) as sub: sub(nn) diff --git a/pydra/engine/tests/test_numpy_examples.py b/pydra/engine/tests/test_numpy_examples.py index 55884ac257..d4bca0908f 100644 --- a/pydra/engine/tests/test_numpy_examples.py +++ b/pydra/engine/tests/test_numpy_examples.py @@ -19,8 +19,8 @@ def arrayout(val): def test_multiout(plugin): """ testing a simple function that returns a numpy array""" - wf = Workflow("wf", input_spec=["val"], val=[0, 1, 2]) - wf.add(arrayout(name="mo", val=wf.lzin.val)) + wf = Workflow("wf", input_spec=["val"], inputs={"val": [0, 1, 2]}) + wf.add(arrayout(name="mo", inputs={"val": wf.lzin.val})) wf.mo.split("val").combine("val") wf.set_output([("array", wf.mo.lzout.b)]) diff --git a/pydra/engine/tests/test_shelltask.py b/pydra/engine/tests/test_shelltask.py index 0f467399e7..30cab0f551 100644 --- a/pydra/engine/tests/test_shelltask.py +++ b/pydra/engine/tests/test_shelltask.py @@ -280,7 +280,7 @@ def test_shell_cmd_inputspec_1(plugin, results_function): name="shelly", executable=cmd_exec, args=cmd_args, - opt_n=cmd_opt, + inputs={"opt_n": cmd_opt}, input_spec=my_input_spec, ) assert shelly.inputs.executable == cmd_exec @@ -324,8 +324,7 @@ def test_shell_cmd_inputspec_2(plugin, results_function): name="shelly", executable=cmd_exec, args=cmd_args, - opt_n=cmd_opt, - opt_hello=cmd_opt_hello, + inputs={"opt_n": cmd_opt, "opt_hello": cmd_opt_hello}, input_spec=my_input_spec, ) assert shelly.inputs.executable == cmd_exec @@ -356,7 +355,10 @@ def test_shell_cmd_inputspec_3(plugin, results_function): # separate command into exec + args shelly = ShellCommandTask( - name="shelly", executable=cmd_exec, text=hello, input_spec=my_input_spec + name="shelly", + executable=cmd_exec, + inputs={"text": hello}, + input_spec=my_input_spec, ) assert shelly.inputs.executable == cmd_exec assert shelly.cmdline == "echo HELLO" @@ -381,8 +383,9 @@ def test_shell_cmd_inputspec_3a(plugin, results_function): # separate command into exec + args shelly = ShellCommandTask( - name="shelly", executable=cmd_exec, text=hello, input_spec=my_input_spec + name="shelly", executable=cmd_exec, input_spec=my_input_spec ) + shelly.inputs.text = hello assert shelly.inputs.executable == cmd_exec assert shelly.cmdline == "echo HELLO" res = results_function(shelly, plugin) @@ -659,7 +662,10 @@ def test_shell_cmd_inputspec_5_nosubm(plugin, results_function): # separate command into exec + args shelly = ShellCommandTask( - name="shelly", executable=cmd_exec, opt_t=cmd_t, input_spec=my_input_spec + name="shelly", + executable=cmd_exec, + inputs={"opt_t": cmd_t}, + input_spec=my_input_spec, ) assert shelly.inputs.executable == cmd_exec assert shelly.cmdline == "ls -t" @@ -705,8 +711,7 @@ def test_shell_cmd_inputspec_5a_exception(plugin): shelly = ShellCommandTask( name="shelly", executable=cmd_exec, - opt_t=cmd_t, - opt_S=cmd_S, + inputs={"opt_t": cmd_t, "opt_S": cmd_S}, input_spec=my_input_spec, ) with pytest.raises(Exception) as excinfo: @@ -752,8 +757,7 @@ def test_shell_cmd_inputspec_6(plugin, results_function): shelly = ShellCommandTask( name="shelly", executable=cmd_exec, - opt_t=cmd_t, - opt_l=cmd_l, + inputs={"opt_t": cmd_t, "opt_l": cmd_l}, input_spec=my_input_spec, ) assert shelly.inputs.executable == cmd_exec @@ -794,8 +798,9 @@ def test_shell_cmd_inputspec_6a_exception(plugin): ) shelly = ShellCommandTask( - name="shelly", executable=cmd_exec, opt_t=cmd_t, input_spec=my_input_spec + name="shelly", executable=cmd_exec, input_spec=my_input_spec ) + shelly.inputs.opt_t = cmd_t with pytest.raises(Exception) as excinfo: shelly() assert "requires" in str(excinfo.value) @@ -837,13 +842,10 @@ def test_shell_cmd_inputspec_6b(plugin, results_function): # separate command into exec + args shelly = ShellCommandTask( - name="shelly", - executable=cmd_exec, - opt_t=cmd_t, - # opt_l=cmd_l, - input_spec=my_input_spec, + name="shelly", executable=cmd_exec, input_spec=my_input_spec ) shelly.inputs.opt_l = cmd_l + shelly.inputs.opt_t = cmd_t assert shelly.inputs.executable == cmd_exec assert shelly.cmdline == "ls -l -t" res = results_function(shelly, plugin) @@ -954,8 +956,9 @@ def test_shell_cmd_inputspec_8(plugin, results_function, tmpdir): ) shelly = ShellCommandTask( - name="shelly", executable=cmd_exec, files=files_list, input_spec=my_input_spec + name="shelly", executable=cmd_exec, input_spec=my_input_spec ) + shelly.inputs.files = files_list assert shelly.inputs.executable == cmd_exec res = results_function(shelly, plugin) @@ -1003,10 +1006,8 @@ def test_shell_cmd_inputspec_copyfile_1(plugin, results_function, tmpdir): bases=(ShellSpec,), ) - shelly = ShellCommandTask( - name="shelly", executable=cmd, input_spec=my_input_spec, orig_file=str(file) - ) - + shelly = ShellCommandTask(name="shelly", executable=cmd, input_spec=my_input_spec) + shelly.inputs.orig_file = str(file) res = results_function(shelly, plugin) assert res.output.stdout == "" assert res.output.out_file.exists() @@ -1060,10 +1061,8 @@ def test_shell_cmd_inputspec_copyfile_1a(plugin, results_function, tmpdir): bases=(ShellSpec,), ) - shelly = ShellCommandTask( - name="shelly", executable=cmd, input_spec=my_input_spec, orig_file=str(file) - ) - + shelly = ShellCommandTask(name="shelly", executable=cmd, input_spec=my_input_spec) + shelly.inputs.orig_file = str(file) res = results_function(shelly, plugin) assert res.output.stdout == "" assert res.output.out_file.exists() @@ -1131,10 +1130,8 @@ def test_shell_cmd_inputspec_copyfile_1b(plugin, results_function, tmpdir): bases=(ShellSpec,), ) - shelly = ShellCommandTask( - name="shelly", executable=cmd, input_spec=my_input_spec, orig_file=str(file) - ) - + shelly = ShellCommandTask(name="shelly", executable=cmd, input_spec=my_input_spec) + shelly.inputs.orig_file = str(file) res = results_function(shelly, plugin) assert res.output.stdout == "" assert res.output.out_file.exists() @@ -1165,7 +1162,10 @@ def test_shell_cmd_inputspec_state_1(plugin, results_function): # separate command into exec + args shelly = ShellCommandTask( - name="shelly", executable=cmd_exec, text=hello, input_spec=my_input_spec + name="shelly", + executable=cmd_exec, + inputs={"text": hello}, + input_spec=my_input_spec, ).split("text") assert shelly.inputs.executable == cmd_exec # todo: this doesn't work when state @@ -1192,7 +1192,10 @@ def test_shell_cmd_inputspec_state_1a(plugin, results_function): # separate command into exec + args shelly = ShellCommandTask( - name="shelly", executable=cmd_exec, text=hello, input_spec=my_input_spec + name="shelly", + executable=cmd_exec, + inputs={"text": hello}, + input_spec=my_input_spec, ).split("text") assert shelly.inputs.executable == cmd_exec @@ -1265,9 +1268,9 @@ def test_shell_cmd_inputspec_state_3(plugin, results_function, tmpdir): ) shelly = ShellCommandTask( - name="shelly", executable=cmd_exec, file=files, input_spec=my_input_spec + name="shelly", executable=cmd_exec, input_spec=my_input_spec ).split("file") - + shelly.inputs.file = files assert shelly.inputs.executable == cmd_exec # todo: this doesn't work when state # assert shelly.cmdline == "echo HELLO" @@ -1321,8 +1324,9 @@ def test_shell_cmd_inputspec_copyfile_state_1(plugin, results_function, tmpdir): ) shelly = ShellCommandTask( - name="shelly", executable=cmd, input_spec=my_input_spec, orig_file=files + name="shelly", executable=cmd, input_spec=my_input_spec ).split("orig_file") + shelly.inputs.orig_file = files txt_l = ["from pydra", "world"] res_l = results_function(shelly, plugin) @@ -1497,7 +1501,7 @@ def test_wf_shell_cmd_3(plugin): name="shelly2", input_spec=my_input_spec2, executable=wf.lzin.cmd2, - orig_file=wf.shelly1.lzout.file, + inputs={"orig_file": wf.shelly1.lzout.file}, ) ) @@ -1585,7 +1589,7 @@ def test_wf_shell_cmd_3a(plugin): name="shelly2", input_spec=my_input_spec2, executable=wf.lzin.cmd2, - orig_file=wf.shelly1.lzout.file, + inputs={"orig_file": wf.shelly1.lzout.file}, ) ) @@ -1673,7 +1677,7 @@ def test_wf_shell_cmd_state_1(plugin): name="shelly2", input_spec=my_input_spec2, executable=wf.lzin.cmd2, - orig_file=wf.shelly1.lzout.file, + inputs={"orig_file": wf.shelly1.lzout.file}, ) ) @@ -1762,7 +1766,7 @@ def test_wf_shell_cmd_ndst_1(plugin): name="shelly2", input_spec=my_input_spec2, executable=wf.lzin.cmd2, - orig_file=wf.shelly1.lzout.file, + inputs={"orig_file": wf.shelly1.lzout.file}, ) ) @@ -2271,8 +2275,9 @@ def change_name(file): # separate command into exec + args shelly = ShellCommandTask( - name="bet_task", executable="bet", in_file=in_file, input_spec=bet_input_spec + name="bet_task", executable="bet", input_spec=bet_input_spec ) + shelly.inputs.in_file = in_file assert shelly.inputs.executable == "bet" assert shelly.cmdline == f"bet {in_file} {in_file}_brain" # res = shelly(plugin="cf") diff --git a/pydra/engine/tests/test_singularity.py b/pydra/engine/tests/test_singularity.py index 3de0925eec..f3ed24254b 100644 --- a/pydra/engine/tests/test_singularity.py +++ b/pydra/engine/tests/test_singularity.py @@ -407,7 +407,7 @@ def test_singularity_inputspec_1(plugin, tmpdir): name="singu", image=image, executable=cmd, - file=filename, + inputs={"file": filename}, input_spec=my_input_spec, strip=True, cache_dir=tmpdir, @@ -496,7 +496,7 @@ def test_singularity_inputspec_2(plugin, tmpdir): name="singu", image=image, executable=cmd, - file1=filename_1, + inputs={"file1": filename_1}, input_spec=my_input_spec, strip=True, cache_dir=tmpdir, @@ -547,7 +547,7 @@ def test_singularity_inputspec_2a_except(plugin, tmpdir): name="singu", image=image, executable=cmd, - file2=filename_2, + inputs={"file2": filename_2}, input_spec=my_input_spec, strip=True, cache_dir=tmpdir, @@ -598,7 +598,7 @@ def test_singularity_inputspec_2a(plugin, tmpdir): name="singu", image=image, executable=cmd, - file2=filename_2, + inputs={"file2": filename_2}, input_spec=my_input_spec, strip=True, cache_dir=tmpdir, @@ -655,7 +655,7 @@ def test_singularity_cmd_inputspec_copyfile_1(plugin, tmpdir): image=image, executable=cmd, input_spec=my_input_spec, - orig_file=str(file), + inputs={"orig_file": str(file)}, cache_dir=tmpdir, ) @@ -709,7 +709,7 @@ def test_singularity_inputspec_state_1(plugin, tmpdir): name="singu", image=image, executable=cmd, - file=filename, + inputs={"file": filename}, input_spec=my_input_spec, strip=True, cache_dir=tmpdir, @@ -759,7 +759,7 @@ def test_singularity_inputspec_state_1b(plugin, tmpdir): name="singu", image=image, executable=cmd, - file=filename, + inputs={"file": filename}, input_spec=my_input_spec, strip=True, cache_dir=tmpdir, @@ -806,7 +806,7 @@ def test_singularity_wf_inputspec_1(plugin, tmpdir): name="singu", image=image, executable=wf.lzin.cmd, - file=wf.lzin.file, + inputs={"file": wf.lzin.file}, input_spec=my_input_spec, strip=True, ) @@ -861,7 +861,7 @@ def test_singularity_wf_state_inputspec_1(plugin, tmpdir): name="singu", image=image, executable=wf.lzin.cmd, - file=wf.lzin.file, + inputs={"file": wf.lzin.file}, input_spec=my_input_spec, strip=True, ) @@ -918,7 +918,7 @@ def test_singularity_wf_ndst_inputspec_1(plugin, tmpdir): name="singu", image=image, executable=wf.lzin.cmd, - file=wf.lzin.file, + inputs={"file": wf.lzin.file}, input_spec=my_input_spec, strip=True, ).split("file") diff --git a/pydra/engine/tests/test_submitter.py b/pydra/engine/tests/test_submitter.py index 2dbda71c21..a9943a8e5d 100644 --- a/pydra/engine/tests/test_submitter.py +++ b/pydra/engine/tests/test_submitter.py @@ -42,10 +42,10 @@ def test_concurrent_wf(plugin): wf = Workflow("new_wf", input_spec=["x", "y"]) wf.inputs.x = 5 wf.inputs.y = 10 - wf.add(sleep_add_one(name="taska", x=wf.lzin.x)) - wf.add(sleep_add_one(name="taskb", x=wf.lzin.y)) - wf.add(sleep_add_one(name="taskc", x=wf.taska.lzout.out)) - wf.add(sleep_add_one(name="taskd", x=wf.taskb.lzout.out)) + wf.add(sleep_add_one(name="taska", inputs={"x": wf.lzin.x})) + wf.add(sleep_add_one(name="taskb", inputs={"x": wf.lzin.y})) + wf.add(sleep_add_one(name="taskc", inputs={"x": wf.taska.lzout.out})) + wf.add(sleep_add_one(name="taskd", inputs={"x": wf.taskb.lzout.out})) wf.set_output([("out1", wf.taskc.lzout.out), ("out2", wf.taskd.lzout.out)]) with Submitter(plugin) as sub: sub(wf) @@ -63,10 +63,10 @@ def test_concurrent_wf_nprocs(): wf = Workflow("new_wf", input_spec=["x", "y"]) wf.inputs.x = 5 wf.inputs.y = 10 - wf.add(sleep_add_one(name="taska", x=wf.lzin.x)) - wf.add(sleep_add_one(name="taskb", x=wf.lzin.y)) - wf.add(sleep_add_one(name="taskc", x=wf.taska.lzout.out)) - wf.add(sleep_add_one(name="taskd", x=wf.taskb.lzout.out)) + wf.add(sleep_add_one(name="taska", inputs={"x": wf.lzin.x})) + wf.add(sleep_add_one(name="taskb", inputs={"x": wf.lzin.y})) + wf.add(sleep_add_one(name="taskc", inputs={"x": wf.taska.lzout.out})) + wf.add(sleep_add_one(name="taskd", inputs={"x": wf.taskb.lzout.out})) wf.set_output([("out1", wf.taskc.lzout.out), ("out2", wf.taskd.lzout.out)]) # wf.plugin = 'cf' # res = wf.run() @@ -82,18 +82,18 @@ def test_wf_in_wf(plugin): """WF(A --> SUBWF(A --> B) --> B)""" wf = Workflow(name="wf_in_wf", input_spec=["x"]) wf.inputs.x = 3 - wf.add(sleep_add_one(name="wf_a", x=wf.lzin.x)) + wf.add(sleep_add_one(name="wf_a", inputs={"x": wf.lzin.x})) # workflow task subwf = Workflow(name="sub_wf", input_spec=["x"]) - subwf.add(sleep_add_one(name="sub_a", x=subwf.lzin.x)) - subwf.add(sleep_add_one(name="sub_b", x=subwf.sub_a.lzout.out)) + subwf.add(sleep_add_one(name="sub_a", inputs={"x": subwf.lzin.x})) + subwf.add(sleep_add_one(name="sub_b", inputs={"x": subwf.sub_a.lzout.out})) subwf.set_output([("out", subwf.sub_b.lzout.out)]) # connect, then add subwf.inputs.x = wf.wf_a.lzout.out wf.add(subwf) - wf.add(sleep_add_one(name="wf_b", x=wf.sub_wf.lzout.out)) + wf.add(sleep_add_one(name="wf_b", inputs={"x": wf.sub_wf.lzout.out})) wf.set_output([("out", wf.wf_b.lzout.out)]) with Submitter(plugin) as sub: @@ -109,7 +109,7 @@ def test_wf2(plugin_dask_opt): workflow-node with one task and no splitter """ wfnd = Workflow(name="wfnd", input_spec=["x"]) - wfnd.add(sleep_add_one(name="add2", x=wfnd.lzin.x)) + wfnd.add(sleep_add_one(name="add2", inputs={"x": wfnd.lzin.x})) wfnd.set_output([("out", wfnd.add2.lzout.out)]) wfnd.inputs.x = 2 @@ -127,8 +127,8 @@ def test_wf2(plugin_dask_opt): @pytest.mark.flaky(reruns=2) # when dask def test_wf_with_state(plugin_dask_opt): wf = Workflow(name="wf_with_state", input_spec=["x"]) - wf.add(sleep_add_one(name="taska", x=wf.lzin.x)) - wf.add(sleep_add_one(name="taskb", x=wf.taska.lzout.out)) + wf.add(sleep_add_one(name="taska", inputs={"x": wf.lzin.x})) + wf.add(sleep_add_one(name="taskb", inputs={"x": wf.taska.lzout.out})) wf.inputs.x = [1, 2, 3] wf.split("x") @@ -201,10 +201,10 @@ def test_slurm_max_jobs(tmpdir): wf = Workflow("new_wf", input_spec=["x", "y"], cache_dir=tmpdir) wf.inputs.x = 5 wf.inputs.y = 10 - wf.add(sleep_add_one(name="taska", x=wf.lzin.x)) - wf.add(sleep_add_one(name="taskb", x=wf.lzin.y)) - wf.add(sleep_add_one(name="taskc", x=wf.taska.lzout.out)) - wf.add(sleep_add_one(name="taskd", x=wf.taskb.lzout.out)) + wf.add(sleep_add_one(name="taska", inputs={"x": wf.lzin.x})) + wf.add(sleep_add_one(name="taskb", inputs={"x": wf.lzin.y})) + wf.add(sleep_add_one(name="taskc", inputs={"x": wf.taska.lzout.out})) + wf.add(sleep_add_one(name="taskd", inputs={"x": wf.taskb.lzout.out})) wf.set_output([("out1", wf.taskc.lzout.out), ("out2", wf.taskd.lzout.out)]) with Submitter("slurm", max_jobs=1) as sub: sub(wf) diff --git a/pydra/engine/tests/test_task.py b/pydra/engine/tests/test_task.py index 642d92d22e..76506a8cf4 100644 --- a/pydra/engine/tests/test_task.py +++ b/pydra/engine/tests/test_task.py @@ -21,7 +21,7 @@ def funaddtwo(a): def test_output(): - nn = funaddtwo(a=3) + nn = funaddtwo(inputs={"a": 3}) res = nn._run() assert res.output.out == 5 @@ -29,10 +29,10 @@ def test_output(): def test_name_conflict(): """ raise error if task name conflicts with a class attribute or method""" with pytest.raises(ValueError) as excinfo1: - nn = funaddtwo(name="split", a=3) + nn = funaddtwo(name="split") assert "Cannot use names of attributes or methods" in str(excinfo1.value) with pytest.raises(ValueError) as excinfo2: - nn = funaddtwo(name="checksum", a=3) + nn = funaddtwo(name="checksum") assert "Cannot use names of attributes or methods" in str(excinfo2.value) @@ -49,7 +49,7 @@ def test_numpy(): @pytest.mark.xfail(reason="cp.dumps(func) depends on the system/setup, TODO!!") def test_checksum(): - nn = funaddtwo(a=3) + nn = funaddtwo(inputs={"a": 3}) assert ( nn.checksum == "FunctionTask_abb4e7cc03b13d0e73884b87d142ed5deae6a312275187a9d8df54407317d7d3" @@ -63,7 +63,7 @@ def testfunc( ) -> ty.NamedTuple("Output", [("out_out", float)]): return a + b - funky = testfunc(a=1) + funky = testfunc(inputs={"a": 1}) assert hasattr(funky.inputs, "a") assert hasattr(funky.inputs, "b") assert hasattr(funky.inputs, "_func") @@ -111,7 +111,7 @@ def testfunc( return math.modf(a) - funky = testfunc(a=3.5) + funky = testfunc(inputs={"a": 3.5}) assert hasattr(funky.inputs, "a") assert hasattr(funky.inputs, "_func") assert getattr(funky.inputs, "a") == 3.5 @@ -154,7 +154,7 @@ def testfunc( return math.modf(a) - funky = testfunc(a=3.5) + funky = testfunc(inputs={"a": 3.5}) with pytest.raises(Exception) as excinfo: funky() assert "expected 3 elements" in str(excinfo.value) @@ -165,7 +165,7 @@ def test_halfannotated_func(): def testfunc(a, b) -> int: return a + b - funky = testfunc(a=10, b=20) + funky = testfunc(inputs={"a": 10, "b": 20}) assert hasattr(funky.inputs, "a") assert hasattr(funky.inputs, "b") assert hasattr(funky.inputs, "_func") @@ -206,7 +206,7 @@ def test_halfannotated_func_multreturn(): def testfunc(a, b) -> (int, int): return a + 1, b + 1 - funky = testfunc(a=10, b=20) + funky = testfunc(inputs={"a": 10, "b": 20}) assert hasattr(funky.inputs, "a") assert hasattr(funky.inputs, "b") assert hasattr(funky.inputs, "_func") @@ -248,7 +248,7 @@ def test_notannotated_func(): def no_annots(c, d): return c + d - natask = no_annots(c=17, d=3.2) + natask = no_annots(inputs={"c": 17, "d": 3.2}) assert hasattr(natask.inputs, "c") assert hasattr(natask.inputs, "d") assert hasattr(natask.inputs, "_func") @@ -264,7 +264,7 @@ def test_notannotated_func_returnlist(): def no_annots(c, d): return [c, d] - natask = no_annots(c=17, d=3.2) + natask = no_annots(inputs={"c": 17, "d": 3.2}) result = natask._run() assert hasattr(result.output, "out") assert result.output.out == [17, 3.2] @@ -275,7 +275,7 @@ def test_halfannotated_func_multrun_returnlist(): def no_annots(c, d) -> (list, float): return [c, d], c + d - natask = no_annots(c=17, d=3.2) + natask = no_annots(inputs={"c": 17, "d": 3.2}) result = natask._run() assert hasattr(result.output, "out1") @@ -293,7 +293,7 @@ def test_notannotated_func_multreturn(): def no_annots(c, d): return c + d, c - d - natask = no_annots(c=17, d=3.2) + natask = no_annots(inputs={"c": 17, "d": 3.2}) assert hasattr(natask.inputs, "c") assert hasattr(natask.inputs, "d") assert hasattr(natask.inputs, "_func") @@ -309,7 +309,7 @@ def test_exception_func(): def raise_exception(c, d): raise Exception() - bad_funk = raise_exception(c=17, d=3.2) + bad_funk = raise_exception(inputs={"c": 17, "d": 3.2}) assert pytest.raises(Exception, bad_funk) @@ -320,7 +320,7 @@ def test_result_none_1(): def fun_none(x): return None - task = fun_none(name="none", x=3) + task = fun_none(name="none", inputs={"x": 3}) res = task() assert res.output.out is None @@ -332,7 +332,7 @@ def test_result_none_2(): def fun_none(x) -> (ty.Any, ty.Any): return None - task = fun_none(name="none", x=3) + task = fun_none(name="none", inputs={"x": 3}) res = task() assert res.output.out1 is None assert res.output.out2 is None @@ -344,12 +344,16 @@ def testfunc(a: int, b: float = 0.1) -> ty.NamedTuple("Output", [("out", float)] return a + b # printing the audit message - funky = testfunc(a=1, audit_flags=AuditFlag.PROV, messengers=PrintMessenger()) + funky = testfunc( + inputs={"a": 1}, audit_flags=AuditFlag.PROV, messengers=PrintMessenger() + ) funky.cache_dir = tmpdir funky() # saving the audit message into the file - funky = testfunc(a=2, audit_flags=AuditFlag.PROV, messengers=FileMessenger()) + funky = testfunc( + inputs={"a": 2}, audit_flags=AuditFlag.PROV, messengers=FileMessenger() + ) message_path = tmpdir / funky.checksum / "messages" funky.cache_dir = tmpdir funky.messenger_args = dict(message_dir=message_path) @@ -364,7 +368,9 @@ def test_audit_all(tmpdir): def testfunc(a: int, b: float = 0.1) -> ty.NamedTuple("Output", [("out", float)]): return a + b - funky = testfunc(a=2, audit_flags=AuditFlag.ALL, messengers=FileMessenger()) + funky = testfunc( + inputs={"a": 2}, audit_flags=AuditFlag.ALL, messengers=FileMessenger() + ) message_path = tmpdir / funky.checksum / "messages" funky.cache_dir = tmpdir funky.messenger_args = dict(message_dir=message_path) @@ -450,18 +456,18 @@ def test_singularity_cmd(tmpdir): def test_functask_callable(tmpdir): # no submitter or plugin - foo = funaddtwo(a=1) + foo = funaddtwo(inputs={"a": 1}) res = foo() assert res.output.out == 3 assert foo.plugin is None # plugin - bar = funaddtwo(a=2) + bar = funaddtwo(inputs={"a": 2}) res = bar(plugin="cf") assert res.output.out == 4 assert bar.plugin is None - foo2 = funaddtwo(a=3) + foo2 = funaddtwo(inputs={"a": 3}) foo2.plugin = "cf" res = foo2() assert res.output.out == 5 @@ -469,7 +475,7 @@ def test_functask_callable(tmpdir): def test_taskhooks(tmpdir, capsys): - foo = funaddtwo(name="foo", a=1, cache_dir=tmpdir) + foo = funaddtwo(name="foo", inputs={"a": 1}, cache_dir=tmpdir) assert foo.hooks # ensure all hooks are defined for attr in ("pre_run", "post_run", "pre_run_task", "post_run_task"): @@ -500,7 +506,7 @@ def myhook(task, *args): del captured # hooks are independent across tasks by default - bar = funaddtwo(name="bar", a=3, cache_dir=tmpdir) + bar = funaddtwo(name="bar", inputs={"a": 3}, cache_dir=tmpdir) assert bar.hooks is not foo.hooks # but can be shared across tasks bar.hooks = foo.hooks diff --git a/pydra/engine/tests/test_tasks_files.py b/pydra/engine/tests/test_tasks_files.py index 6b5fd14fc6..7ab7c1b9bf 100644 --- a/pydra/engine/tests/test_tasks_files.py +++ b/pydra/engine/tests/test_tasks_files.py @@ -59,7 +59,7 @@ def test_task_1(tmpdir): # creating abs path file = os.path.join(os.getcwd(), "arr1.npy") np.save(file, arr) - nn = file_add2(name="add2", file=file) + nn = file_add2(name="add2", inputs={"file": file}) with Submitter(plugin="cf") as sub: sub(nn) @@ -73,8 +73,8 @@ def test_task_1(tmpdir): def test_wf_1(tmpdir): """ workflow with 2 tasks that take file as an input and give file as an aoutput""" wf = Workflow(name="wf_1", input_spec=["file_orig"]) - wf.add(file_add2(name="add2", file=wf.lzin.file_orig)) - wf.add(file_mult(name="mult", file=wf.add2.lzout.out)) + wf.add(file_add2(name="add2", inputs={"file": wf.lzin.file_orig})) + wf.add(file_mult(name="mult", inputs={"file": wf.add2.lzout.out})) wf.set_output([("out", wf.mult.lzout.out)]) os.chdir(tmpdir) @@ -102,7 +102,7 @@ def test_file_annotation_1(tmpdir): # creating abs path file = os.path.join(os.getcwd(), "arr1.npy") np.save(file, arr) - nn = file_add2_annot(name="add2", file=file) + nn = file_add2_annot(name="add2", inputs={"file": file}) with Submitter(plugin="cf") as sub: sub(nn) diff --git a/pydra/engine/tests/test_workflow.py b/pydra/engine/tests/test_workflow.py index a77f787fdb..d02243d5ad 100644 --- a/pydra/engine/tests/test_workflow.py +++ b/pydra/engine/tests/test_workflow.py @@ -42,14 +42,14 @@ def test_wf_name_conflict2(): wf = Workflow(name="wf_1", input_spec=["x"]) wf.add(add2(name="task_name", x=wf.lzin.x)) with pytest.raises(ValueError) as excinfo: - wf.add(identity(name="task_name", x=3)) + wf.add(identity(name="task_name")) assert "Another task named task_name is already added" in str(excinfo.value) def test_wf_no_output(plugin): """ Raise error when output isn't set with set_output""" wf = Workflow(name="wf_1", input_spec=["x"]) - wf.add(add2(name="add2", x=wf.lzin.x)) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x})) wf.inputs.x = 2 with pytest.raises(ValueError) as excinfo: @@ -61,7 +61,7 @@ def test_wf_no_output(plugin): def test_wf_1(plugin): """ workflow with one task and no splitter""" wf = Workflow(name="wf_1", input_spec=["x"]) - wf.add(add2(name="add2", x=wf.lzin.x)) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x})) wf.set_output([("out", wf.add2.lzout.out)]) wf.inputs.x = 2 @@ -80,7 +80,7 @@ def test_wf_1a_outpastuple(plugin): set_output takes a tuple """ wf = Workflow(name="wf_1", input_spec=["x"]) - wf.add(add2(name="add2", x=wf.lzin.x)) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x})) wf.set_output(("out", wf.add2.lzout.out)) wf.inputs.x = 2 wf.plugin = plugin @@ -96,7 +96,7 @@ def test_wf_1a_outpastuple(plugin): def test_wf_1_call_subm(plugin): """using wf.__call_ with submitter""" wf = Workflow(name="wf_1", input_spec=["x"]) - wf.add(add2(name="add2", x=wf.lzin.x)) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x})) wf.set_output([("out", wf.add2.lzout.out)]) wf.inputs.x = 2 @@ -111,7 +111,7 @@ def test_wf_1_call_subm(plugin): def test_wf_1_call_plug(plugin): """using wf.__call_ with plugin""" wf = Workflow(name="wf_1", input_spec=["x"]) - wf.add(add2(name="add2", x=wf.lzin.x)) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x})) wf.set_output([("out", wf.add2.lzout.out)]) wf.inputs.x = 2 wf.plugin = plugin @@ -126,7 +126,7 @@ def test_wf_1_call_plug(plugin): def test_wf_1_call_exception(plugin): """using wf.__call_ with plugin and submitter - should raise an exception""" wf = Workflow(name="wf_1", input_spec=["x"]) - wf.add(add2(name="add2", x=wf.lzin.x)) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x})) wf.set_output([("out", wf.add2.lzout.out)]) wf.inputs.x = 2 wf.plugin = plugin @@ -140,8 +140,8 @@ def test_wf_1_call_exception(plugin): def test_wf_2(plugin): """ workflow with 2 tasks, no splitter""" wf = Workflow(name="wf_2", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) - wf.add(add2(name="add2", x=wf.mult.lzout.out)) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) + wf.add(add2(name="add2", inputs={"x": wf.mult.lzout.out})) wf.set_output([("out", wf.add2.lzout.out)]) wf.inputs.x = 2 wf.inputs.y = 3 @@ -160,7 +160,7 @@ def test_wf_2a(plugin): creating add2_task first (before calling add method), """ wf = Workflow(name="wf_2", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) add2_task = add2(name="add2") add2_task.inputs.x = wf.mult.lzout.out wf.add(add2_task) @@ -183,7 +183,7 @@ def test_wf_2b(plugin): adding inputs.x after add method """ wf = Workflow(name="wf_2", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) add2_task = add2(name="add2") wf.add(add2_task) add2_task.inputs.x = wf.mult.lzout.out @@ -206,7 +206,7 @@ def test_wf_2c_multoutp(plugin): setting multiple outputs for the workflow """ wf = Workflow(name="wf_2", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) add2_task = add2(name="add2") add2_task.inputs.x = wf.mult.lzout.out wf.add(add2_task) @@ -231,7 +231,7 @@ def test_wf_2d_outpasdict(plugin): setting multiple outputs using a dictionary """ wf = Workflow(name="wf_2", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) add2_task = add2(name="add2") add2_task.inputs.x = wf.mult.lzout.out wf.add(add2_task) @@ -255,8 +255,8 @@ def test_wf_2d_outpasdict(plugin): def test_wf_3(plugin_dask_opt): """ testing None value for an input""" wf = Workflow(name="wf_3", input_spec=["x", "y"]) - wf.add(fun_addvar_none(name="addvar", a=wf.lzin.x, b=wf.lzin.y)) - wf.add(add2(name="add2", x=wf.addvar.lzout.out)) + wf.add(fun_addvar_none(name="addvar", inputs={"a": wf.lzin.x, "b": wf.lzin.y})) + wf.add(add2(name="add2", inputs={"x": wf.addvar.lzout.out})) wf.set_output([("out", wf.add2.lzout.out)]) wf.inputs.x = 2 wf.inputs.y = None @@ -275,8 +275,8 @@ def test_wf_3a_exception(plugin): and the function should raise an exception """ wf = Workflow(name="wf_3", input_spec=["x", "y"]) - wf.add(fun_addvar_none(name="addvar", a=wf.lzin.x, b=wf.lzin.y)) - wf.add(add2(name="add2", x=wf.addvar.lzout.out)) + wf.add(fun_addvar_none(name="addvar", inputs={"a": wf.lzin.x, "b": wf.lzin.y})) + wf.add(add2(name="add2", inputs={"x": wf.addvar.lzout.out})) wf.set_output([("out", wf.add2.lzout.out)]) wf.inputs.x = 2 wf.inputs.y = attr.NOTHING @@ -291,8 +291,8 @@ def test_wf_3a_exception(plugin): def test_wf_4(plugin): """wf with a task that doesn't set one input and use the function default value""" wf = Workflow(name="wf_4", input_spec=["x", "y"]) - wf.add(fun_addvar_default(name="addvar", a=wf.lzin.x)) - wf.add(add2(name="add2", x=wf.addvar.lzout.out)) + wf.add(fun_addvar_default(name="addvar", inputs={"a": wf.lzin.x})) + wf.add(add2(name="add2", inputs={"x": wf.addvar.lzout.out})) wf.set_output([("out", wf.add2.lzout.out)]) wf.inputs.x = 2 wf.plugin = plugin @@ -311,8 +311,8 @@ def test_wf_4a(plugin): so the task should use the function default value """ wf = Workflow(name="wf_4a", input_spec=["x", "y"]) - wf.add(fun_addvar_default(name="addvar", a=wf.lzin.x, y=wf.lzin.y)) - wf.add(add2(name="add2", x=wf.addvar.lzout.out)) + wf.add(fun_addvar_default(name="addvar", inputs={"a": wf.lzin.x, "y": wf.lzin.y})) + wf.add(add2(name="add2", inputs={"x": wf.addvar.lzout.out})) wf.set_output([("out", wf.add2.lzout.out)]) wf.inputs.x = 2 wf.plugin = plugin @@ -329,8 +329,8 @@ def test_wf_5(plugin): """ wf with two outputs connected to the task outputs one set_output """ - wf = Workflow(name="wf_5", input_spec=["x", "y"], x=3, y=2) - wf.add(fun_addsubvar(name="addsub", a=wf.lzin.x, b=wf.lzin.y)) + wf = Workflow(name="wf_5", input_spec=["x", "y"], inputs={"x": 3, "y": 2}) + wf.add(fun_addsubvar(name="addsub", inputs={"a": wf.lzin.x, "b": wf.lzin.y})) wf.set_output([("out_sum", wf.addsub.lzout.sum), ("out_sub", wf.addsub.lzout.sub)]) with Submitter(plugin=plugin) as sub: @@ -345,8 +345,8 @@ def test_wf_5a(plugin): """ wf with two outputs connected to the task outputs, set_output set twice """ - wf = Workflow(name="wf_5", input_spec=["x", "y"], x=3, y=2) - wf.add(fun_addsubvar(name="addsub", a=wf.lzin.x, b=wf.lzin.y)) + wf = Workflow(name="wf_5", input_spec=["x", "y"], inputs={"x": 3, "y": 2}) + wf.add(fun_addsubvar(name="addsub", inputs={"a": wf.lzin.x, "b": wf.lzin.y})) wf.set_output([("out_sum", wf.addsub.lzout.sum)]) wf.set_output([("out_sub", wf.addsub.lzout.sub)]) @@ -360,8 +360,8 @@ def test_wf_5a(plugin): def test_wf_5b_exception(): """ set_output used twice with the same name - exception should be raised """ - wf = Workflow(name="wf_5", input_spec=["x", "y"], x=3, y=2) - wf.add(fun_addsubvar(name="addsub", a=wf.lzin.x, b=wf.lzin.y)) + wf = Workflow(name="wf_5", input_spec=["x", "y"], inputs={"x": 3, "y": 2}) + wf.add(fun_addsubvar(name="addsub", inputs={"a": wf.lzin.x, "b": wf.lzin.y})) wf.set_output([("out", wf.addsub.lzout.sum)]) with pytest.raises(Exception) as excinfo: @@ -373,9 +373,9 @@ def test_wf_6(plugin): """ wf with two tasks and two outputs connected to both tasks, one set_output """ - wf = Workflow(name="wf_6", input_spec=["x", "y"], x=2, y=3) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) - wf.add(add2(name="add2", x=wf.mult.lzout.out)) + wf = Workflow(name="wf_6", input_spec=["x", "y"], inputs={"x": 2, "y": 3}) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) + wf.add(add2(name="add2", inputs={"x": wf.mult.lzout.out})) wf.set_output([("out1", wf.mult.lzout.out), ("out2", wf.add2.lzout.out)]) with Submitter(plugin=plugin) as sub: @@ -391,9 +391,9 @@ def test_wf_6a(plugin): """ wf with two tasks and two outputs connected to both tasks, set_output used twice """ - wf = Workflow(name="wf_6", input_spec=["x", "y"], x=2, y=3) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) - wf.add(add2(name="add2", x=wf.mult.lzout.out)) + wf = Workflow(name="wf_6", input_spec=["x", "y"], inputs={"x": 2, "y": 3}) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) + wf.add(add2(name="add2", inputs={"x": wf.mult.lzout.out})) wf.set_output([("out1", wf.mult.lzout.out)]) wf.set_output([("out2", wf.add2.lzout.out)]) @@ -409,7 +409,7 @@ def test_wf_6a(plugin): def test_wf_st_1(plugin): """ Workflow with one task, a splitter for the workflow""" wf = Workflow(name="wf_spl_1", input_spec=["x"]) - wf.add(add2(name="add2", x=wf.lzin.x)) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x})) wf.split(("x")) wf.inputs.x = [1, 2] @@ -434,7 +434,7 @@ def test_wf_st_1(plugin): def test_wf_st_1_call_subm(plugin): """ Workflow with one task, a splitter for the workflow""" wf = Workflow(name="wf_spl_1", input_spec=["x"]) - wf.add(add2(name="add2", x=wf.lzin.x)) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x})) wf.split(("x")) wf.inputs.x = [1, 2] @@ -457,7 +457,7 @@ def test_wf_st_1_call_subm(plugin): def test_wf_st_1_call_plug(plugin): """ Workflow with one task, a splitter for the workflow""" wf = Workflow(name="wf_spl_1", input_spec=["x"]) - wf.add(add2(name="add2", x=wf.lzin.x)) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x})) wf.split(("x")) wf.inputs.x = [1, 2] @@ -479,7 +479,7 @@ def test_wf_st_1_call_plug(plugin): def test_wf_st_noinput_1(plugin): """ Workflow with one task, a splitter for the workflow""" wf = Workflow(name="wf_spl_1", input_spec=["x"]) - wf.add(add2(name="add2", x=wf.lzin.x)) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x})) wf.split(("x")) wf.inputs.x = [] @@ -500,7 +500,7 @@ def test_wf_st_noinput_1(plugin): def test_wf_ndst_1(plugin): """ workflow with one task, a splitter on the task level""" wf = Workflow(name="wf_spl_1", input_spec=["x"]) - wf.add(add2(name="add2", x=wf.lzin.x).split("x")) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x}).split("x")) wf.inputs.x = [1, 2] wf.set_output([("out", wf.add2.lzout.out)]) wf.plugin = plugin @@ -521,7 +521,7 @@ def test_wf_ndst_updatespl_1(plugin): a splitter on the task level is added *after* calling add """ wf = Workflow(name="wf_spl_1", input_spec=["x"]) - wf.add(add2(name="add2", x=wf.lzin.x)) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x})) wf.inputs.x = [1, 2] wf.set_output([("out", wf.add2.lzout.out)]) wf.plugin = plugin @@ -543,7 +543,7 @@ def test_wf_ndst_updatespl_1a(plugin): a splitter on the task level is added *after* calling add """ wf = Workflow(name="wf_spl_1", input_spec=["x"]) - task_add2 = add2(name="add2", x=wf.lzin.x) + task_add2 = add2(name="add2", inputs={"x": wf.lzin.x}) wf.add(task_add2) task_add2.split("x") wf.inputs.x = [1, 2] @@ -567,7 +567,7 @@ def test_wf_ndst_updateinp_1(plugin): updating input of the task after calling add """ wf = Workflow(name="wf_spl_1", input_spec=["x", "y"]) - wf.add(add2(name="add2", x=wf.lzin.x)) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x})) wf.inputs.x = [1, 2] wf.inputs.y = [11, 12] wf.set_output([("out", wf.add2.lzout.out)]) @@ -588,7 +588,7 @@ def test_wf_ndst_updateinp_1(plugin): def test_wf_ndst_noinput_1(plugin): """ workflow with one task, a splitter on the task level""" wf = Workflow(name="wf_spl_1", input_spec=["x"]) - wf.add(add2(name="add2", x=wf.lzin.x).split("x")) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x}).split("x")) wf.inputs.x = [] wf.set_output([("out", wf.add2.lzout.out)]) wf.plugin = plugin @@ -607,7 +607,7 @@ def test_wf_ndst_noinput_1(plugin): def test_wf_st_2(plugin): """ workflow with one task, splitters and combiner for workflow""" wf = Workflow(name="wf_st_2", input_spec=["x"]) - wf.add(add2(name="add2", x=wf.lzin.x)) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x})) wf.split(("x")).combine(combiner="x") wf.inputs.x = [1, 2] @@ -630,7 +630,7 @@ def test_wf_st_2(plugin): def test_wf_ndst_2(plugin): """ workflow with one task, splitters and combiner on the task level""" wf = Workflow(name="wf_ndst_2", input_spec=["x"]) - wf.add(add2(name="add2", x=wf.lzin.x).split("x").combine(combiner="x")) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x}).split("x").combine(combiner="x")) wf.inputs.x = [1, 2] wf.set_output([("out", wf.add2.lzout.out)]) wf.plugin = plugin @@ -650,8 +650,8 @@ def test_wf_ndst_2(plugin): def test_wf_st_3(plugin): """ workflow with 2 tasks, splitter on wf level""" wf = Workflow(name="wfst_3", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) - wf.add(add2(name="add2", x=wf.mult.lzout.out)) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) + wf.add(add2(name="add2", inputs={"x": wf.mult.lzout.out})) wf.inputs.x = [1, 2] wf.inputs.y = [11, 12] wf.split(("x", "y")) @@ -697,8 +697,10 @@ def test_wf_st_3(plugin): def test_wf_ndst_3(plugin): """Test workflow with 2 tasks, splitter on a task level""" wf = Workflow(name="wf_ndst_3", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y).split(("x", "y"))) - wf.add(add2(name="add2", x=wf.mult.lzout.out)) + wf.add( + multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y}).split(("x", "y")) + ) + wf.add(add2(name="add2", inputs={"x": wf.mult.lzout.out})) wf.inputs.x = [1, 2] wf.inputs.y = [11, 12] wf.set_output([("out", wf.add2.lzout.out)]) @@ -717,8 +719,8 @@ def test_wf_ndst_3(plugin): def test_wf_st_4(plugin): """ workflow with two tasks, scalar splitter and combiner for the workflow""" wf = Workflow(name="wf_st_4", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) - wf.add(add2(name="add2", x=wf.mult.lzout.out)) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) + wf.add(add2(name="add2", inputs={"x": wf.mult.lzout.out})) wf.split(("x", "y"), x=[1, 2], y=[11, 12]) wf.combine("x") @@ -743,8 +745,10 @@ def test_wf_st_4(plugin): def test_wf_ndst_4(plugin): """ workflow with two tasks, scalar splitter and combiner on tasks level""" wf = Workflow(name="wf_ndst_4", input_spec=["a", "b"]) - wf.add(multiply(name="mult", x=wf.lzin.a, y=wf.lzin.b).split(("x", "y"))) - wf.add(add2(name="add2", x=wf.mult.lzout.out).combine("mult.x")) + wf.add( + multiply(name="mult", inputs={"x": wf.lzin.a, "y": wf.lzin.b}).split(("x", "y")) + ) + wf.add(add2(name="add2", inputs={"x": wf.mult.lzout.out}).combine("mult.x")) wf.set_output([("out", wf.add2.lzout.out)]) wf.plugin = plugin @@ -766,8 +770,8 @@ def test_wf_ndst_4(plugin): def test_wf_st_5(plugin): """ workflow with two tasks, outer splitter and no combiner""" wf = Workflow(name="wf_st_5", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) - wf.add(add2(name="add2", x=wf.mult.lzout.out)) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) + wf.add(add2(name="add2", inputs={"x": wf.mult.lzout.out})) wf.split(["x", "y"], x=[1, 2], y=[11, 12]) wf.set_output([("out", wf.add2.lzout.out)]) @@ -789,8 +793,10 @@ def test_wf_st_5(plugin): def test_wf_ndst_5(plugin): """ workflow with two tasks, outer splitter on tasks level and no combiner""" wf = Workflow(name="wf_ndst_5", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y).split(["x", "y"])) - wf.add(add2(name="add2", x=wf.mult.lzout.out)) + wf.add( + multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y}).split(["x", "y"]) + ) + wf.add(add2(name="add2", inputs={"x": wf.mult.lzout.out})) wf.inputs.x = [1, 2] wf.inputs.y = [11, 12] wf.set_output([("out", wf.add2.lzout.out)]) @@ -810,8 +816,8 @@ def test_wf_ndst_5(plugin): def test_wf_st_6(plugin): """ workflow with two tasks, outer splitter and combiner for the workflow""" wf = Workflow(name="wf_st_6", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) - wf.add(add2(name="add2", x=wf.mult.lzout.out)) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) + wf.add(add2(name="add2", inputs={"x": wf.mult.lzout.out})) wf.split(["x", "y"], x=[1, 2, 3], y=[11, 12]) wf.combine("x") @@ -837,8 +843,10 @@ def test_wf_st_6(plugin): def test_wf_ndst_6(plugin): """ workflow with two tasks, outer splitter and combiner on tasks level""" wf = Workflow(name="wf_ndst_6", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y).split(["x", "y"])) - wf.add(add2(name="add2", x=wf.mult.lzout.out).combine("mult.x")) + wf.add( + multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y}).split(["x", "y"]) + ) + wf.add(add2(name="add2", inputs={"x": wf.mult.lzout.out}).combine("mult.x")) wf.inputs.x = [1, 2, 3] wf.inputs.y = [11, 12] wf.set_output([("out", wf.add2.lzout.out)]) @@ -858,8 +866,12 @@ def test_wf_ndst_6(plugin): def test_wf_ndst_7(plugin): """ workflow with two tasks, outer splitter and (full) combiner for first node only""" wf = Workflow(name="wf_ndst_6", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y).split("x").combine("x")) - wf.add(identity(name="iden", x=wf.mult.lzout.out)) + wf.add( + multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y}) + .split("x") + .combine("x") + ) + wf.add(identity(name="iden", inputs={"x": wf.mult.lzout.out})) wf.inputs.x = [1, 2, 3] wf.inputs.y = 11 wf.set_output([("out", wf.iden.lzout.out)]) @@ -879,9 +891,11 @@ def test_wf_ndst_8(plugin): """ workflow with two tasks, outer splitter and (partial) combiner for first task only""" wf = Workflow(name="wf_ndst_6", input_spec=["x", "y"]) wf.add( - multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y).split(["x", "y"]).combine("x") + multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y}) + .split(["x", "y"]) + .combine("x") ) - wf.add(identity(name="iden", x=wf.mult.lzout.out)) + wf.add(identity(name="iden", inputs={"x": wf.mult.lzout.out})) wf.inputs.x = [1, 2, 3] wf.inputs.y = [11, 12] wf.set_output([("out", wf.iden.lzout.out)]) @@ -902,11 +916,11 @@ def test_wf_ndst_9(plugin): """ workflow with two tasks, outer splitter and (full) combiner for first task only""" wf = Workflow(name="wf_ndst_6", input_spec=["x", "y"]) wf.add( - multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y) + multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y}) .split(["x", "y"]) .combine(["x", "y"]) ) - wf.add(identity(name="iden", x=wf.mult.lzout.out)) + wf.add(identity(name="iden", inputs={"x": wf.mult.lzout.out})) wf.inputs.x = [1, 2, 3] wf.inputs.y = [11, 12] wf.set_output([("out", wf.iden.lzout.out)]) @@ -928,9 +942,11 @@ def test_wf_ndst_9(plugin): def test_wf_3sernd_ndst_1(plugin): """ workflow with three "serial" tasks, checking if the splitter is propagating""" wf = Workflow(name="wf_3sernd_ndst_1", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y).split(["x", "y"])) - wf.add(add2(name="add2_1st", x=wf.mult.lzout.out)) - wf.add(add2(name="add2_2nd", x=wf.add2_1st.lzout.out)) + wf.add( + multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y}).split(["x", "y"]) + ) + wf.add(add2(name="add2_1st", inputs={"x": wf.mult.lzout.out})) + wf.add(add2(name="add2_2nd", inputs={"x": wf.add2_1st.lzout.out})) wf.inputs.x = [1, 2] wf.inputs.y = [11, 12] wf.set_output([("out", wf.add2_2nd.lzout.out)]) @@ -957,9 +973,11 @@ def test_wf_3nd_st_1(plugin_dask_opt): splitter on the workflow level """ wf = Workflow(name="wf_st_7", input_spec=["x", "y"]) - wf.add(add2(name="add2x", x=wf.lzin.x)) - wf.add(add2(name="add2y", x=wf.lzin.y)) - wf.add(multiply(name="mult", x=wf.add2x.lzout.out, y=wf.add2y.lzout.out)) + wf.add(add2(name="add2x", inputs={"x": wf.lzin.x})) + wf.add(add2(name="add2y", inputs={"x": wf.lzin.y})) + wf.add( + multiply(name="mult", inputs={"x": wf.add2x.lzout.out, "y": wf.add2y.lzout.out}) + ) wf.split(["x", "y"], x=[1, 2, 3], y=[11, 12]) wf.set_output([("out", wf.mult.lzout.out)]) @@ -984,9 +1002,11 @@ def test_wf_3nd_ndst_1(plugin_dask_opt): splitter on the tasks levels """ wf = Workflow(name="wf_ndst_7", input_spec=["x", "y"]) - wf.add(add2(name="add2x", x=wf.lzin.x).split("x")) - wf.add(add2(name="add2y", x=wf.lzin.y).split("x")) - wf.add(multiply(name="mult", x=wf.add2x.lzout.out, y=wf.add2y.lzout.out)) + wf.add(add2(name="add2x", inputs={"x": wf.lzin.x}).split("x")) + wf.add(add2(name="add2y", inputs={"x": wf.lzin.y}).split("x")) + wf.add( + multiply(name="mult", inputs={"x": wf.add2x.lzout.out, "y": wf.add2y.lzout.out}) + ) wf.inputs.x = [1, 2, 3] wf.inputs.y = [11, 12] wf.set_output([("out", wf.mult.lzout.out)]) @@ -1006,9 +1026,11 @@ def test_wf_3nd_st_2(plugin): splitter and partial combiner on the workflow level """ wf = Workflow(name="wf_st_8", input_spec=["x", "y"]) - wf.add(add2(name="add2x", x=wf.lzin.x)) - wf.add(add2(name="add2y", x=wf.lzin.y)) - wf.add(multiply(name="mult", x=wf.add2x.lzout.out, y=wf.add2y.lzout.out)) + wf.add(add2(name="add2x", inputs={"x": wf.lzin.x})) + wf.add(add2(name="add2y", inputs={"x": wf.lzin.y})) + wf.add( + multiply(name="mult", inputs={"x": wf.add2x.lzout.out, "y": wf.add2y.lzout.out}) + ) wf.split(["x", "y"], x=[1, 2, 3], y=[11, 12]).combine("x") wf.set_output([("out", wf.mult.lzout.out)]) @@ -1036,12 +1058,12 @@ def test_wf_3nd_ndst_2(plugin): splitter and partial combiner on the tasks levels """ wf = Workflow(name="wf_ndst_8", input_spec=["x", "y"]) - wf.add(add2(name="add2x", x=wf.lzin.x).split("x")) - wf.add(add2(name="add2y", x=wf.lzin.y).split("x")) + wf.add(add2(name="add2x", inputs={"x": wf.lzin.x}).split("x")) + wf.add(add2(name="add2y", inputs={"x": wf.lzin.y}).split("x")) wf.add( - multiply(name="mult", x=wf.add2x.lzout.out, y=wf.add2y.lzout.out).combine( - "add2x.x" - ) + multiply( + name="mult", inputs={"x": wf.add2x.lzout.out, "y": wf.add2y.lzout.out} + ).combine("add2x.x") ) wf.inputs.x = [1, 2, 3] wf.inputs.y = [11, 12] @@ -1064,9 +1086,11 @@ def test_wf_3nd_st_3(plugin): splitter and partial combiner (from the second task) on the workflow level """ wf = Workflow(name="wf_st_9", input_spec=["x", "y"]) - wf.add(add2(name="add2x", x=wf.lzin.x)) - wf.add(add2(name="add2y", x=wf.lzin.y)) - wf.add(multiply(name="mult", x=wf.add2x.lzout.out, y=wf.add2y.lzout.out)) + wf.add(add2(name="add2x", inputs={"x": wf.lzin.x})) + wf.add(add2(name="add2y", inputs={"x": wf.lzin.y})) + wf.add( + multiply(name="mult", inputs={"x": wf.add2x.lzout.out, "y": wf.add2y.lzout.out}) + ) wf.split(["x", "y"], x=[1, 2, 3], y=[11, 12]).combine("y") wf.set_output([("out", wf.mult.lzout.out)]) @@ -1093,12 +1117,12 @@ def test_wf_3nd_ndst_3(plugin): splitter and partial combiner (from the second task) on the tasks levels """ wf = Workflow(name="wf_ndst_9", input_spec=["x", "y"]) - wf.add(add2(name="add2x", x=wf.lzin.x).split("x")) - wf.add(add2(name="add2y", x=wf.lzin.y).split("x")) + wf.add(add2(name="add2x", inputs={"x": wf.lzin.x}).split("x")) + wf.add(add2(name="add2y", inputs={"x": wf.lzin.y}).split("x")) wf.add( - multiply(name="mult", x=wf.add2x.lzout.out, y=wf.add2y.lzout.out).combine( - "add2y.x" - ) + multiply( + name="mult", inputs={"x": wf.add2x.lzout.out, "y": wf.add2y.lzout.out} + ).combine("add2y.x") ) wf.inputs.x = [1, 2, 3] wf.inputs.y = [11, 12] @@ -1121,9 +1145,11 @@ def test_wf_3nd_st_4(plugin): splitter and full combiner on the workflow level """ wf = Workflow(name="wf_st_10", input_spec=["x", "y"]) - wf.add(add2(name="add2x", x=wf.lzin.x)) - wf.add(add2(name="add2y", x=wf.lzin.y)) - wf.add(multiply(name="mult", x=wf.add2x.lzout.out, y=wf.add2y.lzout.out)) + wf.add(add2(name="add2x", inputs={"x": wf.lzin.x})) + wf.add(add2(name="add2y", inputs={"x": wf.lzin.y})) + wf.add( + multiply(name="mult", inputs={"x": wf.add2x.lzout.out, "y": wf.add2y.lzout.out}) + ) wf.split(["x", "y"], x=[1, 2, 3], y=[11, 12]).combine(["x", "y"]) wf.set_output([("out", wf.mult.lzout.out)]) wf.plugin = plugin @@ -1150,12 +1176,12 @@ def test_wf_3nd_ndst_4(plugin): splitter and full combiner on the tasks levels """ wf = Workflow(name="wf_ndst_10", input_spec=["x", "y"]) - wf.add(add2(name="add2x", x=wf.lzin.x).split("x")) - wf.add(add2(name="add2y", x=wf.lzin.y).split("x")) + wf.add(add2(name="add2x", inputs={"x": wf.lzin.x}).split("x")) + wf.add(add2(name="add2y", inputs={"x": wf.lzin.y}).split("x")) wf.add( - multiply(name="mult", x=wf.add2x.lzout.out, y=wf.add2y.lzout.out).combine( - ["add2x.x", "add2y.x"] - ) + multiply( + name="mult", inputs={"x": wf.add2x.lzout.out, "y": wf.add2y.lzout.out} + ).combine(["add2x.x", "add2y.x"]) ) wf.inputs.x = [1, 2, 3] wf.inputs.y = [11, 12] @@ -1178,11 +1204,12 @@ def test_wf_3nd_st_5(plugin): splitter and partial combiner (from the second task) on the workflow level """ wf = Workflow(name="wf_st_9", input_spec=["x", "y", "z"]) - wf.add(add2(name="add2x", x=wf.lzin.x)) - wf.add(add2(name="add2y", x=wf.lzin.y)) + wf.add(add2(name="add2x", inputs={"x": wf.lzin.x})) + wf.add(add2(name="add2y", inputs={"x": wf.lzin.y})) wf.add( fun_addvar3( - name="addvar", a=wf.add2x.lzout.out, b=wf.add2y.lzout.out, c=wf.lzin.z + name="addvar", + inputs={"a": wf.add2x.lzout.out, "b": wf.add2y.lzout.out, "c": wf.lzin.z}, ) ) wf.split(["x", "y", "z"], x=[2, 3], y=[11, 12], z=[10, 100]).combine("y") @@ -1215,11 +1242,12 @@ def test_wf_3nd_ndst_5(plugin): all tasks have splitters and the last one has a partial combiner (from the 2nd) """ wf = Workflow(name="wf_st_9", input_spec=["x", "y", "z"]) - wf.add(add2(name="add2x", x=wf.lzin.x).split("x")) - wf.add(add2(name="add2y", x=wf.lzin.y).split("x")) + wf.add(add2(name="add2x", inputs={"x": wf.lzin.x}).split("x")) + wf.add(add2(name="add2y", inputs={"x": wf.lzin.y}).split("x")) wf.add( fun_addvar3( - name="addvar", a=wf.add2x.lzout.out, b=wf.add2y.lzout.out, c=wf.lzin.z + name="addvar", + inputs={"a": wf.add2x.lzout.out, "b": wf.add2y.lzout.out, "c": wf.lzin.z}, ) .split("c") .combine("add2x.x") @@ -1250,10 +1278,10 @@ def test_wf_3nd_ndst_6(plugin): the third one uses scalar splitter from the previous ones and a combiner """ wf = Workflow(name="wf_ndst_9", input_spec=["x", "y"]) - wf.add(add2(name="add2x", x=wf.lzin.x).split("x")) - wf.add(add2(name="add2y", x=wf.lzin.y).split("x")) + wf.add(add2(name="add2x", inputs={"x": wf.lzin.x}).split("x")) + wf.add(add2(name="add2y", inputs={"x": wf.lzin.y}).split("x")) wf.add( - multiply(name="mult", x=wf.add2x.lzout.out, y=wf.add2y.lzout.out) + multiply(name="mult", inputs={"x": wf.add2x.lzout.out, "y": wf.add2y.lzout.out}) .split(("_add2x", "_add2y")) .combine("add2y.x") ) @@ -1280,8 +1308,12 @@ def test_wf_ndstLR_1(plugin): and the Left part from the first task should be added """ wf = Workflow(name="wf_ndst_3", input_spec=["x", "y"]) - wf.add(add2(name="add2", x=wf.lzin.x).split("x")) - wf.add(multiply(name="mult", x=wf.add2.lzout.out, y=wf.lzin.y).split("y")) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x}).split("x")) + wf.add( + multiply(name="mult", inputs={"x": wf.add2.lzout.out, "y": wf.lzin.y}).split( + "y" + ) + ) wf.inputs.x = [1, 2] wf.inputs.y = [11, 12] wf.set_output([("out", wf.mult.lzout.out)]) @@ -1308,9 +1340,11 @@ def test_wf_ndstLR_1a(plugin): and the Right part (it's onw splitter) """ wf = Workflow(name="wf_ndst_3", input_spec=["x", "y"]) - wf.add(add2(name="add2", x=wf.lzin.x).split("x")) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x}).split("x")) wf.add( - multiply(name="mult", x=wf.add2.lzout.out, y=wf.lzin.y).split(["_add2", "y"]) + multiply(name="mult", inputs={"x": wf.add2.lzout.out, "y": wf.lzin.y}).split( + ["_add2", "y"] + ) ) wf.inputs.x = [1, 2] wf.inputs.y = [11, 12] @@ -1338,11 +1372,12 @@ def test_wf_ndstLR_2(plugin): and the Left part from the first task should be added """ wf = Workflow(name="wf_ndst_3", input_spec=["x", "y", "z"]) - wf.add(add2(name="add2", x=wf.lzin.x).split("x")) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x}).split("x")) wf.add( - fun_addvar3(name="addvar", a=wf.add2.lzout.out, b=wf.lzin.y, c=wf.lzin.z).split( - ["b", "c"] - ) + fun_addvar3( + name="addvar", + inputs={"a": wf.add2.lzout.out, "b": wf.lzin.y, "c": wf.lzin.z}, + ).split(["b", "c"]) ) wf.inputs.x = [1, 2, 3] wf.inputs.y = [10, 20] @@ -1387,11 +1422,12 @@ def test_wf_ndstLR_2a(plugin): and the Right part (it's onw outer splitter) """ wf = Workflow(name="wf_ndst_3", input_spec=["x", "y", "z"]) - wf.add(add2(name="add2", x=wf.lzin.x).split("x")) + wf.add(add2(name="add2", inputs={"x": wf.lzin.x}).split("x")) wf.add( - fun_addvar3(name="addvar", a=wf.add2.lzout.out, b=wf.lzin.y, c=wf.lzin.z).split( - ["_add2", ["b", "c"]] - ) + fun_addvar3( + name="addvar", + inputs={"a": wf.add2.lzout.out, "b": wf.lzin.y, "c": wf.lzin.z}, + ).split(["_add2", ["b", "c"]]) ) wf.inputs.x = [1, 2, 3] wf.inputs.y = [10, 20] @@ -1438,8 +1474,8 @@ def test_wf_ndstinner_1(plugin): the second task has inner splitter """ wf = Workflow(name="wf_st_3", input_spec=["x"]) - wf.add(list_output(name="list", x=wf.lzin.x)) - wf.add(add2(name="add2", x=wf.list.lzout.out).split("x")) + wf.add(list_output(name="list", inputs={"x": wf.lzin.x})) + wf.add(add2(name="add2", inputs={"x": wf.list.lzout.out}).split("x")) wf.inputs.x = 1 wf.set_output([("out_list", wf.list.lzout.out), ("out", wf.add2.lzout.out)]) wf.plugin = plugin @@ -1462,8 +1498,12 @@ def test_wf_ndstinner_2(plugin): the second task has two inputs and inner splitter from one of the input """ wf = Workflow(name="wf_st_3", input_spec=["x", "y"]) - wf.add(list_output(name="list", x=wf.lzin.x)) - wf.add(multiply(name="mult", x=wf.list.lzout.out, y=wf.lzin.y).split("x")) + wf.add(list_output(name="list", inputs={"x": wf.lzin.x})) + wf.add( + multiply(name="mult", inputs={"x": wf.list.lzout.out, "y": wf.lzin.y}).split( + "x" + ) + ) wf.inputs.x = 1 wf.inputs.y = 10 wf.set_output([("out_list", wf.list.lzout.out), ("out", wf.mult.lzout.out)]) @@ -1487,8 +1527,12 @@ def test_wf_ndstinner_3(plugin): the second task has two inputs and outer splitter that includes an inner field """ wf = Workflow(name="wf_st_3", input_spec=["x", "y"]) - wf.add(list_output(name="list", x=wf.lzin.x)) - wf.add(multiply(name="mult", x=wf.list.lzout.out, y=wf.lzin.y).split(["x", "y"])) + wf.add(list_output(name="list", inputs={"x": wf.lzin.x})) + wf.add( + multiply(name="mult", inputs={"x": wf.list.lzout.out, "y": wf.lzin.y}).split( + ["x", "y"] + ) + ) wf.inputs.x = 1 wf.inputs.y = [10, 100] wf.set_output([("out_list", wf.list.lzout.out), ("out", wf.mult.lzout.out)]) @@ -1513,9 +1557,13 @@ def test_wf_ndstinner_4(plugin): the third task has no its own splitter """ wf = Workflow(name="wf_st_3", input_spec=["x", "y"]) - wf.add(list_output(name="list", x=wf.lzin.x)) - wf.add(multiply(name="mult", x=wf.list.lzout.out, y=wf.lzin.y).split("x")) - wf.add(add2(name="add2", x=wf.mult.lzout.out)) + wf.add(list_output(name="list", inputs={"x": wf.lzin.x})) + wf.add( + multiply(name="mult", inputs={"x": wf.list.lzout.out, "y": wf.lzin.y}).split( + "x" + ) + ) + wf.add(add2(name="add2", inputs={"x": wf.mult.lzout.out})) wf.inputs.x = 1 wf.inputs.y = 10 wf.set_output([("out_list", wf.list.lzout.out), ("out", wf.add2.lzout.out)]) @@ -1542,8 +1590,8 @@ def test_wf_ndstinner_4(plugin): def test_wf_st_singl_1(plugin): """ workflow with two tasks, only one input is in the splitter and combiner""" wf = Workflow(name="wf_st_5", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) - wf.add(add2(name="add2", x=wf.mult.lzout.out)) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) + wf.add(add2(name="add2", inputs={"x": wf.mult.lzout.out})) wf.split("x", x=[1, 2], y=11) wf.combine("x") @@ -1567,8 +1615,8 @@ def test_wf_ndst_singl_1(plugin): only one input is part of the splitter, the other is a single value """ wf = Workflow(name="wf_ndst_5", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y).split("x")) - wf.add(add2(name="add2", x=wf.mult.lzout.out).combine("mult.x")) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y}).split("x")) + wf.add(add2(name="add2", inputs={"x": wf.mult.lzout.out}).combine("mult.x")) wf.inputs.x = [1, 2] wf.inputs.y = 11 wf.set_output([("out", wf.add2.lzout.out)]) @@ -1589,9 +1637,11 @@ def test_wf_st_singl_2(plugin): only one input is part of the splitter, the other is a single value """ wf = Workflow(name="wf_st_6", input_spec=["x", "y"]) - wf.add(add2(name="add2x", x=wf.lzin.x)) - wf.add(add2(name="add2y", x=wf.lzin.y)) - wf.add(multiply(name="mult", x=wf.add2x.lzout.out, y=wf.add2y.lzout.out)) + wf.add(add2(name="add2x", inputs={"x": wf.lzin.x})) + wf.add(add2(name="add2y", inputs={"x": wf.lzin.y})) + wf.add( + multiply(name="mult", inputs={"x": wf.add2x.lzout.out, "y": wf.add2y.lzout.out}) + ) wf.split("x", x=[1, 2, 3], y=11) wf.set_output([("out", wf.mult.lzout.out)]) @@ -1617,9 +1667,11 @@ def test_wf_ndst_singl_2(plugin): only one input is part of the splitter, the other is a single value """ wf = Workflow(name="wf_ndst_6", input_spec=["x", "y"]) - wf.add(add2(name="add2x", x=wf.lzin.x).split("x")) - wf.add(add2(name="add2y", x=wf.lzin.y)) - wf.add(multiply(name="mult", x=wf.add2x.lzout.out, y=wf.add2y.lzout.out)) + wf.add(add2(name="add2x", inputs={"x": wf.lzin.x}).split("x")) + wf.add(add2(name="add2y", inputs={"x": wf.lzin.y})) + wf.add( + multiply(name="mult", inputs={"x": wf.add2x.lzout.out, "y": wf.add2y.lzout.out}) + ) wf.inputs.x = [1, 2, 3] wf.inputs.y = 11 wf.set_output([("out", wf.mult.lzout.out)]) @@ -1643,7 +1695,7 @@ def test_wfasnd_1(plugin): workflow-node with one task and no splitter """ wfnd = Workflow(name="wfnd", input_spec=["x"]) - wfnd.add(add2(name="add2", x=wfnd.lzin.x)) + wfnd.add(add2(name="add2", inputs={"x": wfnd.lzin.x})) wfnd.set_output([("out", wfnd.add2.lzout.out)]) wfnd.inputs.x = 2 @@ -1667,8 +1719,8 @@ def test_wfasnd_wfinp_1(plugin): input set for the main workflow """ wf = Workflow(name="wf", input_spec=["x"]) - wfnd = Workflow(name="wfnd", input_spec=["x"], x=wf.lzin.x) - wfnd.add(add2(name="add2", x=wfnd.lzin.x)) + wfnd = Workflow(name="wfnd", input_spec=["x"], inputs={"x": wf.lzin.x}) + wfnd.add(add2(name="add2", inputs={"x": wfnd.lzin.x})) wfnd.set_output([("out", wfnd.add2.lzout.out)]) wf.add(wfnd) @@ -1693,11 +1745,11 @@ def test_wfasnd_wfndupdate(plugin): wfasnode input is updated to use the main workflow input """ - wfnd = Workflow(name="wfnd", input_spec=["x"], x=2) - wfnd.add(add2(name="add2", x=wfnd.lzin.x)) + wfnd = Workflow(name="wfnd", input_spec=["x"], inputs={"x": 2}) + wfnd.add(add2(name="add2", inputs={"x": wfnd.lzin.x})) wfnd.set_output([("out", wfnd.add2.lzout.out)]) - wf = Workflow(name="wf", input_spec=["x"], x=3) + wf = Workflow(name="wf", input_spec=["x"], inputs={"x": 3}) wfnd.inputs.x = wf.lzin.x wf.add(wfnd) wf.set_output([("out", wf.wfnd.lzout.out)]) @@ -1718,13 +1770,13 @@ def test_wfasnd_wfndupdate_rerun(plugin): updated to use the main workflow input """ - wfnd = Workflow(name="wfnd", input_spec=["x"], x=2) - wfnd.add(add2(name="add2", x=wfnd.lzin.x)) + wfnd = Workflow(name="wfnd", input_spec=["x"], inputs={"x": 2}) + wfnd.add(add2(name="add2", inputs={"x": wfnd.lzin.x})) wfnd.set_output([("out", wfnd.add2.lzout.out)]) with Submitter(plugin=plugin) as sub: sub(wfnd) - wf = Workflow(name="wf", input_spec=["x"], x=3) + wf = Workflow(name="wf", input_spec=["x"], inputs={"x": 3}) # trying to set before wfnd.inputs.x = wf.lzin.x wf.add(wfnd) @@ -1741,7 +1793,7 @@ def test_wfasnd_wfndupdate_rerun(plugin): assert wf.output_dir.exists() # adding another layer of workflow - wf_o = Workflow(name="wf_o", input_spec=["x"], x=4) + wf_o = Workflow(name="wf_o", input_spec=["x"], inputs={"x": 4}) wf.inputs.x = wf_o.lzin.x wf_o.add(wf) wf_o.set_output([("out", wf_o.wf.lzout.out)]) @@ -1761,7 +1813,7 @@ def test_wfasnd_st_1(plugin): splitter for wfnd """ wfnd = Workflow(name="wfnd", input_spec=["x"]) - wfnd.add(add2(name="add2", x=wfnd.lzin.x)) + wfnd.add(add2(name="add2", inputs={"x": wfnd.lzin.x})) wfnd.set_output([("out", wfnd.add2.lzout.out)]) wfnd.split("x") wfnd.inputs.x = [2, 4] @@ -1788,7 +1840,7 @@ def test_wfasnd_st_updatespl_1(plugin): splitter for wfnd is set after add """ wfnd = Workflow(name="wfnd", input_spec=["x"]) - wfnd.add(add2(name="add2", x=wfnd.lzin.x)) + wfnd.add(add2(name="add2", inputs={"x": wfnd.lzin.x})) wfnd.set_output([("out", wfnd.add2.lzout.out)]) wfnd.inputs.x = [2, 4] @@ -1813,7 +1865,7 @@ def test_wfasnd_ndst_1(plugin): splitter for node """ wfnd = Workflow(name="wfnd", input_spec=["x"]) - wfnd.add(add2(name="add2", x=wfnd.lzin.x).split("x")) + wfnd.add(add2(name="add2", inputs={"x": wfnd.lzin.x}).split("x")) wfnd.set_output([("out", wfnd.add2.lzout.out)]) # TODO: without this the test is failing wfnd.plugin = plugin @@ -1839,7 +1891,7 @@ def test_wfasnd_ndst_updatespl_1(plugin): splitter for node added after add """ wfnd = Workflow(name="wfnd", input_spec=["x"]) - wfnd.add(add2(name="add2", x=wfnd.lzin.x)) + wfnd.add(add2(name="add2", inputs={"x": wfnd.lzin.x})) wfnd.set_output([("out", wfnd.add2.lzout.out)]) # TODO: without this the test is failing wfnd.plugin = plugin @@ -1866,8 +1918,8 @@ def test_wfasnd_wfst_1(plugin): splitter for the main workflow """ wf = Workflow(name="wf", input_spec=["x"]) - wfnd = Workflow(name="wfnd", input_spec=["x"], x=wf.lzin.x) - wfnd.add(add2(name="add2", x=wfnd.lzin.x)) + wfnd = Workflow(name="wfnd", input_spec=["x"], inputs={"x": wf.lzin.x}) + wfnd.add(add2(name="add2", inputs={"x": wfnd.lzin.x})) wfnd.set_output([("out", wfnd.add2.lzout.out)]) wf.add(wfnd) @@ -1897,7 +1949,7 @@ def test_wfasnd_st_2(plugin): splitter for wfnd """ wfnd = Workflow(name="wfnd", input_spec=["x", "y"]) - wfnd.add(multiply(name="mult", x=wfnd.lzin.x, y=wfnd.lzin.y)) + wfnd.add(multiply(name="mult", inputs={"x": wfnd.lzin.x, "y": wfnd.lzin.y})) wfnd.set_output([("out", wfnd.mult.lzout.out)]) wfnd.split(("x", "y")) wfnd.inputs.x = [2, 4] @@ -1905,7 +1957,7 @@ def test_wfasnd_st_2(plugin): wf = Workflow(name="wf_st_3", input_spec=["x", "y"]) wf.add(wfnd) - wf.add(add2(name="add2", x=wf.wfnd.lzout.out)) + wf.add(add2(name="add2", inputs={"x": wf.wfnd.lzout.out})) wf.set_output([("out", wf.add2.lzout.out)]) wf.plugin = plugin @@ -1924,12 +1976,14 @@ def test_wfasnd_wfst_2(plugin): splitter for the main workflow """ wf = Workflow(name="wf_st_3", input_spec=["x", "y"]) - wfnd = Workflow(name="wfnd", input_spec=["x", "y"], x=wf.lzin.x, y=wf.lzin.y) - wfnd.add(multiply(name="mult", x=wfnd.lzin.x, y=wfnd.lzin.y)) + wfnd = Workflow( + name="wfnd", input_spec=["x", "y"], inputs={"x": wf.lzin.x, "y": wf.lzin.y} + ) + wfnd.add(multiply(name="mult", inputs={"x": wfnd.lzin.x, "y": wfnd.lzin.y})) wfnd.set_output([("out", wfnd.mult.lzout.out)]) wf.add(wfnd) - wf.add(add2(name="add2", x=wf.wfnd.lzout.out)) + wf.add(add2(name="add2", inputs={"x": wf.wfnd.lzout.out})) wf.split(("x", "y")) wf.inputs.x = [2, 4] wf.inputs.y = [1, 10] @@ -1957,12 +2011,14 @@ def test_wfasnd_ndst_3(plugin): splitter for the first task """ wf = Workflow(name="wf_st_3", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y).split(("x", "y"))) + wf.add( + multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y}).split(("x", "y")) + ) wf.inputs.x = [2, 4] wf.inputs.y = [1, 10] - wfnd = Workflow(name="wfnd", input_spec=["x"], x=wf.mult.lzout.out) - wfnd.add(add2(name="add2", x=wfnd.lzin.x)) + wfnd = Workflow(name="wfnd", input_spec=["x"], inputs={"x": wf.mult.lzout.out}) + wfnd.add(add2(name="add2", inputs={"x": wfnd.lzin.x})) wfnd.set_output([("out", wfnd.add2.lzout.out)]) wf.add(wfnd) @@ -1984,13 +2040,13 @@ def test_wfasnd_wfst_3(plugin): splitter for the main workflow """ wf = Workflow(name="wf_st_3", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) wf.inputs.x = [2, 4] wf.inputs.y = [1, 10] wf.split(("x", "y")) - wfnd = Workflow(name="wfnd", input_spec=["x"], x=wf.mult.lzout.out) - wfnd.add(add2(name="add2", x=wfnd.lzin.x)) + wfnd = Workflow(name="wfnd", input_spec=["x"], inputs={"x": wf.mult.lzout.out}) + wfnd.add(add2(name="add2", inputs={"x": wfnd.lzin.x})) wfnd.set_output([("out", wfnd.add2.lzout.out)]) wf.add(wfnd) @@ -2017,8 +2073,8 @@ def test_wf_nostate_cachedir(plugin, tmpdir): cache_dir = tmpdir.mkdir("test_wf_cache_1") wf = Workflow(name="wf_2", input_spec=["x", "y"], cache_dir=cache_dir) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) - wf.add(add2(name="add2", x=wf.mult.lzout.out)) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) + wf.add(add2(name="add2", inputs={"x": wf.mult.lzout.out})) wf.set_output([("out", wf.add2.lzout.out)]) wf.inputs.x = 2 wf.inputs.y = 3 @@ -2041,8 +2097,8 @@ def test_wf_nostate_cachedir_relativepath(tmpdir, plugin): tmpdir.mkdir(cache_dir) wf = Workflow(name="wf_2", input_spec=["x", "y"], cache_dir=cache_dir) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) - wf.add(add2(name="add2", x=wf.mult.lzout.out)) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) + wf.add(add2(name="add2", inputs={"x": wf.mult.lzout.out})) wf.set_output([("out", wf.add2.lzout.out)]) wf.inputs.x = 2 wf.inputs.y = 3 @@ -2067,8 +2123,8 @@ def test_wf_nostate_cachelocations(plugin, tmpdir): cache_dir2 = tmpdir.mkdir("test_wf_cache4") wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) - wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y)) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y})) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = 2 wf1.inputs.y = 3 @@ -2088,8 +2144,8 @@ def test_wf_nostate_cachelocations(plugin, tmpdir): cache_dir=cache_dir2, cache_locations=cache_dir1, ) - wf2.add(multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.y)) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out)) + wf2.add(multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y})) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = 2 wf2.inputs.y = 3 @@ -2124,8 +2180,8 @@ def test_wf_nostate_cachelocations_a(plugin, tmpdir): cache_dir2 = tmpdir.mkdir("test_wf_cache4") wf1 = Workflow(name="wf1", input_spec=["x", "y"], cache_dir=cache_dir1) - wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y)) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y})) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = 2 wf1.inputs.y = 3 @@ -2145,8 +2201,8 @@ def test_wf_nostate_cachelocations_a(plugin, tmpdir): cache_dir=cache_dir2, cache_locations=cache_dir1, ) - wf2.add(multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.y)) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out)) + wf2.add(multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y})) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = 2 wf2.inputs.y = 3 @@ -2183,8 +2239,8 @@ def test_wf_nostate_cachelocations_b(plugin, tmpdir): cache_dir2 = tmpdir.mkdir("test_wf_cache4") wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) - wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y)) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y})) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = 2 wf1.inputs.y = 3 @@ -2204,8 +2260,8 @@ def test_wf_nostate_cachelocations_b(plugin, tmpdir): cache_dir=cache_dir2, cache_locations=cache_dir1, ) - wf2.add(multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.y)) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out)) + wf2.add(multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y})) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.set_output([("out", wf2.add2.lzout.out)]) # additional output wf2.set_output([("out_pr", wf2.add2.lzout.out)]) @@ -2243,8 +2299,8 @@ def test_wf_nostate_cachelocations_setoutputchange(plugin, tmpdir): cache_dir2 = tmpdir.mkdir("test_wf_cache4") wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) - wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y)) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y})) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out1", wf1.add2.lzout.out)]) wf1.inputs.x = 2 wf1.inputs.y = 3 @@ -2264,8 +2320,8 @@ def test_wf_nostate_cachelocations_setoutputchange(plugin, tmpdir): cache_dir=cache_dir2, cache_locations=cache_dir1, ) - wf2.add(multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.y)) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out)) + wf2.add(multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y})) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.set_output([("out2", wf2.add2.lzout.out)]) wf2.inputs.x = 2 wf2.inputs.y = 3 @@ -2299,8 +2355,8 @@ def test_wf_nostate_cachelocations_setoutputchange_a(plugin, tmpdir): cache_dir2 = tmpdir.mkdir("test_wf_cache4") wf1 = Workflow(name="wf1", input_spec=["x", "y"], cache_dir=cache_dir1) - wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y)) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y})) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out1", wf1.add2.lzout.out)]) wf1.inputs.x = 2 wf1.inputs.y = 3 @@ -2320,8 +2376,8 @@ def test_wf_nostate_cachelocations_setoutputchange_a(plugin, tmpdir): cache_dir=cache_dir2, cache_locations=cache_dir1, ) - wf2.add(multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.y)) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out)) + wf2.add(multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y})) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.set_output([("out2", wf2.add2.lzout.out)]) wf2.inputs.x = 2 wf2.inputs.y = 3 @@ -2357,8 +2413,8 @@ def test_wf_nostate_cachelocations_forcererun(plugin, tmpdir): cache_dir2 = tmpdir.mkdir("test_wf_cache4") wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) - wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y)) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y})) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = 2 wf1.inputs.y = 3 @@ -2378,8 +2434,8 @@ def test_wf_nostate_cachelocations_forcererun(plugin, tmpdir): cache_dir=cache_dir2, cache_locations=cache_dir1, ) - wf2.add(multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.y)) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out)) + wf2.add(multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y})) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = 2 wf2.inputs.y = 3 @@ -2414,8 +2470,8 @@ def test_wf_nostate_cachelocations_wftaskrerun_propagateTrue(plugin, tmpdir): cache_dir2 = tmpdir.mkdir("test_wf_cache4") wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) - wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y)) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y})) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = 2 wf1.inputs.y = 3 @@ -2436,8 +2492,8 @@ def test_wf_nostate_cachelocations_wftaskrerun_propagateTrue(plugin, tmpdir): cache_locations=cache_dir1, rerun=True, # wh has to be rerun (default for propagate_rerun is True) ) - wf2.add(multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.y)) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out)) + wf2.add(multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y})) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = 2 wf2.inputs.y = 3 @@ -2476,8 +2532,8 @@ def test_wf_nostate_cachelocations_wftaskrerun_propagateFalse(plugin, tmpdir): cache_dir2 = tmpdir.mkdir("test_wf_cache4") wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) - wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y)) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y})) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = 2 wf1.inputs.y = 3 @@ -2499,8 +2555,8 @@ def test_wf_nostate_cachelocations_wftaskrerun_propagateFalse(plugin, tmpdir): rerun=True, # wh has to be rerun propagate_rerun=False, # but rerun doesn't propagate to the tasks ) - wf2.add(multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.y)) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out)) + wf2.add(multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y})) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = 2 wf2.inputs.y = 3 @@ -2539,8 +2595,8 @@ def test_wf_nostate_cachelocations_taskrerun_wfrerun_propagateFalse(plugin, tmpd cache_dir2 = tmpdir.mkdir("test_wf_cache4") wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) - wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y)) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y})) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = 2 wf1.inputs.y = 3 @@ -2562,9 +2618,9 @@ def test_wf_nostate_cachelocations_taskrerun_wfrerun_propagateFalse(plugin, tmpd rerun=True, propagate_rerun=False, # rerun will not be propagated to each task ) - wf2.add(multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.y)) + wf2.add(multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y})) # rerun on the task level needed (wf.propagate_rerun is False) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out, rerun=True)) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out}, rerun=True)) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = 2 wf2.inputs.y = 3 @@ -2601,8 +2657,8 @@ def test_wf_nostate_nodecachelocations(plugin, tmpdir): cache_dir2 = tmpdir.mkdir("test_wf_cache4") wf1 = Workflow(name="wf", input_spec=["x"], cache_dir=cache_dir1) - wf1.add(ten(name="ten", x=wf1.lzin.x)) - wf1.add(add2(name="add2", x=wf1.ten.lzout.out)) + wf1.add(ten(name="ten", inputs={"x": wf1.lzin.x})) + wf1.add(add2(name="add2", inputs={"x": wf1.ten.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = 3 wf1.plugin = plugin @@ -2619,8 +2675,8 @@ def test_wf_nostate_nodecachelocations(plugin, tmpdir): cache_dir=cache_dir2, cache_locations=cache_dir1, ) - wf2.add(ten(name="ten", x=wf2.lzin.x)) - wf2.add(add2(name="add2", x=wf2.ten.lzout.out)) + wf2.add(ten(name="ten", inputs={"x": wf2.lzin.x})) + wf2.add(add2(name="add2", inputs={"x": wf2.ten.lzout.out})) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = 2 wf2.plugin = plugin @@ -2649,8 +2705,8 @@ def test_wf_nostate_nodecachelocations_upd(plugin, tmpdir): cache_dir2 = tmpdir.mkdir("test_wf_cache4") wf1 = Workflow(name="wf", input_spec=["x"], cache_dir=cache_dir1) - wf1.add(ten(name="ten", x=wf1.lzin.x)) - wf1.add(add2(name="add2", x=wf1.ten.lzout.out)) + wf1.add(ten(name="ten", inputs={"x": wf1.lzin.x})) + wf1.add(add2(name="add2", inputs={"x": wf1.ten.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = 3 wf1.plugin = plugin @@ -2662,8 +2718,8 @@ def test_wf_nostate_nodecachelocations_upd(plugin, tmpdir): assert 12 == results1.output.out wf2 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir2) - wf2.add(ten(name="ten", x=wf2.lzin.x)) - wf2.add(add2(name="add2", x=wf2.ten.lzout.out)) + wf2.add(ten(name="ten", inputs={"x": wf2.lzin.x})) + wf2.add(add2(name="add2", inputs={"x": wf2.ten.lzout.out})) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = 2 wf2.plugin = plugin @@ -2693,8 +2749,8 @@ def test_wf_state_cachelocations(plugin, tmpdir): cache_dir2 = tmpdir.mkdir("test_wf_cache4") wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) - wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y)) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y})) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = [2, 20] wf1.inputs.y = [3, 4] @@ -2716,8 +2772,8 @@ def test_wf_state_cachelocations(plugin, tmpdir): cache_dir=cache_dir2, cache_locations=cache_dir1, ) - wf2.add(multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.y)) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out)) + wf2.add(multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y})) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = [2, 20] wf2.inputs.y = [3, 4] @@ -2760,8 +2816,8 @@ def test_wf_state_cachelocations_forcererun(plugin, tmpdir): cache_dir2 = tmpdir.mkdir("test_wf_cache4") wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) - wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y)) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y})) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = [2, 20] wf1.inputs.y = [3, 4] @@ -2783,8 +2839,8 @@ def test_wf_state_cachelocations_forcererun(plugin, tmpdir): cache_dir=cache_dir2, cache_locations=cache_dir1, ) - wf2.add(multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.y)) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out)) + wf2.add(multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y})) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = [2, 20] wf2.inputs.y = [3, 4] @@ -2828,8 +2884,8 @@ def test_wf_state_cachelocations_updateinp(plugin, tmpdir): cache_dir2 = tmpdir.mkdir("test_wf_cache4") wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) - wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y)) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y})) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = [2, 20] wf1.inputs.y = [3, 4] @@ -2851,8 +2907,8 @@ def test_wf_state_cachelocations_updateinp(plugin, tmpdir): cache_dir=cache_dir2, cache_locations=cache_dir1, ) - wf2.add(multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.x)) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out)) + wf2.add(multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y})) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = [2, 20] wf2.inputs.y = [3, 4] @@ -2895,8 +2951,8 @@ def test_wf_state_n_nostate_cachelocations(plugin, tmpdir): cache_dir2 = tmpdir.mkdir("test_wf_cache4") wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) - wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y)) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y})) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = 2 wf1.inputs.y = 3 @@ -2914,8 +2970,8 @@ def test_wf_state_n_nostate_cachelocations(plugin, tmpdir): cache_dir=cache_dir2, cache_locations=cache_dir1, ) - wf2.add(multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.y)) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out)) + wf2.add(multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y})) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = [2, 20] wf2.inputs.y = [3, 4] @@ -2948,8 +3004,8 @@ def test_wf_nostate_cachelocations_updated(plugin, tmpdir): cache_dir2 = tmpdir.mkdir("test_wf_cache4") wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) - wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y)) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y})) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = 2 wf1.inputs.y = 3 @@ -2969,8 +3025,8 @@ def test_wf_nostate_cachelocations_updated(plugin, tmpdir): cache_dir=cache_dir2, cache_locations=cache_dir1, ) - wf2.add(multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.y)) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out)) + wf2.add(multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y})) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = 2 wf2.inputs.y = 3 @@ -3006,8 +3062,8 @@ def test_wf_nostate_cachelocations_recompute(plugin, tmpdir): cache_dir2 = tmpdir.mkdir("test_wf_cache4") wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) - wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y)) - wf1.add(add2(name="add2", x=wf1.mult.lzout.out)) + wf1.add(multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y})) + wf1.add(add2(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = 2 wf1.inputs.y = 3 @@ -3026,8 +3082,8 @@ def test_wf_nostate_cachelocations_recompute(plugin, tmpdir): cache_locations=cache_dir1, ) # different argument assigment - wf2.add(multiply(name="mult", x=wf2.lzin.y, y=wf2.lzin.x)) - wf2.add(add2(name="add2", x=wf2.mult.lzout.out)) + wf2.add(multiply(name="mult", inputs={"x": wf2.lzin.y, "y": wf2.lzin.x})) + wf2.add(add2(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = 2 wf2.inputs.y = 3 @@ -3058,9 +3114,11 @@ def test_wf_ndstate_cachelocations(plugin, tmpdir): wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) wf1.add( - multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y).split(splitter=("x", "y")) + multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y}).split( + splitter=("x", "y") + ) ) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = [2, 20] wf1.inputs.y = [3, 4] @@ -3081,9 +3139,11 @@ def test_wf_ndstate_cachelocations(plugin, tmpdir): cache_locations=cache_dir1, ) wf2.add( - multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.y).split(splitter=("x", "y")) + multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y}).split( + splitter=("x", "y") + ) ) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out)) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = [2, 20] wf2.inputs.y = [3, 4] @@ -3122,9 +3182,11 @@ def test_wf_ndstate_cachelocations_forcererun(plugin, tmpdir): wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) wf1.add( - multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y).split(splitter=("x", "y")) + multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y}).split( + splitter=("x", "y") + ) ) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = [2, 20] wf1.inputs.y = [3, 4] @@ -3145,9 +3207,11 @@ def test_wf_ndstate_cachelocations_forcererun(plugin, tmpdir): cache_locations=cache_dir1, ) wf2.add( - multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.y).split(splitter=("x", "y")) + multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y}).split( + splitter=("x", "y") + ) ) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out)) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = [2, 20] wf2.inputs.y = [3, 4] @@ -3184,9 +3248,11 @@ def test_wf_ndstate_cachelocations_updatespl(plugin, tmpdir): wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) wf1.add( - multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y).split(splitter=("x", "y")) + multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y}).split( + splitter=("x", "y") + ) ) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = [2, 20] wf1.inputs.y = [3, 4] @@ -3206,9 +3272,9 @@ def test_wf_ndstate_cachelocations_updatespl(plugin, tmpdir): cache_dir=cache_dir2, cache_locations=cache_dir1, ) - wf2.add(multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.y)) + wf2.add(multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y})) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out)) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.mult.split(splitter=("x", "y")) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = [2, 20] @@ -3247,9 +3313,11 @@ def test_wf_ndstate_cachelocations_recompute(plugin, tmpdir): wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) wf1.add( - multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y).split(splitter=("x", "y")) + multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y}).split( + splitter=("x", "y") + ) ) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = [2, 20] wf1.inputs.y = [3, 4] @@ -3270,9 +3338,11 @@ def test_wf_ndstate_cachelocations_recompute(plugin, tmpdir): cache_locations=cache_dir1, ) wf2.add( - multiply(name="mult", x=wf2.lzin.x, y=wf2.lzin.y).split(splitter=["x", "y"]) + multiply(name="mult", inputs={"x": wf2.lzin.x, "y": wf2.lzin.y}).split( + splitter=["x", "y"] + ) ) - wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out)) + wf2.add(add2_wait(name="add2", inputs={"x": wf2.mult.lzout.out})) wf2.set_output([("out", wf2.add2.lzout.out)]) wf2.inputs.x = [2, 20] wf2.inputs.y = [3, 4] @@ -3308,8 +3378,8 @@ def test_wf_nostate_runtwice_usecache(plugin, tmpdir): cache_dir1 = tmpdir.mkdir("test_wf_cache3") wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) - wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y)) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y})) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.inputs.x = 2 wf1.inputs.y = 3 @@ -3354,8 +3424,8 @@ def test_wf_state_runtwice_usecache(plugin, tmpdir): cache_dir1 = tmpdir.mkdir("test_wf_cache3") wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1) - wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y)) - wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out)) + wf1.add(multiply(name="mult", inputs={"x": wf1.lzin.x, "y": wf1.lzin.y})) + wf1.add(add2_wait(name="add2", inputs={"x": wf1.mult.lzout.out})) wf1.set_output([("out", wf1.add2.lzout.out)]) wf1.split(splitter=("x", "y")) wf1.inputs.x = [2, 20] @@ -3399,8 +3469,8 @@ def test_wf_state_runtwice_usecache(plugin, tmpdir): def create_tasks(): wf = Workflow(name="wf", input_spec=["x"]) wf.inputs.x = 1 - wf.add(add2(name="t1", x=wf.lzin.x)) - wf.add(multiply(name="t2", x=wf.t1.lzout.out, y=2)) + wf.add(add2(name="t1", inputs={"x": wf.lzin.x})) + wf.add(multiply(name="t2", inputs={"x": wf.t1.lzout.out, "y": 2})) wf.set_output([("out", wf.t2.lzout.out)]) t1 = wf.name2obj["t1"] t2 = wf.name2obj["t2"] @@ -3437,10 +3507,18 @@ def test_cache_propagation3(tmpdir, create_tasks): def test_workflow_combine1(tmpdir): - wf1 = Workflow(name="wf1", input_spec=["a", "b"], a=[1, 2], b=[2, 3]) - wf1.add(power(name="power", a=wf1.lzin.a, b=wf1.lzin.b).split(["a", "b"])) - wf1.add(identity(name="identity1", x=wf1.power.lzout.out).combine("power.a")) - wf1.add(identity(name="identity2", x=wf1.identity1.lzout.out).combine("power.b")) + wf1 = Workflow(name="wf1", input_spec=["a", "b"], inputs={"a": [1, 2], "b": [2, 3]}) + wf1.add( + power(name="power", inputs={"a": wf1.lzin.a, "b": wf1.lzin.b}).split(["a", "b"]) + ) + wf1.add( + identity(name="identity1", inputs={"x": wf1.power.lzout.out}).combine("power.a") + ) + wf1.add( + identity(name="identity2", inputs={"x": wf1.identity1.lzout.out}).combine( + "power.b" + ) + ) wf1.set_output( { "out_pow": wf1.power.lzout.out, @@ -3457,11 +3535,15 @@ def test_workflow_combine1(tmpdir): def test_workflow_combine2(tmpdir): - wf1 = Workflow(name="wf1", input_spec=["a", "b"], a=[1, 2], b=[2, 3]) + wf1 = Workflow(name="wf1", input_spec=["a", "b"], inputs={"a": [1, 2], "b": [2, 3]}) + wf1.add( + power(name="power", inputs={"a": wf1.lzin.a, "b": wf1.lzin.b}) + .split(["a", "b"]) + .combine("a") + ) wf1.add( - power(name="power", a=wf1.lzin.a, b=wf1.lzin.b).split(["a", "b"]).combine("a") + identity(name="identity", inputs={"x": wf1.power.lzout.out}).combine("power.b") ) - wf1.add(identity(name="identity", x=wf1.power.lzout.out).combine("power.b")) wf1.set_output({"out_pow": wf1.power.lzout.out, "out_iden": wf1.identity.lzout.out}) wf1.cache_dir = tmpdir result = wf1(plugin="cf") @@ -3479,8 +3561,8 @@ def test_wf_lzoutall_1(plugin): by using lzout.all syntax """ wf = Workflow(name="wf_2", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) - wf.add(add2_sub2_res(name="add_sub", res=wf.mult.lzout.all_)) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) + wf.add(add2_sub2_res(name="add_sub", inputs={"res": wf.mult.lzout.all_})) wf.set_output([("out", wf.add_sub.lzout.out_add)]) wf.inputs.x = 2 wf.inputs.y = 3 @@ -3500,8 +3582,8 @@ def test_wf_lzoutall_1a(plugin): by using lzout.all syntax in the node connections and for wf output """ wf = Workflow(name="wf_2", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y)) - wf.add(add2_sub2_res(name="add_sub", res=wf.mult.lzout.all_)) + wf.add(multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y})) + wf.add(add2_sub2_res(name="add_sub", inputs={"res": wf.mult.lzout.all_})) wf.set_output([("out_all", wf.add_sub.lzout.all_)]) wf.inputs.x = 2 wf.inputs.y = 3 @@ -3521,8 +3603,10 @@ def test_wf_lzoutall_st_1(plugin): by using lzout.all syntax """ wf = Workflow(name="wf_2", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y).split(["x", "y"])) - wf.add(add2_sub2_res(name="add_sub", res=wf.mult.lzout.all_)) + wf.add( + multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y}).split(["x", "y"]) + ) + wf.add(add2_sub2_res(name="add_sub", inputs={"res": wf.mult.lzout.all_})) wf.set_output([("out_add", wf.add_sub.lzout.out_add)]) wf.inputs.x = [2, 20] wf.inputs.y = [3, 30] @@ -3542,8 +3626,10 @@ def test_wf_lzoutall_st_1a(plugin): by using lzout.all syntax """ wf = Workflow(name="wf_2", input_spec=["x", "y"]) - wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y).split(["x", "y"])) - wf.add(add2_sub2_res(name="add_sub", res=wf.mult.lzout.all_)) + wf.add( + multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y}).split(["x", "y"]) + ) + wf.add(add2_sub2_res(name="add_sub", inputs={"res": wf.mult.lzout.all_})) wf.set_output([("out_all", wf.add_sub.lzout.all_)]) wf.inputs.x = [2, 20] wf.inputs.y = [3, 30] @@ -3569,9 +3655,11 @@ def test_wf_lzoutall_st_2(plugin): """ wf = Workflow(name="wf_2", input_spec=["x", "y"]) wf.add( - multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y).split(["x", "y"]).combine("x") + multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y}) + .split(["x", "y"]) + .combine("x") ) - wf.add(add2_sub2_res(name="add_sub", res=wf.mult.lzout.all_)) + wf.add(add2_sub2_res(name="add_sub", inputs={"res": wf.mult.lzout.all_})) wf.set_output([("out_add", wf.add_sub.lzout.out_add)]) wf.inputs.x = [2, 20] wf.inputs.y = [3, 30] @@ -3593,9 +3681,11 @@ def test_wf_lzoutall_st_2a(plugin): """ wf = Workflow(name="wf_2", input_spec=["x", "y"]) wf.add( - multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y).split(["x", "y"]).combine("x") + multiply(name="mult", inputs={"x": wf.lzin.x, "y": wf.lzin.y}) + .split(["x", "y"]) + .combine("x") ) - wf.add(add2_sub2_res(name="add_sub", res=wf.mult.lzout.all_)) + wf.add(add2_sub2_res(name="add_sub", inputs={"res": wf.mult.lzout.all_})) wf.set_output([("out_all", wf.add_sub.lzout.all_)]) wf.inputs.x = [2, 20] wf.inputs.y = [3, 30] @@ -3618,7 +3708,7 @@ def test_wf_lzoutall_st_2a(plugin): def test_wf_resultfile_1(plugin): """ workflow with a file in the result, file should be copied to the wf dir""" wf = Workflow(name="wf_file_1", input_spec=["x"]) - wf.add(fun_write_file(name="writefile", filename=wf.lzin.x)) + wf.add(fun_write_file(name="writefile", inputs={"filename": wf.lzin.x})) wf.inputs.x = "file_1.txt" wf.plugin = plugin wf.set_output([("wf_out", wf.writefile.lzout.out)]) @@ -3637,7 +3727,7 @@ def test_wf_resultfile_2(plugin): all files should be copied to the wf dir """ wf = Workflow(name="wf_file_1", input_spec=["x"]) - wf.add(fun_write_file_list(name="writefile", filename_list=wf.lzin.x)) + wf.add(fun_write_file_list(name="writefile", inputs={"filename_list": wf.lzin.x})) file_list = ["file_1.txt", "file_2.txt", "file_3.txt"] wf.inputs.x = file_list wf.plugin = plugin @@ -3658,7 +3748,9 @@ def test_wf_resultfile_3(plugin): all files should be copied to the wf dir """ wf = Workflow(name="wf_file_1", input_spec=["x"]) - wf.add(fun_write_file_list2dict(name="writefile", filename_list=wf.lzin.x)) + wf.add( + fun_write_file_list2dict(name="writefile", inputs={"filename_list": wf.lzin.x}) + ) file_list = ["file_1.txt", "file_2.txt", "file_3.txt"] wf.inputs.x = file_list wf.plugin = plugin @@ -3681,10 +3773,10 @@ def test_wf_resultfile_3(plugin): def test_wf_upstream_error1(plugin): """ workflow with two tasks, task2 dependent on an task1 which raised an error""" wf = Workflow(name="wf", input_spec=["x"]) - wf.add(fun_addvar_default(name="addvar1", a=wf.lzin.x)) + wf.add(fun_addvar_default(name="addvar1", inputs={"a": wf.lzin.x})) wf.inputs.x = "hi" # TypeError for adding str and int wf.plugin = plugin - wf.add(fun_addvar_default(name="addvar2", a=wf.addvar1.lzout.out)) + wf.add(fun_addvar_default(name="addvar2", inputs={"a": wf.addvar1.lzout.out})) wf.set_output([("out", wf.addvar2.lzout.out)]) with pytest.raises(ValueError) as excinfo: @@ -3699,11 +3791,11 @@ def test_wf_upstream_error2(plugin): goal - workflow finish running, one output errors but the other doesn't """ wf = Workflow(name="wf", input_spec=["x"]) - wf.add(fun_addvar_default(name="addvar1", a=wf.lzin.x)) + wf.add(fun_addvar_default(name="addvar1", inputs={"a": wf.lzin.x})) wf.inputs.x = [1, "hi"] # TypeError for adding str and int wf.split("x") # workflow-level split wf.plugin = plugin - wf.add(fun_addvar_default(name="addvar2", a=wf.addvar1.lzout.out)) + wf.add(fun_addvar_default(name="addvar2", inputs={"a": wf.addvar1.lzout.out})) wf.set_output([("out", wf.addvar2.lzout.out)]) with pytest.raises(Exception) as excinfo: @@ -3713,16 +3805,17 @@ def test_wf_upstream_error2(plugin): assert "raised an error" in str(excinfo.value) +@pytest.mark.flaky(reruns=3) # travis with slurm complains (no clue...) def test_wf_upstream_error3(plugin): """ task2 dependent on task1, task1 errors, task-level split on task 1 goal - workflow finish running, one output errors but the other doesn't """ wf = Workflow(name="wf", input_spec=["x"]) - wf.add(fun_addvar_default(name="addvar1", a=wf.lzin.x)) + wf.add(fun_addvar_default(name="addvar1", inputs={"a": wf.lzin.x})) wf.inputs.x = [1, "hi"] # TypeError for adding str and int wf.addvar1.split("a") # task-level split wf.plugin = plugin - wf.add(fun_addvar_default(name="addvar2", a=wf.addvar1.lzout.out)) + wf.add(fun_addvar_default(name="addvar2", inputs={"a": wf.addvar1.lzout.out})) wf.set_output([("out", wf.addvar2.lzout.out)]) with pytest.raises(Exception) as excinfo: @@ -3735,7 +3828,7 @@ def test_wf_upstream_error3(plugin): def test_wf_upstream_error4(plugin): """ workflow with one task, which raises an error""" wf = Workflow(name="wf", input_spec=["x"]) - wf.add(fun_addvar_default(name="addvar1", a=wf.lzin.x)) + wf.add(fun_addvar_default(name="addvar1", inputs={"a": wf.lzin.x})) wf.inputs.x = "hi" # TypeError for adding str and int wf.plugin = plugin wf.set_output([("out", wf.addvar1.lzout.out)]) @@ -3750,8 +3843,8 @@ def test_wf_upstream_error4(plugin): def test_wf_upstream_error5(plugin): """ nested workflow with one task, which raises an error""" wf_main = Workflow(name="wf_main", input_spec=["x"]) - wf = Workflow(name="wf", input_spec=["x"], x=wf_main.lzin.x) - wf.add(fun_addvar_default(name="addvar1", a=wf.lzin.x)) + wf = Workflow(name="wf", input_spec=["x"], inputs={"x": wf_main.lzin.x}) + wf.add(fun_addvar_default(name="addvar1", inputs={"a": wf.lzin.x})) wf.plugin = plugin wf.set_output([("wf_out", wf.addvar1.lzout.out)]) @@ -3770,9 +3863,9 @@ def test_wf_upstream_error5(plugin): def test_wf_upstream_error6(plugin): """ nested workflow with two tasks, the first one raises an error""" wf_main = Workflow(name="wf_main", input_spec=["x"]) - wf = Workflow(name="wf", input_spec=["x"], x=wf_main.lzin.x) - wf.add(fun_addvar_default(name="addvar1", a=wf.lzin.x)) - wf.add(fun_addvar_default(name="addvar2", a=wf.addvar1.lzout.out)) + wf = Workflow(name="wf", input_spec=["x"], inputs={"x": wf_main.lzin.x}) + wf.add(fun_addvar_default(name="addvar1", inputs={"a": wf.lzin.x})) + wf.add(fun_addvar_default(name="addvar2", inputs={"a": wf.addvar1.lzout.out})) wf.plugin = plugin wf.set_output([("wf_out", wf.addvar2.lzout.out)]) @@ -3794,11 +3887,11 @@ def test_wf_upstream_error7(plugin): the last task is set as the workflow output """ wf = Workflow(name="wf", input_spec=["x"]) - wf.add(fun_addvar_default(name="addvar1", a=wf.lzin.x)) + wf.add(fun_addvar_default(name="addvar1", inputs={"a": wf.lzin.x})) wf.inputs.x = "hi" # TypeError for adding str and int wf.plugin = plugin - wf.add(fun_addvar_default(name="addvar2", a=wf.addvar1.lzout.out)) - wf.add(fun_addvar_default(name="addvar3", a=wf.addvar2.lzout.out)) + wf.add(fun_addvar_default(name="addvar2", inputs={"a": wf.addvar1.lzout.out})) + wf.add(fun_addvar_default(name="addvar3", inputs={"a": wf.addvar2.lzout.out})) wf.set_output([("out", wf.addvar3.lzout.out)]) with pytest.raises(ValueError) as excinfo: @@ -3816,11 +3909,11 @@ def test_wf_upstream_error7a(plugin): the second task is set as the workflow output """ wf = Workflow(name="wf", input_spec=["x"]) - wf.add(fun_addvar_default(name="addvar1", a=wf.lzin.x)) + wf.add(fun_addvar_default(name="addvar1", inputs={"a": wf.lzin.x})) wf.inputs.x = "hi" # TypeError for adding str and int wf.plugin = plugin - wf.add(fun_addvar_default(name="addvar2", a=wf.addvar1.lzout.out)) - wf.add(fun_addvar_default(name="addvar3", a=wf.addvar2.lzout.out)) + wf.add(fun_addvar_default(name="addvar2", inputs={"a": wf.addvar1.lzout.out})) + wf.add(fun_addvar_default(name="addvar3", inputs={"a": wf.addvar2.lzout.out})) wf.set_output([("out", wf.addvar2.lzout.out)]) with pytest.raises(ValueError) as excinfo: @@ -3838,11 +3931,11 @@ def test_wf_upstream_error7b(plugin): the second and the third tasks are set as the workflow output """ wf = Workflow(name="wf", input_spec=["x"]) - wf.add(fun_addvar_default(name="addvar1", a=wf.lzin.x)) + wf.add(fun_addvar_default(name="addvar1", inputs={"a": wf.lzin.x})) wf.inputs.x = "hi" # TypeError for adding str and int wf.plugin = plugin - wf.add(fun_addvar_default(name="addvar2", a=wf.addvar1.lzout.out)) - wf.add(fun_addvar_default(name="addvar3", a=wf.addvar2.lzout.out)) + wf.add(fun_addvar_default(name="addvar2", inputs={"a": wf.addvar1.lzout.out})) + wf.add(fun_addvar_default(name="addvar3", inputs={"a": wf.addvar2.lzout.out})) wf.set_output([("out1", wf.addvar2.lzout.out), ("out2", wf.addvar3.lzout.out)]) with pytest.raises(ValueError) as excinfo: @@ -3857,11 +3950,11 @@ def test_wf_upstream_error7b(plugin): def test_wf_upstream_error8(plugin): """ workflow with three tasks, the first one raises an error, so 2 others are removed""" wf = Workflow(name="wf", input_spec=["x"]) - wf.add(fun_addvar_default(name="addvar1", a=wf.lzin.x)) + wf.add(fun_addvar_default(name="addvar1", inputs={"a": wf.lzin.x})) wf.inputs.x = "hi" # TypeError for adding str and int wf.plugin = plugin - wf.add(fun_addvar_default(name="addvar2", a=wf.addvar1.lzout.out)) - wf.add(fun_addtwo(name="addtwo", a=wf.addvar1.lzout.out)) + wf.add(fun_addvar_default(name="addvar2", inputs={"a": wf.addvar1.lzout.out})) + wf.add(fun_addtwo(name="addtwo", inputs={"a": wf.addvar1.lzout.out})) wf.set_output([("out1", wf.addvar2.lzout.out), ("out2", wf.addtwo.lzout.out)]) with pytest.raises(ValueError) as excinfo: @@ -3881,13 +3974,13 @@ def test_wf_upstream_error9(plugin): the errored branch is connected to the workflow output """ wf = Workflow(name="wf", input_spec=["x"]) - wf.add(fun_addvar_default(name="addvar1", a=wf.lzin.x)) + wf.add(fun_addvar_default(name="addvar1", inputs={"a": wf.lzin.x})) wf.inputs.x = 2 - wf.add(fun_addvar(name="err", a=wf.addvar1.lzout.out, b="hi")) - wf.add(fun_addvar_default(name="follow_err", a=wf.err.lzout.out)) + wf.add(fun_addvar(name="err", inputs={"a": wf.addvar1.lzout.out, "b": "hi"})) + wf.add(fun_addvar_default(name="follow_err", inputs={"a": wf.err.lzout.out})) - wf.add(fun_addtwo(name="addtwo", a=wf.addvar1.lzout.out)) - wf.add(fun_addvar_default(name="addvar2", a=wf.addtwo.lzout.out)) + wf.add(fun_addtwo(name="addtwo", inputs={"a": wf.addvar1.lzout.out})) + wf.add(fun_addvar_default(name="addvar2", inputs={"a": wf.addtwo.lzout.out})) wf.set_output([("out1", wf.follow_err.lzout.out)]) wf.plugin = plugin @@ -3908,13 +4001,13 @@ def test_wf_upstream_error9a(plugin): so the workflow finished clean """ wf = Workflow(name="wf", input_spec=["x"]) - wf.add(fun_addvar_default(name="addvar1", a=wf.lzin.x)) + wf.add(fun_addvar_default(name="addvar1", inputs={"a": wf.lzin.x})) wf.inputs.x = 2 - wf.add(fun_addvar(name="err", a=wf.addvar1.lzout.out, b="hi")) - wf.add(fun_addvar_default(name="follow_err", a=wf.err.lzout.out)) + wf.add(fun_addvar(name="err", inputs={"a": wf.addvar1.lzout.out, "b": "hi"})) + wf.add(fun_addvar_default(name="follow_err", inputs={"a": wf.err.lzout.out})) - wf.add(fun_addtwo(name="addtwo", a=wf.addvar1.lzout.out)) - wf.add(fun_addvar_default(name="addvar2", a=wf.addtwo.lzout.out)) + wf.add(fun_addtwo(name="addtwo", inputs={"a": wf.addvar1.lzout.out})) + wf.add(fun_addvar_default(name="addvar2", inputs={"a": wf.addtwo.lzout.out})) wf.set_output([("out1", wf.addvar2.lzout.out)]) # , ("out2", wf.addtwo.lzout.out)]) wf.plugin = plugin @@ -3931,13 +4024,13 @@ def test_wf_upstream_error9b(plugin): both branches are connected to the workflow output """ wf = Workflow(name="wf", input_spec=["x"]) - wf.add(fun_addvar_default(name="addvar1", a=wf.lzin.x)) + wf.add(fun_addvar_default(name="addvar1", inputs={"a": wf.lzin.x})) wf.inputs.x = 2 - wf.add(fun_addvar(name="err", a=wf.addvar1.lzout.out, b="hi")) - wf.add(fun_addvar_default(name="follow_err", a=wf.err.lzout.out)) + wf.add(fun_addvar(name="err", inputs={"a": wf.addvar1.lzout.out, "b": "hi"})) + wf.add(fun_addvar_default(name="follow_err", inputs={"a": wf.err.lzout.out})) - wf.add(fun_addtwo(name="addtwo", a=wf.addvar1.lzout.out)) - wf.add(fun_addvar_default(name="addvar2", a=wf.addtwo.lzout.out)) + wf.add(fun_addtwo(name="addtwo", inputs={"a": wf.addvar1.lzout.out})) + wf.add(fun_addvar_default(name="addvar2", inputs={"a": wf.addtwo.lzout.out})) wf.set_output([("out1", wf.follow_err.lzout.out), ("out2", wf.addtwo.lzout.out)]) wf.plugin = plugin diff --git a/pydra/engine/tests/utils.py b/pydra/engine/tests/utils.py index 46c043749d..fe54b1be80 100644 --- a/pydra/engine/tests/utils.py +++ b/pydra/engine/tests/utils.py @@ -210,7 +210,7 @@ def gen_basic_wf(name="basic-wf"): """ wf = Workflow(name=name, input_spec=["x"]) wf.inputs.x = 5 - wf.add(fun_addtwo(name="task1", a=wf.lzin.x, b=0)) - wf.add(fun_addvar(name="task2", a=wf.task1.lzout.out, b=2)) + wf.add(fun_addtwo(name="task1", inputs={"a": wf.lzin.x, "b": 0})) + wf.add(fun_addvar(name="task2", inputs={"a": wf.task1.lzout.out, "b": 2})) wf.set_output([("out", wf.task2.lzout.out)]) return wf diff --git a/pydra/mark/tests/test_functions.py b/pydra/mark/tests/test_functions.py index 31c764ea6b..a34893717c 100644 --- a/pydra/mark/tests/test_functions.py +++ b/pydra/mark/tests/test_functions.py @@ -11,15 +11,15 @@ def test_task_equivalence(): def add_two(a): return a + 2 - canonical = FunctionTask(add_two, a=3) + canonical = FunctionTask(add_two, inputs={"a": 3}) - decorated1 = task(add_two)(a=3) + decorated1 = task(add_two)(inputs={"a": 3}) @task def addtwo(a): return a + 2 - decorated2 = addtwo(a=3) + decorated2 = addtwo(inputs={"a": 3}) assert canonical.checksum == decorated1.checksum @@ -73,7 +73,7 @@ def test_annotated_task(): def square(in_val: float): return in_val ** 2 - res = square(in_val=2.0)() + res = square(inputs={"in_val": 2.0})() assert res.output.out == 4.0 @@ -83,7 +83,7 @@ def test_return_annotated_task(): def square(in_val): return in_val ** 2 - res = square(in_val=2.0)() + res = square(inputs={"in_val": 2.0})() assert res.output.squared == 4.0 @@ -93,7 +93,7 @@ def test_return_halfannotated_annotated_task(): def square(in_val): return in_val ** 2 - res = square(in_val=2.0)() + res = square(inputs={"in_val": 2.0})() assert res.output.out == 4.0 @@ -103,7 +103,7 @@ def test_return_annotated_task_multiple_output(): def square(in_val): return in_val ** 2, in_val ** 3 - res = square(in_val=2.0)() + res = square(inputs={"in_val": 2.0})() assert res.output.squared == 4.0 assert res.output.cubed == 8.0 @@ -114,6 +114,6 @@ def test_return_halfannotated_task_multiple_output(): def square(in_val): return in_val ** 2, in_val ** 3 - res = square(in_val=2.0)() + res = square(inputs={"in_val": 2.0})() assert res.output.out1 == 4.0 assert res.output.out2 == 8.0