コード例 #1
0
ファイル: tasks.py プロジェクト: vibhatha/kisseru
        def transplant(edge):
            source = edge.source
            current_backend = Backend.get_current_backend()
            if not current_backend.name == 'LOCAL_NON_THREADED':
                source = Backend.get_backend(
                    BackendConfig(BackendType.LOCAL_NON_THREADED,
                                  'Local Non Threaded')).get_port(
                                      source.type, source.name, source.index,
                                      source.task_ref)
                # Update the task out-port to be a local port
                source.task_ref.outputs[source.name] = source
                # Update the edge
                edge.source = source

            dest = edge.dest
            if not current_backend.name == 'LOCAL_NON_THREADED':
                dest = Backend.get_backend(
                    BackendConfig(BackendType.LOCAL_NON_THREADED,
                                  'Local Non Threaded')).get_port(
                                      dest.type, dest.name, dest.index,
                                      dest.task_ref)
                # Update the task in-port to be a local port
                dest.task_ref.inputs[source.name] = dest
                # Update the edge
                edge.dest = dest
            return edge
コード例 #2
0
ファイル: tasks.py プロジェクト: vibhatha/kisseru
    def run(self, graph, ctx):
        Pass.run(self, graph, ctx)
        for tid, task in graph.tasks.items():
            # Infer if the task is a source
            is_source = True
            for name, inport in task.inputs.items():
                if not inport.is_immediate:
                    is_source = False
                    break
            if is_source:
                graph.set_source(task)

            # Infer if the task is a sink and generate sink out-ports
            if not task.edges:
                task.is_sink = True
                # If there no out edges it means this is a sink and all outputs
                # are sinks. Make them so...
                current_backend = Backend.get_current_backend()
                for name, outport in task.outputs.items():
                    # If current out port is not a local port make it so
                    if not current_backend.name == 'LOCAL_NON_THREADED':
                        outport = Backend.get_backend(
                            BackendConfig(BackendType.LOCAL_NON_THREADED,
                                          'Local Non Threaded')).get_port(
                                              outport.type, outport.name,
                                              outport.index, outport.task_ref)
                        task.edges.append(Edge(outport, Sink(outport)))
        return PassResult.CONTINUE