Closed ecraven closed 4 years ago
Hi! You can do raise StopLocust()
at the end of the task.
but be wary, starting >100 locusts at the same time may give you some issues - fast rampup is difficult (both for locust and the underlying OS), so you'll probably want to distribute the load (at least over multiple locust slave processes, ideally over multiple machines)
Oh, and if you have more questions like this one, please use StackOverflow instead of filing a ticket :)
Please note that Locust users are not meant to ever stop/die by themselves. Raising StopLocust
could work, but it could also have unintended consequences depending on how the tests are ran (distributed/non-distributed, with or without web UI).
Hello @cyberw, I have the same question (how to run a single task only once), but the suggestion to use
raise StopLocust()
does not work, as StopLocust()
is not defined. And I cannot find that expression in the documentation.
Can you help me with that please?
@alex4200 StopLocust has been renamed StopUser in locust 1.0!
@cyberw StopUser
also neither works, nor is mentioned in the documentation.
sorry, then I'm out of ideas. a brute force solution would be just
while True:
time.sleep(1)
Raising a StopUser
exception (from locust.exception import StopUser
) works, but will lower the count of users (it really kills them!), which is perhaps not what is desired. I've tested the whlie True
workaround, and it works great for my use case, with the caveat that the RPS count stays flat even when nothing happens anymore (a refresh problem, perhaps).
Hello ;) We'd like to run load tests as follows: each "user" (locust) should fulfil a sequence of tasks once, then stop. I can do the "sequence" thing fine with @seq_task, but how do I tell the locust to not repeat the tasks? I'd like to start up 200, 300, 400, .. locusts, have them each run the one task (all in parallel), then just stop. Is there any simple way to do this?