コード例 #1
0
ファイル: deputy.py プロジェクト: vakjha1/mlpiper
    def run(self):
        self._logger.info("Deputy starting")

        # TODO: move to a thread/separate process so we can track
        ret_val = 1
        try:
            pipeline_runner = Executor(args=None)\
                .pipeline_file(self._pipeline_file)\
                .mlcomp_jar(self._mlcomp_jar)\
                .use_color(self._use_color)

            py_deps = pipeline_runner.all_py_component_dependencies()
            if py_deps:
                PyPackageInstaller(py_deps).install()

            r_deps = pipeline_runner.all_r_component_dependencies()
            if r_deps:
                RPackageInstaller(r_deps).install()

            pipeline_runner.go()
            ret_val = 0
        except Exception as e:
            self._logger.info("Got exception while running code: {}".format(e))
            exc_type, exc_value, exc_traceback = sys.exc_info()
            print("========= Error from code ==========")
            traceback.print_exception(exc_type, exc_value, exc_traceback, file=sys.stdout)
            print("========= Error from code ==========")
            ret_val = 1
        finally:
            self._logger.info("Deputy done - finally block")

        return ret_val
コード例 #2
0
ファイル: mlpiper.py プロジェクト: vakjha1/mlpiper
    def deps(self, lang):
        self._logger.info("Showing dependencies information...")

        self.deploy()
        pipeline_file = os.path.join(self._deploy_dir,
                                     MLPiper.DEPLOYMENT_PIPELINE)

        pipeline_runner = Executor() \
            .comp_root_path(self._comp_root_path) \
            .pipeline_file(open(pipeline_file)) \
            .use_color(self._use_color)

        deps = None
        if lang == ComponentLanguage.PYTHON:
            deps = pipeline_runner.all_py_component_dependencies()
        elif lang == ComponentLanguage.R:
            deps = pipeline_runner.all_r_component_dependencies()
        else:
            pass

        print("----- Dependencies -----")
        if deps:
            for dep in sorted(deps):
                print(dep)
        else:
            print(
                "No dependencies found for {} components.\nOr there are no {} components in the pipeline."
                .format(lang, lang))
コード例 #3
0
 def test_accumulated_r_deps(self):
     with open(TestPythonDeps.pipeline_tmp_file, 'r') as f:
         pipeline_runner = Executor(args=None).pipeline_file(f)
         deps = pipeline_runner.all_r_component_dependencies()
         assert deps == set(expected_r_deps)