@@ -19,7 +19,7 @@ Below is a quick little example of a simple **locustfile.py**::
1919 l.client.get("/profile")
2020
2121 class UserBehavior(TaskSet):
22- tasks = {index:2, profile:1}
22+ tasks = {index: 2, profile: 1}
2323
2424 def on_start(self):
2525 login(self)
@@ -30,18 +30,20 @@ Below is a quick little example of a simple **locustfile.py**::
3030 max_wait = 9000
3131
3232
33- Here we define a number of locust tasks, which are normal Python callables that take one argument
34- (a Locust class instance). These tasks are gathered under a :py:class: `TaskSet <locust.core.TaskSet> `
35- class in the *tasks * attribute. Then we have a :py:class: `HttpLocust <locust.core.HttpLocust> ` class which
36- represents a User, where we define how long a simulated user should wait between executing tasks, as
37- well as what TaskSet class should define the user's "behaviour". TaskSets can be nested.
33+ Here we define a number of Locust tasks, which are normal Python callables that take one argument
34+ (a :py:class: `Locust <locust.core.Locust> ` class instance). These tasks are gathered under a
35+ :py:class: `TaskSet <locust.core.TaskSet> ` class in the *tasks * attribute. Then we have a
36+ :py:class: `HttpLocust <locust.core.HttpLocust> ` class which represents a user, where we define how
37+ long a simulated user should wait between executing tasks, as well as what
38+ :py:class: `TaskSet <locust.core.TaskSet> ` class should define the user's "behaviour".
39+ :py:class: `TaskSet <locust.core.TaskSet>`s can be nested.
3840
3941The :py:class:`HttpLocust <locust.core.HttpLocust> ` class inherits from the
40- :py:class: `Locust <locust.core.Locust> ` class, and it adds a client attribute which is an instance of
41- :py:class: `HttpSession <locust.clients.HttpSession> `, that can be used to make HTTP requests.
42+ :py:class: `Locust <locust.core.Locust> ` class, and it adds a client attribute which is an instance of
43+ :py:class: `HttpSession <locust.clients.HttpSession> ` that can be used to make HTTP requests.
4244
43- Another way we could declare tasks, which is usually more convenient, is to use the
44- @task decorator. The following code is equivalent to the above::
45+ Another way we could declare tasks, which is usually more convenient, is to use the
46+ `` @task `` decorator. The following code is equivalent to the above::
4547
4648 from locust import HttpLocust, TaskSet, task
4749
@@ -66,20 +68,20 @@ Another way we could declare tasks, which is usually more convenient, is to use
6668 min_wait = 5000
6769 max_wait = 9000
6870
69- The Locust class (as well as HttpLocust, since it's a subclass) also allows one to specify minimum
70- and maximum wait time—per simulated user—between the execution of tasks (* min_wait * and * max_wait *)
71- as well as other user behaviours.
71+ The :py:class: ` Locust <locust.core.Locust> ` class (as well as :py:class: ` HttpLocust <locust.core.HttpLocust> `
72+ since it's a subclass) also allows one to specify minimum and maximum wait time—per simulated
73+ user—between the execution of tasks (* min_wait * and * max_wait *) as well as other user behaviours.
7274
7375
7476Start Locust
7577============
7678
77- To run Locust with the above locust file, if it was named *locustfile.py * and located in the current working
79+ To run Locust with the above Locust file, if it was named *locustfile.py * and located in the current working
7880directory, we could run::
7981
8082 locust --host=http://example.com
8183
82- If the locust file is located under a subdirectory and/or named different than *locustfile.py *, specify
84+ If the Locust file is located under a subdirectory and/or named different than *locustfile.py *, specify
8385it using ``-f ``::
8486
8587 locust -f locust_files/my_locust_file.py --host=http://example.com
@@ -93,24 +95,24 @@ and then we would start an arbitrary number of slave processes::
9395
9496 locust -f locust_files/my_locust_file.py --slave --host=http://example.com
9597
96- If we want to run locust distributed on multiple machines we would also have to specify the master host when
97- starting the slaves (this is not needed when running locust distributed on a single machine, since the master
98+ If we want to run Locust distributed on multiple machines we would also have to specify the master host when
99+ starting the slaves (this is not needed when running Locust distributed on a single machine, since the master
98100host defaults to 127.0.0.1)::
99101
100102 locust -f locust_files/my_locust_file.py --slave --master-host=192.168.0.100 --host=http://example.com
101103
102104.. note ::
103105
104106 To see all available options type
105-
107+
106108 locust --help
107-
109+
108110
109111Open up Locust's web interface
110112==============================
111113
112- Once you've started Locust using one of the above command lines, you should open up a browser
113- and point it to http://127.0.0.1:8089 (if you are running Locust locally). Then you should be
114+ Once you've started Locust using one of the above command lines, you should open up a browser
115+ and point it to http://127.0.0.1:8089 (if you are running Locust locally). Then you should be
114116greeted with something like this:
115117
116118.. image :: images/webui-splash-screenshot.png
0 commit comments