From d5d1e14babc68320dcb00edff44f265ec1f1c18f Mon Sep 17 00:00:00 2001 From: Srivatsan Krishnan Date: Sat, 11 Jan 2025 11:35:51 -0800 Subject: [PATCH] use iterators to avoid indexing errors. --- src/cloudai/cli/handlers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cloudai/cli/handlers.py b/src/cloudai/cli/handlers.py index c4663975..ebb5fdd5 100644 --- a/src/cloudai/cli/handlers.py +++ b/src/cloudai/cli/handlers.py @@ -128,7 +128,10 @@ def handle_dry_run_and_run(args: argparse.Namespace) -> int: logging.info(test_scenario.pretty_print()) - tr = test_scenario.test_runs[0] + tr = next(iter(test_scenario.test_runs), None) + if tr is None: + logging.error("No test runs found in the test scenario.") + return 1 agent = GridSearchAgent(tr) env = CloudAIGymEnv(test_run=tr, system=system, test_scenario=test_scenario)