def test_readme_task(self): t = Task("task_name") t.inputs.append(Input(WdlType.parse_type("String"), "taskGreeting")) # command in next section t.outputs.append( Output(WdlType.parse_type("File"), "standardOut", "stdout()")) command = Task.Command("echo") command.inputs.append( Task.Command.CommandInput( "taskGreeting", optional=False, position=None, prefix="-a", separate_value_from_prefix=True, default=None, )) command.inputs.append( Task.Command.CommandInput( "otherInput", optional=True, position=2, prefix="optional-param=", separate_value_from_prefix=False, default=None, )) # t is the task t.command = command print(t.get_string())
def test_simple_task(self): # Task based on: https://github.com/openwdl/wdl/blob/master/versions/draft-2/SPEC.md#introduction t = Task("hello", runtime=Task.Runtime(docker="broadinstitute/my_image")) t.inputs.extend([ Input(WdlType.parse_type("String"), "pattern"), Input(WdlType.parse_type("File"), "in"), ]) t.outputs.append( Output(WdlType.parse_type("Array[String]"), "matches", "read_lines(stdout())")) t.command = Task.Command( "egrep", inputs=[Task.Command.CommandInput.from_input(i) for i in t.inputs]) print(t.get_string()) return t
def test_hello_tasks(): # https://github.com/openwdl/wdl/#specifying-inputs-and-using-declarations t1 = Task( "hello", inputs=[Input(String, "name"), Input(String, "salutation")], outputs=[Output(String, "response", "read_string(stdout())")], ) t1.command = Task.Command( "echo", inputs=[ Task.Command.CommandInput.from_input(t1.inputs[i], position=i) for i in range(2) ], ) print(t1.get_string()) return t1