From 1d8a61eeee6b9c0b7e44bd6d7e33c28742bd5720 Mon Sep 17 00:00:00 2001 From: Lars Holmberg Date: Fri, 27 Sep 2024 11:55:32 +0200 Subject: [PATCH] Log locust-cloud version if it is installed --- locust/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/locust/main.py b/locust/main.py index fc97d9d84c..b04df04b07 100644 --- a/locust/main.py +++ b/locust/main.py @@ -5,6 +5,7 @@ import atexit import errno import gc +import importlib.metadata import inspect import json import logging @@ -44,7 +45,10 @@ raise try: import locust_cloud # pyright: ignore[reportMissingImports] + + locust_cloud_version = f" (locust-cloud {importlib.metadata.version('locust-cloud')})" except ModuleNotFoundError as e: + locust_cloud_version = "" if e.msg != "No module named 'locust_cloud'": raise @@ -200,7 +204,8 @@ def is_valid_percentile(parameter): children = [] logger = logging.getLogger(__name__) - logger.info(f"Starting Locust {version}") + + logger.info(f"Starting Locust {version}{locust_cloud_version}") if options.processes: if os.name == "nt":