From 4c0f894e279be0dfe373bbf569bb0d5e9e15d5e7 Mon Sep 17 00:00:00 2001 From: Lars Holmberg Date: Sun, 14 Jan 2024 11:07:03 +0100 Subject: [PATCH] Change default number of loadgens from crashing to mean all of them. --- README.md | 2 +- locust_swarm/swarm.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5f4ef0f..4afcea0 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ options: --loadgen-list LOADGEN_LIST A comma-separated list of ssh servers on which to launch locust workers --loadgens LOADGENS, -l LOADGENS - Number of servers to run locust workers on + Number of servers to run locust workers on. Defaults to -1, meaning all of them. --processes PROCESSES This is passed on to locust unchanged and determines the number of worker processes per load generator. --selenium Start selenium server on load gens for use with locust-plugins's WebdriverUser diff --git a/locust_swarm/swarm.py b/locust_swarm/swarm.py index bf45641..0853e1c 100644 --- a/locust_swarm/swarm.py +++ b/locust_swarm/swarm.py @@ -69,8 +69,8 @@ "--loadgens", "-l", type=int, - default=1, - help="Number of servers to run locust workers on", + default=-1, + help="Number of servers to run locust workers on. Defaults to -1, meaning all of them.", ) parser.add_argument( "--processes-per-loadgen", @@ -381,10 +381,10 @@ def main(): parser.error( f"--processes-per-loadgen has been removed in favour of locusts native --processes parameter (you had it set to {args.processes_per_loadgen})" ) - if args.loadgens < 1: - parser.error("loadgens parameter must be 1 or higher") worker_process_count = args.processes * args.loadgens loadgen_list = args.loadgen_list.split(",") + if args.loadgens < 0: + args.loadgens = len(loadgen_list) try: subprocess.check_output(