def run_test(self):
        self._compile()
        self._injection()

        # Overriding the experiment name of pipeline runs
        experiment_name = self._test_name + '-test'
        os.environ['KF_PIPELINES_OVERRIDE_EXPERIMENT_NAME'] = experiment_name

        if self._is_notebook:
            nbchecker = NoteBookChecker(
                testname=self._test_name,
                result=self._sample_test_result,
                run_pipeline=self._run_pipeline,
                experiment_name=experiment_name,
            )
            nbchecker.run()
            os.chdir(TEST_DIR)
            nbchecker.check()
        else:
            os.chdir(TEST_DIR)
            input_file = os.path.join(self._work_dir,
                                      '%s.py.yaml' % self._test_name)

            pysample_checker = PySampleChecker(
                testname=self._test_name,
                input=input_file,
                output=self._sample_test_output,
                result=self._sample_test_result,
                namespace=self._namespace,
                experiment_name=experiment_name,
            )
            pysample_checker.run()
            pysample_checker.check()

        self._copy_result()
Ejemplo n.º 2
0
    def check_notebook_result(self):
        # Workaround because papermill does not directly return exit code.
        exit_code = '1' if PAPERMILL_ERR_MSG in \
                           open('%s.ipynb' % self._test_name).read() else '0'

        os.chdir(TEST_DIR)

        if self._test_name == 'dsl_static_type_checking':
            nbchecker = NoteBookChecker(testname=self._test_name,
                                        result=self._sample_test_result,
                                        exit_code=exit_code)
            nbchecker.check()
        else:
            nbchecker = NoteBookChecker(testname=self._test_name,
                                        result=self._sample_test_result,
                                        exit_code=exit_code,
                                        experiment=None,
                                        namespace='kubeflow')
            nbchecker.check()

        print('Copy the test results to GCS %s/' % self._results_gcs_dir)

        utils.upload_blob(
            self._bucket_name, self._sample_test_result,
            os.path.join(self._results_gcs_dir, self._sample_test_result))
Ejemplo n.º 3
0
    def run_test(self):
        # TODO(numerology): ad hoc logic for TFX::OSS sample
        if self._test_name != 'parameterized_tfx_oss':
            self._compile()
            self._injection()

        if self._is_notebook:
            nbchecker = NoteBookChecker(testname=self._test_name,
                                        result=self._sample_test_result,
                                        run_pipeline=self._run_pipeline)
            nbchecker.run()
            os.chdir(TEST_DIR)
            nbchecker.check()
        else:
            os.chdir(TEST_DIR)
            if self._test_name != 'parameterized_tfx_oss':
                input_file = os.path.join(self._work_dir,
                                          '%s.yaml' % self._test_name)
            else:
                input_file = os.path.join(self._work_dir,
                                          '%s.tar.gz' % self._test_name)

            pysample_checker = PySampleChecker(testname=self._test_name,
                                               input=input_file,
                                               output=self._sample_test_output,
                                               result=self._sample_test_result,
                                               namespace=self._namespace)
            pysample_checker.run()
            pysample_checker.check()

        self._copy_result()
Ejemplo n.º 4
0
  def run_test(self):
    self._compile()
    self._injection()
    if self._is_notebook:
      nbchecker = NoteBookChecker(testname=self._test_name,
                                  result=self._sample_test_result,
                                  run_pipeline=self._run_pipeline)
      nbchecker.run()
      os.chdir(TEST_DIR)
      nbchecker.check()
    else:
      os.chdir(TEST_DIR)
      pysample_checker = PySampleChecker(testname=self._test_name,
                                         input=os.path.join(
                                             self._work_dir,
                                             '%s.yaml' % self._test_name),
                                         output=self._sample_test_output,
                                         result=self._sample_test_result,
                                         namespace=self._namespace)
      pysample_checker.run()
      pysample_checker.check()

    self._copy_result()