Example #1
0
    def run(self, pipeline):
        """
        Convert Pipeline to its visualization in GraphViz dot format

        Args:
            pipeline (Pipeline): input Pipeline.

        Return:
            string: dot format
        """
        assert not self.__already_run
        self.__already_run = True

        clean_pipeline = self.__low_score_nodes_remover.run(pipeline)

        # We sort the collection to obtain the same order of output elements
        # every time. That is, we remove non-determinism of the output.
        for (name, node) in \
                sorted(clean_pipeline.nodes.items(), key=lambda x: x[0]):
            self.__b.add_node(name, node)
        pipeline_data = PipelineData.from_pipeline(clean_pipeline)

        # We sort the collection to obtain the same order of output elements
        # every time. That is, we remove non-determinism of the output.
        for data_id in sorted(pipeline_data.get_ids()):
            info = pipeline_data.get_info(data_id)
            start = self.__get_data_start(data_id, info.producers)
            ends = self.__get_data_ends(data_id, info.consumers)
            if start is not None and ends is not None:
                for end in ends:
                    self.__b.add_edge(start, end)
        return self.__b.get_result()
Example #2
0
    def run(self, pipeline):
        """
        Convert Pipeline to its visualization in GraphViz dot format

        Args:
            pipeline (Pipeline): input Pipeline.

        Return:
            string: dot format
        """
        assert not self.__already_run
        self.__already_run = True

        clean_pipeline = self.__low_score_nodes_remover.run(pipeline)

        # We sort the collection to obtain the same order of output elements
        # every time. That is, we remove non-determinism of the output.
        for (name, node) in \
                sorted(clean_pipeline.nodes.items(), key=lambda x: x[0]):
            self.__b.add_node(name, node)
        pipeline_data = PipelineData.from_pipeline(clean_pipeline)

        # We sort the collection to obtain the same order of output elements
        # every time. That is, we remove non-determinism of the output.
        for data_id in sorted(pipeline_data.get_ids()):
            info = pipeline_data.get_info(data_id)
            start = self.__get_data_start(data_id, info.producers)
            ends = self.__get_data_ends(data_id, info.consumers)
            if start is not None and ends is not None:
                for end in ends:
                    self.__b.add_edge(start, end)
        return self.__b.get_result()
Example #3
0
def check(pipeline_file_path, data_dict):
    pipeline_yaml = read_as_string(__name__, pipeline_file_path)
    pipeline = Pipeline.from_yaml_dump(pipeline_yaml)
    actual_data = PipelineData.from_pipeline(pipeline)
    expected_data = PipelineData.from_basic_data_types(data_dict)
    assert expected_data == actual_data
Example #4
0
def check(pipeline_file_path, data_dict):
    pipeline_yaml = read_as_string(__name__, pipeline_file_path)
    pipeline = Pipeline.from_yaml_dump(pipeline_yaml)
    actual_data = PipelineData.from_pipeline(pipeline)
    expected_data = PipelineData.from_basic_data_types(data_dict)
    assert expected_data == actual_data