From 97ee33c5c823e1a77c5e30b3f12c4876def2b91f Mon Sep 17 00:00:00 2001 From: Yi Yao Date: Thu, 24 Oct 2024 17:53:50 -0700 Subject: [PATCH] Raise the error if importing bench target fails. --- evals/benchmark/stresscli/locust/aistress.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/evals/benchmark/stresscli/locust/aistress.py b/evals/benchmark/stresscli/locust/aistress.py index 0a565844..e9377a27 100644 --- a/evals/benchmark/stresscli/locust/aistress.py +++ b/evals/benchmark/stresscli/locust/aistress.py @@ -225,10 +225,9 @@ def on_locust_init(environment, **_kwargs): os.environ["OPEA_EVAL_PROMPTS"] = environment.parsed_options.prompts os.environ["OPEA_EVAL_MAX_OUTPUT_TOKENS"] = str(environment.parsed_options.max_output) os.environ["LLM_MODEL"] = environment.parsed_options.llm_model - try: - bench_package = __import__(environment.parsed_options.bench_target) - except ImportError: - return None + + bench_package = __import__(environment.parsed_options.bench_target) + if not isinstance(environment.runner, WorkerRunner): gevent.spawn(checker, environment) environment.runner.register_message("worker_reqdata", on_reqdata)