Skip to content

Commit

Permalink
Added the description of the 'fixed_count' property into the document…
Browse files Browse the repository at this point in the history
…ation.
  • Loading branch information
EzR1d3r committed Jan 20, 2022
1 parent ccba097 commit a47a733
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ User class
============

.. autoclass:: locust.User
:members: wait_time, tasks, weight, abstract, on_start, on_stop, wait, context, environment
:members: wait_time, tasks, weight, fixed_count, abstract, on_start, on_stop, wait, context, environment

HttpUser class
================
Expand Down
21 changes: 20 additions & 1 deletion docs/writing-a-locustfile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ For example, the following User class would sleep for one second, then two, then
...
weight attribute
weight and fixed_count attributes
----------------

If more than one user class exists in the file, and no user classes are specified on the command line,
Expand All @@ -204,6 +204,25 @@ classes. Say for example, web users are three times more likely than mobile user
weight = 1
...
Also you can set the :py:attr:`fixed_count <locust.User.fixed_count>` attribute.
In this case the weight property will be ignored and the exact count users will be spawned.
These users are spawned first. In the below example the only instance of AdminUser
will be spawned to make some specific work with more accurate control
of request count independently of total user count.

.. code-block:: python
class AdminUser(User):
wait_time = constant(600)
fixed_count = 1
@task
def restart_app(self):
...
class WebUser(User):
...
host attribute
--------------
Expand Down
6 changes: 3 additions & 3 deletions locust/user/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ class ForumPage(TaskSet):

fixed_count = 0
"""
If the value > 0, the weight property will be ignored and the <fixed_count> users will be spawned.
These users are spawed first. If target count is not enougth to spawn all <fixed_count> users,
the final count of each user is undefined.
If the value > 0, the weight property will be ignored and the 'fixed_count'-instances will be spawned.
These Users are spawned first. If the total target count (specified by the --users arg) is not enougth
to spawn all instances of each User class with the defined property, the final count of each User is undefined.
"""

abstract = True
Expand Down

0 comments on commit a47a733

Please sign in to comment.