Access the number of users to spawn in locustfile

Viewed 274

I'd like to be able to get access to the value of the -u parameter inside my locust file.

The Runner class gives me the number of concurrently running users but I want to know the value passed to locust via -u.

Update: Got it

@events.init.add_listener
def _(environment, **kwargs):
    print(environment.parsed_options.num_users)
0 Answers
Related