From 188ba8f091cd952ddf71551dba1ad46776e6d46c Mon Sep 17 00:00:00 2001 From: Hung-Ting Wen Date: Tue, 4 Feb 2020 16:49:55 -0800 Subject: [PATCH] xgboost test for v1 (#718) * add param for cluster pattern * add new entry to prow-config * add info to error * fix prow-config * match prefix instead of exact test target name matching * update prow-config * remove master suffix for 63 char limit * fix lint --- prow_config.yaml | 14 +++++++++++ py/kubeflow/examples/create_e2e_workflow.py | 28 ++++++++++++++------- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/prow_config.yaml b/prow_config.yaml index 5dc93e19..0bb8bc78 100644 --- a/prow_config.yaml +++ b/prow_config.yaml @@ -65,6 +65,20 @@ workflows: - xgboost_synthetic/* - py/kubeflow/examples/create_e2e_workflow.py + # E2E test for various notebooks + # New notebooks can just add a step to the workflow + - py_func: kubeflow.examples.create_e2e_workflow.create_workflow + name: notebooks-v1 + job_types: + - periodic + - presubmit + - postsubmit + include_dirs: + - xgboost_synthetic/* + - py/kubeflow/examples/create_e2e_workflow.py + kwargs: + cluster_pattern: kf-v1-(?!n\d\d) + # E2E test for mnist example - py_func: kubeflow.examples.create_e2e_workflow.create_workflow name: mnist diff --git a/py/kubeflow/examples/create_e2e_workflow.py b/py/kubeflow/examples/create_e2e_workflow.py index bbb189af..b17d0a52 100644 --- a/py/kubeflow/examples/create_e2e_workflow.py +++ b/py/kubeflow/examples/create_e2e_workflow.py @@ -57,7 +57,7 @@ PROW_DICT = argo_build_util.get_prow_dict() class Builder: def __init__(self, name=None, namespace=None, test_target_name=None, - bucket=None, + bucket=None, cluster_pattern=None, **kwargs): # pylint: disable=unused-argument """Initialize a builder. @@ -116,6 +116,7 @@ class Builder: self.bucket = bucket self.workflow = None + self.cluster_pattern = cluster_pattern def _build_workflow(self): """Create the scaffolding for the Argo workflow""" @@ -406,12 +407,21 @@ class Builder: credentials = argo_build_util.deep_copy(task_template) credentials["name"] = "get-credentials" - credentials["container"]["command"] = ["python3", - "-m", - "kubeflow.testing." - "get_kf_testing_cluster", - "get-credentials", - ] + if self.cluster_pattern: + credentials["container"]["command"] = ["python3", + "-m", + "kubeflow.testing." + "get_kf_testing_cluster", + "--base=" + self.cluster_pattern, + "get-credentials", + ] + else: + credentials["container"]["command"] = ["python3", + "-m", + "kubeflow.testing." + "get_kf_testing_cluster", + "get-credentials", + ] dependencies = [checkout["name"]] argo_build_util.add_task_to_dag(self.workflow, E2E_DAG_NAME, credentials, @@ -419,12 +429,12 @@ class Builder: #************************************************************************** # Run a dag of tests - if self.test_target_name == "notebooks": + if self.test_target_name.startswith("notebooks"): self._build_tests_dag_notebooks() elif self.test_target_name == "mnist": self._build_tests_dag_mnist() else: - raise RuntimeError('Invalid test_target_name') + raise RuntimeError('Invalid test_target_name ' + self.test_target_name) # Add a task to run the dag dependencies = [credentials["name"]]