File tree 1 file changed +48
-0
lines changed
1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -736,6 +736,54 @@ def test_docker_inputspec_1a(tmpdir):
736
736
assert res .output .stdout == "hello from pydra"
737
737
738
738
739
+ @no_win
740
+ @need_docker
741
+ def test_docker_inputspec_1b (tmpdir ):
742
+ """ a simple customized input spec for docker task
743
+ instead of using automatic binding I provide the bindings
744
+ and name of the file inside the container
745
+ """
746
+ filename = str (tmpdir .join ("file_pydra.txt" ))
747
+ with open (filename , "w" ) as f :
748
+ f .write ("hello from pydra" )
749
+
750
+ cmd = "cat"
751
+
752
+ my_input_spec = SpecInfo (
753
+ name = "Input" ,
754
+ fields = [
755
+ (
756
+ "file" ,
757
+ attr .ib (
758
+ type = File ,
759
+ metadata = {
760
+ "mandatory" : True ,
761
+ "position" : 1 ,
762
+ "argstr" : "" ,
763
+ "help_string" : "input file" ,
764
+ "container_path" : True ,
765
+ },
766
+ ),
767
+ )
768
+ ],
769
+ bases = (DockerSpec ,),
770
+ )
771
+
772
+ docky = DockerTask (
773
+ name = "docky" ,
774
+ image = "busybox" ,
775
+ executable = cmd ,
776
+ # container_path is set to True, so providing the filename inside the container
777
+ file = "/in_container/file_pydra.txt" ,
778
+ bindings = [(str (tmpdir ), "/in_container" )],
779
+ input_spec = my_input_spec ,
780
+ strip = True ,
781
+ )
782
+
783
+ res = docky ()
784
+ assert res .output .stdout == "hello from pydra"
785
+
786
+
739
787
@no_win
740
788
@need_docker
741
789
def test_docker_inputspec_1_dockerflag (tmpdir ):
You can’t perform that action at this time.
0 commit comments