Skip to content

Instantly share code, notes, and snippets.

@hirokiky
Created June 8, 2015 00:31
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hirokiky/5d877f3a9b208e36df6c to your computer and use it in GitHub Desktop.
Save hirokiky/5d877f3a9b208e36df6c to your computer and use it in GitHub Desktop.
Dynamic locust tasks

Dynamic tasks for locust.io

Install

pip install locustio

Try it

locust -f locustfile.py --host http://hirokiky.org --no-web -c 1 -r 1
from locust import TaskSet, HttpLocust
def factory(path):
def _locust(locust):
locust.client.get(path)
return _locust
mytasks = {
factory('/'): 5,
}
class MyTastSet(TaskSet):
tasks = mytasks
class MyLocust(HttpLocust):
task_set = MyTastSet
min_wait = 1000
max_wait = 5000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment