Skip to content

Commit 363081d

Browse files
committed
removing option to provide bindings as an input to container tasks
1 parent 32982f6 commit 363081d

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

pydra/engine/task.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -210,25 +210,23 @@ def __new__(cls, container_info=None, *args, **kwargs):
210210
if not container_info:
211211
return super().__new__(cls)
212212

213-
if len(container_info) == 3:
214-
type_cont, image, bind = container_info
215-
elif len(container_info) == 2:
216-
type_cont, image, bind = container_info + (None,)
213+
if len(container_info) == 2:
214+
type_cont, image = container_info
217215
else:
218216
raise Exception(
219-
f"container_info has to have 2 or 3 elements, but {container_info} provided"
217+
f"container_info has to have 2 elements, but {container_info} provided"
220218
)
221219

222220
if type_cont == "docker":
223221
# changing base class of spec if user defined
224222
if "input_spec" in kwargs:
225223
kwargs["input_spec"].bases = (DockerSpec,)
226-
return DockerTask(image=image, bindings=bind, *args, **kwargs)
224+
return DockerTask(image=image, *args, **kwargs)
227225
elif type_cont == "singularity":
228226
# changing base class of spec if user defined
229227
if "input_spec" in kwargs:
230228
kwargs["input_spec"].bases = (SingularitySpec,)
231-
return SingularityTask(image=image, bindings=bind, *args, **kwargs)
229+
return SingularityTask(image=image, *args, **kwargs)
232230
else:
233231
raise Exception(
234232
f"first element of container_info has to be "
@@ -331,7 +329,7 @@ def command_args(self):
331329
self._positions_provided = []
332330
for field in attr_fields(
333331
self.inputs,
334-
exclude_names=("container", "image", "container_xargs", "bindings"),
332+
exclude_names=("container", "image", "container_xargs"),
335333
):
336334
name, meta = field.name, field.metadata
337335
if (
@@ -622,6 +620,9 @@ def bind_paths(self):
622620
if self.inputs.bindings is None:
623621
self.inputs.bindings = []
624622
output_dir = self.output_dir
623+
# This part has to stay for now!!!
624+
# I'm creating self.inputs.bindings based on the input in TaskBase._run
625+
# in self.inputs.check_fields_input_spec() (see specs.py)
625626
for binding in self.inputs.bindings:
626627
binding = list(binding)
627628
if len(binding) == 3:
@@ -702,7 +703,6 @@ def __init__(
702703
if not self.init:
703704
if input_spec is None:
704705
input_spec = SpecInfo(name="Inputs", fields=[], bases=(DockerSpec,))
705-
706706
super().__init__(
707707
name=name,
708708
input_spec=input_spec,

pydra/engine/tests/test_dockertask.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def test_docker_1_dockerflag_exception(plugin):
8080
shocky = ShellCommandTask(
8181
name="shocky", executable=cmd, container_info=("docker")
8282
)
83-
assert "container_info has to have 2 or 3 elements" in str(excinfo.value)
83+
assert "container_info has to have 2 elements" in str(excinfo.value)
8484

8585

8686
@no_win
@@ -203,6 +203,7 @@ def test_docker_2a(plugin):
203203

204204
@no_win
205205
@need_docker
206+
@pytest.mark.skip(reason="we probably don't want to support bindings as an input")
206207
def test_docker_3(plugin, tmpdir):
207208
"""a simple command in container with bindings,
208209
creating directory in tmp dir and checking if it is in the container
@@ -226,6 +227,7 @@ def test_docker_3(plugin, tmpdir):
226227

227228
@no_win
228229
@need_docker
230+
@pytest.mark.skip(reason="we probably don't want to support bindings as an input")
229231
def test_docker_3_dockerflag(plugin, tmpdir):
230232
"""a simple command in container with bindings,
231233
creating directory in tmp dir and checking if it is in the container
@@ -252,6 +254,7 @@ def test_docker_3_dockerflag(plugin, tmpdir):
252254

253255
@no_win
254256
@need_docker
257+
@pytest.mark.skip(reason="we probably don't want to support bindings as an input")
255258
def test_docker_3_dockerflagbind(plugin, tmpdir):
256259
"""a simple command in container with bindings,
257260
creating directory in tmp dir and checking if it is in the container
@@ -278,6 +281,7 @@ def test_docker_3_dockerflagbind(plugin, tmpdir):
278281

279282
@no_win
280283
@need_docker
284+
@pytest.mark.skip(reason="we probably don't want to support bindings as an input")
281285
def test_docker_4(plugin, tmpdir):
282286
"""task reads the file that is bounded to the container
283287
specifying bindings,
@@ -304,6 +308,7 @@ def test_docker_4(plugin, tmpdir):
304308

305309
@no_win
306310
@need_docker
311+
@pytest.mark.skip(reason="we probably don't want to support bindings as an input")
307312
def test_docker_4_dockerflag(plugin, tmpdir):
308313
"""task reads the file that is bounded to the container
309314
specifying bindings,
@@ -439,6 +444,7 @@ def test_docker_st_4(plugin):
439444

440445
@no_win
441446
@need_docker
447+
@pytest.mark.skip(reason="we probably don't want to support bindings as an input")
442448
def test_wf_docker_1(plugin, tmpdir):
443449
"""a workflow with two connected task
444450
the first one read the file that is bounded to the container,
@@ -483,6 +489,7 @@ def test_wf_docker_1(plugin, tmpdir):
483489

484490
@no_win
485491
@need_docker
492+
@pytest.mark.skip(reason="we probably don't want to support bindings as an input")
486493
def test_wf_docker_1_dockerflag(plugin, tmpdir):
487494
"""a workflow with two connected task
488495
the first one read the file that is bounded to the container,
@@ -523,6 +530,7 @@ def test_wf_docker_1_dockerflag(plugin, tmpdir):
523530

524531
@no_win
525532
@need_docker
533+
@pytest.mark.skip(reason="we probably don't want to support bindings as an input")
526534
def test_wf_docker_2pre(plugin, tmpdir):
527535
"""a workflow with two connected task that run python scripts
528536
the first one creates a text file and the second one reads the file
@@ -544,6 +552,7 @@ def test_wf_docker_2pre(plugin, tmpdir):
544552

545553
@no_win
546554
@need_docker
555+
@pytest.mark.skip(reason="we probably don't want to support bindings as an input")
547556
def test_wf_docker_2(plugin, tmpdir):
548557
"""a workflow with two connected task that run python scripts
549558
the first one creates a text file and the second one reads the file
@@ -584,6 +593,7 @@ def test_wf_docker_2(plugin, tmpdir):
584593

585594
@no_win
586595
@need_docker
596+
@pytest.mark.skip(reason="we probably don't want to support bindings as an input")
587597
def test_wf_docker_3(plugin, tmpdir):
588598
"""a workflow with two connected task
589599
the first one read the file that contains the name of the image,
@@ -736,6 +746,7 @@ def test_docker_inputspec_1a(tmpdir):
736746

737747
@no_win
738748
@need_docker
749+
@pytest.mark.skip(reason="we probably don't want to support bindings as an input")
739750
def test_docker_inputspec_1b(tmpdir):
740751
"""a simple customized input spec for docker task
741752
instead of using automatic binding I provide the bindings

pydra/engine/tests/test_singularity.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ def test_singularity_2a(plugin, tmpdir):
130130

131131

132132
@need_singularity
133+
@pytest.mark.skip(reason="we probably don't want to support bindings as an input")
133134
def test_singularity_3(plugin, tmpdir):
134135
"""a simple command in container with bindings,
135136
creating directory in tmp dir and checking if it is in the container
@@ -151,6 +152,7 @@ def test_singularity_3(plugin, tmpdir):
151152

152153

153154
@need_singularity
155+
@pytest.mark.skip(reason="we probably don't want to support bindings as an input")
154156
def test_singularity_3_singuflag(plugin, tmpdir):
155157
"""a simple command in container with bindings,
156158
creating directory in tmp dir and checking if it is in the container
@@ -178,6 +180,7 @@ def test_singularity_3_singuflag(plugin, tmpdir):
178180

179181

180182
@need_singularity
183+
@pytest.mark.skip(reason="we probably don't want to support bindings as an input")
181184
def test_singularity_3_singuflagbind(plugin, tmpdir):
182185
"""a simple command in container with bindings,
183186
creating directory in tmp dir and checking if it is in the container
@@ -279,6 +282,7 @@ def test_singularity_st_4(tmpdir, n):
279282

280283

281284
@need_singularity
285+
@pytest.mark.skip(reason="we probably don't want to support bindings as an input")
282286
def test_wf_singularity_1(plugin, tmpdir):
283287
"""a workflow with two connected task
284288
the first one read the file that is bounded to the container,
@@ -320,6 +324,7 @@ def test_wf_singularity_1(plugin, tmpdir):
320324

321325
@need_docker
322326
@need_singularity
327+
@pytest.mark.skip(reason="we probably don't want to support bindings as an input")
323328
def test_wf_singularity_1a(plugin, tmpdir):
324329
"""a workflow with two connected task - using both containers: Docker and Singul.
325330
the first one read the file that is bounded to the container,

0 commit comments

Comments
 (0)