diff --git a/locust/main.py b/locust/main.py index a7b41a6d53..6c0ea4009d 100644 --- a/locust/main.py +++ b/locust/main.py @@ -8,6 +8,7 @@ import inspect import logging import socket +import time from optparse import OptionParser import web @@ -115,6 +116,15 @@ def parse_options(): help="Port that locust master should bind to. Only used when running with --master. Defaults to 5557. Note that Locust will also use this port + 1, so by default the master node will bind to 5557 and 5558." ) + parser.add_option( + '--expect-slaves', + action='store', + type='int', + dest='expect_slaves', + default=1, + help="How many slaves master should expect to connect before starting the test (only when --no-web used)." + ) + # if we should print stats in the console parser.add_option( '--no-web', @@ -386,11 +396,6 @@ def main(): } console_logger.info(dumps(task_data)) sys.exit(0) - - # if --master is set, make sure --no-web isn't set - if options.master and options.no_web: - logger.error("Locust can not run distributed with the web interface disabled (do not use --no-web and --master together)") - sys.exit(0) if not options.no_web and not options.slave: # spawn web greenlet @@ -405,6 +410,14 @@ def main(): main_greenlet = runners.locust_runner.greenlet elif options.master: runners.locust_runner = MasterLocustRunner(locust_classes, options) + if options.no_web: + while len(runners.locust_runner.clients.ready)