def testHasTaskDependency(self): example_gen = CsvExampleGen(input_base="data_path") statistics_gen = StatisticsGen( examples=example_gen.outputs["examples"]) p1 = pipeline.Pipeline(pipeline_name="fake_name", pipeline_root="fake_root", components=[example_gen, statistics_gen]) self.assertFalse(compiler_utils.has_task_dependency(p1)) a = EmptyComponent(name="a").with_id("a") statistics_gen.add_downstream_node(a) p2 = pipeline.Pipeline(pipeline_name="fake_name", pipeline_root="fake_root", components=[example_gen, statistics_gen, a]) self.assertTrue(compiler_utils.has_task_dependency(p2))
def _validate_pipeline(tfx_pipeline: pipeline.Pipeline): """Performs pre-compile validations.""" if (tfx_pipeline.execution_mode == pipeline.ExecutionMode.ASYNC and compiler_utils.has_task_dependency(tfx_pipeline)): raise ValueError("Task dependency is not supported in ASYNC mode.") if not compiler_utils.ensure_topological_order(tfx_pipeline.components): raise ValueError("Pipeline components are not topologically sorted.")