Пример #1
0
    def configure(self, runtime_environment):
        self.dependency_manager = runtime_environment.dependency_manager

        if self.pipeline_path is not Ellipsis:
            return

        # the pipeline_name may be sibling notation, so resolve it to a fully qualified pipeline name
        pipeline_name = util.resolve_sibling_import(self.pipeline_name, self.evaluator.name)

        self.pipeline_dependency = self.dependency_manager.as_dependency(dict(provider='pipeline.%s' % pipeline_name))
        self.dependency_manager.add_dependency(self, self.pipeline_dependency)
Пример #2
0
    def process_dynamic_input(self, input, baton):
        pipeline_name = util.dict_get_path(baton, self.pipeline_path)
        # the pipeline_name may be sibling notation, so resolve it to a fully qualified pipeline name
        pipeline_name = util.resolve_sibling_import(pipeline_name, self.evaluator.name)

        dependency = self.dependency_manager.add_dependency(self, dict(provider='pipeline.%s'%pipeline_name))

        try:
            self.dependency_manager.resolve_initial_states()
            pipeline = yield dependency.wait_for_resource()

            results = yield self.process_input_using_pipeline(input, baton, pipeline)

            defer.returnValue(results)

        finally:
            # while this is sufficient to remove the dependency between ourselves
            # and the target pipeline, it does not currently deconstruct the pipeline
            # and its resources even if it is no longer needed.
            self.dependency_manager.remove_dependency(self, dependency)