def test_add_qualified_edge(self): w = WorkflowBuilder("test_add_edge") inp = w.input("inp", str) stp = w.step("stp", SingleTestTool(inputs=w.inp)) e = first_value(stp.sources["inputs"].source_map) self.assertEqual(e.start.id(), inp.id()) self.assertEqual(e.finish.id(), stp.id()) self.assertIsNone(e.stag) self.assertEqual(e.ftag, first_value(stp.inputs()).id())
def test_add_rescatter_scattered(self): w = WorkflowBuilder("scatterededge") w.input("inp1", Array(String())) stp1 = w.step("stp1", SingleTestTool(inputs=w.inp1), scatter="inputs") stp2 = w.step("stp2", SingleTestTool(inputs=stp1), scatter="inputs") e1 = first_value(stp1.sources["inputs"].source_map) e2 = first_value(stp2.sources["inputs"].source_map) self.assertTrue(e1.scatter) self.assertTrue(e2.scatter)
def test_add_edge_later(self): w = WorkflowBuilder("test_add_edge") inp = w.input("inp", str) stp = w.step("stp", SingleTestTool(), ignore_missing=True) stp["inputs"] = inp e = first_value(stp.sources["inputs"].source_map) self.assertEqual(e.start.id(), inp.id()) self.assertEqual(e.finish.id(), stp.id()) self.assertIsNone(e.stag) self.assertEqual(e.ftag, first_value(stp.inputs()).id())
def test_merge(self): w = WorkflowBuilder("scatterededge") w.input("inp1", Array(String())) w.step("scatteredStp1", SingleTestTool(inputs=w.inp1), scatter="inputs") stp = w.step("mergeStp2", ArrayTestTool(inputs=w.scatteredStp1)) e1 = first_value(w.scatteredStp1.sources["inputs"].source_map) e2 = first_value(w.mergeStp2.sources["inputs"].source_map) self.assertTrue(e1.scatter) self.assertFalse(e2.scatter) self.assertTrue(e2.compatible_types)
def test_add_non_scatter2(self): w = WorkflowBuilder("scatterededge") w.input("inp", Array(String())) w.step("stp", ArrayTestTool(inputs=w.inp)) e = first_value(w.stp.sources["inputs"].source_map) self.assertFalse(e.scatter)
def test_add_non_scatter(self): w = WorkflowBuilder("scatterededge") inp = w.input("inp", str) stp = w.step("stp", SingleTestTool(inputs=inp)) e = first_value(w.stp.sources["inputs"].source_map) self.assertIsNone(stp.scatter)
def test_add_single_to_array_edge(self): w = WorkflowBuilder("test_add_single_to_array_edge") w.input("inp1", String()) w.step("stp1", ArrayTestTool(inputs=w.inp1)) e = first_value(w.stp1.sources["inputs"].source_map) self.assertTrue(w.has_multiple_inputs) self.assertTrue(e.compatible_types)
def test_add_non_scatter_fail(self): w = WorkflowBuilder("scatterededge") w.input("inp", Array(str)) stp = w.step("stp", SingleTestTool(inputs=w.inp)) e = first_value(w.stp.sources["inputs"].source_map) self.assertFalse(e.compatible_types)
def test_add_scatter_nested_arrays_incompatible(self): w = WorkflowBuilder("scatterededge") w.input("inp", Array(Array(int))) stp = w.step("stp", ArrayTestTool(inputs=w.inp), scatter="inputs") e = first_value(w.stp.sources["inputs"].source_map) self.assertFalse(e.compatible_types) self.assertListEqual(["inputs"], stp.scatter.fields)
def test_add_scatter_incompatible(self): w = WorkflowBuilder("scatterededge") w.input("inp", Array(int)) stp = w.step("stp", SingleTestTool(inputs=w.inp), scatter="inputs") e = first_value(w.stp.sources["inputs"].source_map) self.assertTrue(e.scatter) self.assertFalse(e.compatible_types)
def test_add_scatter(self): w = WorkflowBuilder("scatterededge") w.input("inp", Array(str)) stp = w.step("stp", SingleTestTool(inputs=w.inp), scatter="inputs") e = first_value(w.stp.sources["inputs"].source_map) self.assertTrue(e.compatible_types) self.assertListEqual(["inputs"], stp.scatter.fields)
def test_add_qualified_edge(self): w = WorkflowBuilder("test_add_edge") inp = w.input("inp", str).input_node stp = w.step("stp", SingleTestTool(input1=w.inp)) e = stp.sources["input1"].source_map[0] self.assertEqual(e.source.input_node.id(), inp.id()) self.assertEqual(e.finish.id(), stp.id()) self.assertEqual(e.ftag, first_value(stp.inputs()).id())
def test_add_edge_later(self): w = WorkflowBuilder("test_add_edge") inp = w.input("inp", str) stp = w.step("stp", SingleTestTool(), ignore_missing=True) stp["input1"] = inp e: Edge = stp.sources["input1"].source_map[0] input_node: InputNodeSelector = e.source self.assertEqual(input_node.input_node.id(), inp.input_node.id()) self.assertEqual(e.finish.id(), stp.id()) self.assertEqual(e.ftag, first_value(stp.inputs()).id())