From 9ad4be881fdb0b5785c343cf36a2351384edd5a9 Mon Sep 17 00:00:00 2001 From: Lars Holmberg Date: Fri, 28 Oct 2022 10:58:41 +0200 Subject: [PATCH] Parse options.stop_timeout earlier in main.py --- locust/main.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/locust/main.py b/locust/main.py index 9c031a9c72..d615d4a2e4 100644 --- a/locust/main.py +++ b/locust/main.py @@ -128,6 +128,13 @@ def main(): logger = logging.getLogger(__name__) greenlet_exception_handler = greenlet_exception_logger(logger) + if options.stop_timeout: + try: + options.stop_timeout = parse_timespan(options.stop_timeout) + except ValueError: + logger.error("Valid --stop-timeout formats are: 20, 20s, 3m, 2h, 1h20m, 3h30m10s, etc.") + sys.exit(1) + if options.list_commands: print("Available Users:") for name in user_classes: @@ -233,13 +240,6 @@ def main(): logger.error("Valid --run-time formats are: 20, 20s, 3m, 2h, 1h20m, 3h30m10s, etc.") sys.exit(1) - if options.stop_timeout: - try: - options.stop_timeout = parse_timespan(options.stop_timeout) - except ValueError: - logger.error("Valid --stop-timeout formats are: 20, 20s, 3m, 2h, 1h20m, 3h30m10s, etc.") - sys.exit(1) - if options.csv_prefix: stats_csv_writer = StatsCSVFileWriter( environment, stats.PERCENTILES_TO_REPORT, options.csv_prefix, options.stats_history_enabled