From 7a2977ef119239d6e2a131c1ca5ee1727d0db5ce Mon Sep 17 00:00:00 2001 From: Jeremy Lewi Date: Thu, 7 Nov 2019 19:46:19 -0800 Subject: [PATCH] Fix miscellaneous bugs with the xgboost_synthetic test (#676) * namespace where test runs should correspond to the namespace of a Kubeflow profile * There was a bug in the logging format string * There was a bug in the print statement for the job --- prow_config.yaml | 1 + py/kubeflow/examples/create_e2e_workflow.py | 2 +- xgboost_synthetic/testing/conftest.py | 6 ++++-- xgboost_synthetic/testing/xgboost_test.py | 8 ++++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/prow_config.yaml b/prow_config.yaml index 49d15dcee..981dd20b1 100644 --- a/prow_config.yaml +++ b/prow_config.yaml @@ -74,3 +74,4 @@ workflows: - postsubmit include_dirs: - xgboost_synthetic/* + - py/kubeflow/examples/create_e2e_workflow.py diff --git a/py/kubeflow/examples/create_e2e_workflow.py b/py/kubeflow/examples/create_e2e_workflow.py index e45b3f90f..61dcb9555 100644 --- a/py/kubeflow/examples/create_e2e_workflow.py +++ b/py/kubeflow/examples/create_e2e_workflow.py @@ -240,7 +240,7 @@ def _build_tests_dag(self): command = ["pytest", "xgboost_test.py", # Increase the log level so that info level log statements show up. "--log-cli-level=info", - "--log-cli-format='%(levelname)s|%(asctime)s|%(pathname)s|%(lineno)d| %(message)'", + "--log-cli-format='%(levelname)s|%(asctime)s|%(pathname)s|%(lineno)d| %(message)s'", # Test timeout in seconds. "--timeout=1800", "--junitxml=" + self.artifacts_dir + "/junit_xgboost-synthetic-test.xml", diff --git a/xgboost_synthetic/testing/conftest.py b/xgboost_synthetic/testing/conftest.py index 89cd4e4bb..c83e1aa4f 100644 --- a/xgboost_synthetic/testing/conftest.py +++ b/xgboost_synthetic/testing/conftest.py @@ -5,8 +5,10 @@ def pytest_addoption(parser): "--name", help="Name for the job. If not specified one was created " "automatically", type=str, default="") parser.addoption( - "--namespace", help="The namespace for the application", type=str, - default="kubeflow-test-infra") + "--namespace", help=("The namespace to run in. This should correspond to" + "a namespace associated with a Kubeflow namespace."), + type=str, + default="kubeflow-kubeflow-testing") parser.addoption( "--image", help="Notebook image to use", type=str, default="gcr.io/kubeflow-images-public/tensorflow-1.14.0-notebook-gpu" diff --git a/xgboost_synthetic/testing/xgboost_test.py b/xgboost_synthetic/testing/xgboost_test.py index ff4d0a7da..2d0fb697f 100644 --- a/xgboost_synthetic/testing/xgboost_test.py +++ b/xgboost_synthetic/testing/xgboost_test.py @@ -63,17 +63,17 @@ def test_xgboost_synthetic(record_xml_attribute, name, namespace, # pylint: disa actual_job = batch_api.create_namespaced_job(job["metadata"]["namespace"], job) logging.info("Created job %s.%s:\n%s", namespace, name, - yaml.safe_dump(actual_job)) + yaml.safe_dump(actual_job.to_dict())) final_job = util.wait_for_job(api_client, namespace, name, timeout=datetime.timedelta(minutes=30)) - logging.info("Final job:\n%s", yaml.safe_dump(final_job)) + logging.info("Final job:\n%s", yaml.safe_dump(final_job.to_dict())) - if not job.status.conditions: + if not final_job.status.conditions: raise RuntimeError("Job {0}.{1}; did not complete".format(namespace, name)) - last_condition = job.status.conditions[-1] + last_condition = final_job.status.conditions[-1] if last_condition.type not in ["Complete"]: logging.error("Job didn't complete successfully")