From 2222b99817c513c0cffb3a1dd6c34d49ce3d80d5 Mon Sep 17 00:00:00 2001 From: Prakhar Singhal Date: Sun, 1 Sep 2024 20:00:54 +0000 Subject: [PATCH] seperated e2e tests into seperate try blocks for better error handling and fixed some bugs Signed-off-by: Prakhar Singhal --- .../scripts/gh-actions/run-e2e-tune-api.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/test/e2e/v1beta1/scripts/gh-actions/run-e2e-tune-api.py b/test/e2e/v1beta1/scripts/gh-actions/run-e2e-tune-api.py index 47e6b50c2cc..4afd76d8b89 100644 --- a/test/e2e/v1beta1/scripts/gh-actions/run-e2e-tune-api.py +++ b/test/e2e/v1beta1/scripts/gh-actions/run-e2e-tune-api.py @@ -96,7 +96,7 @@ def objective(parameters): "b": search.double(min=0.1, max=0.2) } - # [4] Create Katib Experiment with 4 Trials and 2 CPUs per Trial. + # [3] Create Katib Experiment with 4 Trials and 2 CPUs per Trial. # And Wait until Experiment reaches Succeeded condition. katib_client.tune( name=exp_name, @@ -140,7 +140,6 @@ def objective(parameters): client.CoreV1Api().patch_namespace(args.namespace, {'metadata': {'labels': namespace_labels}}) # Test with run_e2e_experiment_create_by_tune_default_metrics_collector - # and run_e2e_experiment_create_by_tune_custom_metrics_collector exp_namespace = args.namespace try: exp_name = "tune-example-default-metrics-collector" @@ -148,7 +147,19 @@ def objective(parameters): run_e2e_experiment_create_by_tune_default_metrics_collector(katib_client, exp_name, exp_namespace) logging.info("---------------------------------------------------------------") logging.info(f"E2E is succeeded for Experiment created by tune: {exp_namespace}/{exp_name}") + except Exception as e: + logging.info("---------------------------------------------------------------") + logging.info(f"E2E is failed for Experiment created by tune: {exp_namespace}/{exp_name}") + raise e + finally: + # Delete the Experiment. + logging.info("---------------------------------------------------------------") + logging.info("---------------------------------------------------------------") + katib_client.delete_experiment(exp_name, exp_namespace) + + # Test with run_e2e_experiment_create_by_tune_custom_metrics_collector + try: exp_name = "tune-example-custom-metrics-collector" logging.info(f"Runnning E2E for Experiment created by tune: {exp_namespace}/{exp_name}") run_e2e_experiment_create_by_tune_custom_metrics_collector(katib_client, exp_name, exp_namespace)