Reputation: 37
I am new to Locust and I am testing a website with different users. How can I end end a user task ?
Upvotes: 1
Views: 2106
Reputation: 165
If you are using the web version of locust, then to stop locust, you need to manually click on the Stop Button. OR you can call the on_stop
method in locust after desired number of users.
If you are using the non-web option, then you can use the timeout option in the locust command:
locust -f --no-web -c 1000 -r 100 --run-time 1h30m
The locust will stop after the specified amount of time
Upvotes: 0
Reputation: 11426
I'm not sure exactly what you are after, but you can stop a user/locust by doing raise StopLocust()
Upvotes: 2
Reputation: 4857
Not sure what you mean by end a task, you specify your task with the task
decorator like this that's all:
class MyBehavior(TaskSet):
def __init__(self, parent):
super(MyBehavior, self).__init__(parent)
# E.g. set headers here
self.headers = {}
@task(1)
def mytask(self):
# Task starts
self.client.get("/...", headers=self.headers)
# Task ends
Upvotes: 0