locust-cloud 1.19.4__py3-none-any.whl → 1.19.6.dev10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- docs/.gitignore +1 -0
- docs/examples.rst +157 -0
- docs/first-run.rst +30 -0
- docs/images/locust-cloud-screenshot.png +0 -0
- docs/list-available-options.rst +13 -0
- locust_cloud/args.py +4 -4
- {locust_cloud-1.19.4.dist-info → locust_cloud-1.19.6.dev10.dist-info}/METADATA +4 -8
- locust_cloud-1.19.6.dev10.dist-info/RECORD +18 -0
- locust_cloud-1.19.4.dist-info/RECORD +0 -13
- {locust_cloud-1.19.4.dist-info → locust_cloud-1.19.6.dev10.dist-info}/WHEEL +0 -0
- {locust_cloud-1.19.4.dist-info → locust_cloud-1.19.6.dev10.dist-info}/entry_points.txt +0 -0
- {locust_cloud-1.19.4.dist-info → locust_cloud-1.19.6.dev10.dist-info}/licenses/LICENSE +0 -0
docs/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
_build/**
|
docs/examples.rst
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
########
|
2
|
+
Examples
|
3
|
+
########
|
4
|
+
|
5
|
+
Locustfile and mock server
|
6
|
+
==========================
|
7
|
+
|
8
|
+
If you're learning Locust and want to try it out, Locust Cloud has its own demo mock server you can test against, using the locustfile below. Pass ``--mock-server`` to spawn the mock next to your load generators and set Locust target hostname accordingly.
|
9
|
+
|
10
|
+
.. code-block:: console
|
11
|
+
|
12
|
+
$ locust --cloud -f my_locustfile.py --users 100 --mock-server
|
13
|
+
|
14
|
+
|
15
|
+
.. code-block:: python
|
16
|
+
|
17
|
+
from locust import HttpUser, task
|
18
|
+
|
19
|
+
class MyUser(HttpUser):
|
20
|
+
@task
|
21
|
+
def t(self):
|
22
|
+
self.client.post("/authenticate", json={"username": "foo", "password": "bar"})
|
23
|
+
for product_id in [1, 2, 42]:
|
24
|
+
self.client.get(f"/product/{product_id}", name="/product/{product_id}")
|
25
|
+
self.client.post("/cart/add", json={"productId": product_id})
|
26
|
+
self.client.post("/checkout/confirm")
|
27
|
+
self.client.get("/this_does_not_exist")
|
28
|
+
|
29
|
+
|
30
|
+
Your results should be something like this (the mock intentionally has some concurrency issues, so you'll get steadily rising response times as the load increases):
|
31
|
+
|
32
|
+
.. image:: images/locust-cloud-screenshot.png
|
33
|
+
|
34
|
+
.. note::
|
35
|
+
Don't use the mock server option when you are doing normal load tests. It is only meant as an example and serves no other purpose.
|
36
|
+
|
37
|
+
|
38
|
+
Passing options to Locust
|
39
|
+
=========================
|
40
|
+
|
41
|
+
Any parameters specified on command line that are not recognized by ``locust-cloud`` will be passed along to Locust. This allows for a seamless transition from local runs to cloud runs.
|
42
|
+
|
43
|
+
Here's how to run a 100 User test, start immediately, run for 60 seconds,
|
44
|
+
quit 1s after finishing and print statistics to the console while running:
|
45
|
+
|
46
|
+
.. code-block:: console
|
47
|
+
|
48
|
+
$ locust --cloud --users 100 --autostart --run-time 60s --autoquit 1 --print-stats
|
49
|
+
[LOCUST-CLOUD] INFO: Authenticating (eu-north-1, v1.11.2.dev23)
|
50
|
+
[LOCUST-CLOUD] INFO: Deploying load generators
|
51
|
+
[LOCUST-CLOUD] INFO: Waiting for pods to be ready...
|
52
|
+
[2024-11-22 11:49:20,833] master-lb6vv-zxp64/INFO/locust.main: Starting Locust 2.32.4.dev14 (locust-cloud 1.11.2.dev23)
|
53
|
+
[2024-11-22 11:49:20,835] master-lb6vv-zxp64/INFO/locust.main: Starting web interface at https://locust.webui.locust.cloud/702ca98c-60e1-706c-9523-77d5c10ba5d4-free
|
54
|
+
[2024-11-22 11:49:23,515] master-lb6vv-zxp64/INFO/locust.runners: worker-xn7mv-4zkh5_3b4ee8708ea140eda830ff00364af204 (index 0) reported as ready. 1 workers connected.
|
55
|
+
[2024-11-22 11:49:24,018] master-lb6vv-zxp64/INFO/locust.main: Run time limit set to 60 seconds
|
56
|
+
[2024-11-22 11:49:24,019] master-lb6vv-zxp64/INFO/locust.runners: Sending spawn jobs of 100 users at 1.00 spawn rate to 1 ready workers
|
57
|
+
Type Name # reqs # fails | Avg Min Max Med | req/s failures/s
|
58
|
+
--------|-------------------------------------------|-------|-------------|-------|-------|-------|-------|--------|-----------
|
59
|
+
POST /authenticate 2 0(0.00%) | 1012 1010 1014 1010 | 0.00 0.00
|
60
|
+
GET /product/{product_id} 1 0(0.00%) | 505 505 505 505 | 0.00 0.00
|
61
|
+
--------|-------------------------------------------|-------|-------------|-------|-------|-------|-------|--------|-----------
|
62
|
+
Aggregated 3 0(0.00%) | 843 505 1014 1000 | 0.00 0.00
|
63
|
+
Type Name # reqs # fails | Avg Min Max Med | req/s failures/s
|
64
|
+
--------|-------------------------------------------|-------|-------------|-------|-------|-------|-------|--------|-----------
|
65
|
+
POST /authenticate 5 0(0.00%) | 1015 1010 1021 1010 | 0.67 0.00
|
66
|
+
POST /cart/add 5 0(0.00%) | 1005 1004 1007 1004 | 0.33 0.00
|
67
|
+
GET /product/{product_id} 8 0(0.00%) | 508 504 520 510 | 0.67 0.00
|
68
|
+
--------|-------------------------------------------|-------|-------------|-------|-------|-------|-------|--------|-----------
|
69
|
+
Aggregated 18 0(0.00%) | 787 504 1021 1000 | 1.67 0.00
|
70
|
+
Type Name # reqs # fails | Avg Min Max Med | req/s failures/s
|
71
|
+
--------|-------------------------------------------|-------|-------------|-------|-------|-------|-------|--------|-----------
|
72
|
+
POST /authenticate 9 0(0.00%) | 1013 1005 1021 1005 | 0.83 0.00
|
73
|
+
POST /cart/add 14 0(0.00%) | 1005 1003 1007 1003 | 1.17 0.00
|
74
|
+
POST /checkout/confirm 2 0(0.00%) | 1005 1005 1005 1005 | 0.00 0.00
|
75
|
+
GET /product/{product_id} 18 0(0.00%) | 507 503 520 510 | 1.67 0.00
|
76
|
+
GET /this_does_not_exist 2 2(100.00%) | 4 3 6 3 | 0.00 0.00
|
77
|
+
...
|
78
|
+
[2024-11-22 11:50:24,019] master-lb6vv-zxp64/INFO/locust.main: --run-time limit reached, stopping test
|
79
|
+
[2024-11-22 11:50:27,151] master-lb6vv-zxp64/INFO/locust.main: Shutting down (exit code 0)
|
80
|
+
Type Name # reqs # fails | Avg Min Max Med | req/s failures/s
|
81
|
+
--------|-------------------------------------------|-------|-------------|-------|-------|-------|-------|--------|-----------
|
82
|
+
POST /authenticate 112 0(0.00%) | 2586 1003 4553 2500 | 1.89 0.00
|
83
|
+
POST /cart/add 239 0(0.00%) | 2674 1003 4989 2500 | 4.03 0.00
|
84
|
+
POST /checkout/confirm 60 0(0.00%) | 2633 1003 4521 2500 | 1.01 0.00
|
85
|
+
GET /product/{product_id} 262 0(0.00%) | 2156 503 4489 2000 | 4.41 0.00
|
86
|
+
GET /this_does_not_exist 60 60(100.00%) | 4 2 8 4 | 1.01 1.01
|
87
|
+
--------|-------------------------------------------|-------|-------------|-------|-------|-------|-------|--------|-----------
|
88
|
+
Aggregated 733 60(8.19%) | 2254 2 4989 2100 | 12.35 1.01
|
89
|
+
...
|
90
|
+
Error report
|
91
|
+
# occurrences Error
|
92
|
+
------------------|------------------------------------------------------------------------------------------------------------
|
93
|
+
60 GET /this_does_not_exist: HTTPError('404 Client Error: NOT FOUND for url: /this_does_not_exist')
|
94
|
+
------------------|------------------------------------------------------------------------------------------------------------
|
95
|
+
[LOCUST-CLOUD] INFO: Tearing down Locust cloud...
|
96
|
+
[LOCUST-CLOUD] INFO: Done! ✨
|
97
|
+
|
98
|
+
You can also use standard Locust env vars in the same fashion:
|
99
|
+
|
100
|
+
.. code-block::
|
101
|
+
|
102
|
+
LOCUST_USERS=100 LOCUST_AUTOSTART=1 ... locust --cloud
|
103
|
+
|
104
|
+
|
105
|
+
Automated runs (CI)
|
106
|
+
===================
|
107
|
+
|
108
|
+
If you want to run ``locust-cloud`` in a CI/CD environment, where an interactive login is not possible, you can set the ``--non-interactive`` flag or ``LOCUSTCLOUD_NON_INTERACTIVE`` environment variable. Then ``locust-cloud`` will use credentials specified environment variables instead.
|
109
|
+
|
110
|
+
Simply make sure to export the corrent environment variables before running the command and things will work.
|
111
|
+
|
112
|
+
.. code-block:: console
|
113
|
+
|
114
|
+
export LOCUSTCLOUD_NON_INTERACTIVE=1
|
115
|
+
export LOCUSTCLOUD_USERNAME='your@email.com'
|
116
|
+
export LOCUSTCLOUD_PASSWORD='yourpassword'
|
117
|
+
export LOCUSTCLOUD_REGION='us-east-1'
|
118
|
+
...
|
119
|
+
|
120
|
+
Typically you will also want to specify the standard Locust parameters ``--headless`` (or ``--autostart``) and ``--run-time`` as shown in the previous example. Here's a full example of how you might set it up in a GitHub action:
|
121
|
+
|
122
|
+
.. code-block:: yaml
|
123
|
+
|
124
|
+
env:
|
125
|
+
LOCUSTCLOUD_USERNAME: ${{ secrets.LOCUSTCLOUD_USERNAME }}
|
126
|
+
LOCUSTCLOUD_PASSWORD: ${{ secrets.LOCUSTCLOUD_PASSWORD }}
|
127
|
+
LOCUSTCLOUD_REGION: eu-north-1
|
128
|
+
LOCUSTCLOUD_NON_INTERACTIVE: 1
|
129
|
+
PYTHONUNBUFFERED: 1 # ensure we see output right away
|
130
|
+
|
131
|
+
jobs:
|
132
|
+
build:
|
133
|
+
runs-on: ubuntu-latest
|
134
|
+
timeout-minutes: 15
|
135
|
+
steps:
|
136
|
+
- uses: actions/checkout@v4
|
137
|
+
- uses: actions/setup-python@v5
|
138
|
+
with:
|
139
|
+
python-version: '3.11'
|
140
|
+
- run: pip install locust
|
141
|
+
- run: locust --cloud -f my_locustfile.py --headless --run-time 5m
|
142
|
+
|
143
|
+
|
144
|
+
Extra python packages
|
145
|
+
=====================
|
146
|
+
|
147
|
+
If your locustfile needs some additional Python packages, you can install them by specifying a `requirements.txt <https://pip.pypa.io/en/stable/reference/requirements-file-format/>`_ file:
|
148
|
+
|
149
|
+
.. code-block:: console
|
150
|
+
|
151
|
+
locust --cloud -f my_locustfile.py --requirements requirements.txt
|
152
|
+
|
153
|
+
|
154
|
+
View dashboard / previous test runs
|
155
|
+
===================================
|
156
|
+
|
157
|
+
You can examine the results from previous test runs (without needing to start your load generators) from your `Locust Cloud dashboard <https://auth.eu-north-1.locust.cloud/region-select>`_.
|
docs/first-run.rst
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
#########
|
2
|
+
First run
|
3
|
+
#########
|
4
|
+
|
5
|
+
1. Log in
|
6
|
+
|
7
|
+
.. code-block:: console
|
8
|
+
|
9
|
+
$ locust --cloud --login
|
10
|
+
Enter the number for the region to authenticate against
|
11
|
+
|
12
|
+
1. us-east-1
|
13
|
+
2. eu-north-1
|
14
|
+
|
15
|
+
> 1
|
16
|
+
|
17
|
+
Attempting to automatically open the SSO authorization page in your default browser.
|
18
|
+
...
|
19
|
+
|
20
|
+
.. note::
|
21
|
+
After logging in, an API token will be stored on your machine, and you will not need to log in until it expires.
|
22
|
+
|
23
|
+
2. Run a load test
|
24
|
+
|
25
|
+
.. code-block:: console
|
26
|
+
|
27
|
+
$ locust --cloud -f my_locustfile.py --users 100 # ... other regular locust parameters
|
28
|
+
[LOCUST-CLOUD] INFO: Deploying load generators
|
29
|
+
[LOCUST-CLOUD] INFO: Waiting for load generators to be ready...
|
30
|
+
...
|
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#################
|
2
|
+
Available options
|
3
|
+
#################
|
4
|
+
|
5
|
+
Command Line Options
|
6
|
+
====================
|
7
|
+
|
8
|
+
Locust Cloud is configured mainly through command line arguments.
|
9
|
+
|
10
|
+
Here's a list of all the available options:
|
11
|
+
|
12
|
+
.. this file is generated from locust core
|
13
|
+
.. include:: locust-cloud-options.txt
|
locust_cloud/args.py
CHANGED
@@ -113,7 +113,7 @@ cloud_parser = configargparse.ArgumentParser(add_help=False)
|
|
113
113
|
cloud_parser.add_argument(
|
114
114
|
"--login",
|
115
115
|
action="store_true",
|
116
|
-
help="Launch an interactive session to authenticate your user.\nOnce completed your credentials will be stored and automatically refreshed for quite a long time.\nOnce those
|
116
|
+
help="Launch an interactive session to authenticate your user.\nOnce completed your credentials will be stored and automatically refreshed for quite a long time.\nOnce those expire you will be prompted to perform another login.",
|
117
117
|
)
|
118
118
|
cloud_parser.add_argument(
|
119
119
|
"--delete",
|
@@ -149,20 +149,20 @@ cloud_parser.add_argument(
|
|
149
149
|
"--mock-server",
|
150
150
|
action="store_true",
|
151
151
|
default=False,
|
152
|
-
help="Start a demo mock service and set --host parameter to point Locust towards it",
|
152
|
+
help="Start a demo mock service and set --host parameter to point Locust towards it.",
|
153
153
|
)
|
154
154
|
cloud_parser.add_argument(
|
155
155
|
"--extra-files",
|
156
156
|
action=MergeToTransferEncodedZip,
|
157
157
|
nargs="*",
|
158
158
|
type=valid_extra_files_path,
|
159
|
-
help="A list of extra files or directories to upload. Space-separated, e.g.
|
159
|
+
help="A list of extra files or directories to upload. Space-separated, e.g. `--extra-files testdata.csv *.py my-directory/`.",
|
160
160
|
)
|
161
161
|
cloud_parser.add_argument(
|
162
162
|
"--testrun-tags",
|
163
163
|
nargs="*",
|
164
164
|
default=None,
|
165
|
-
help="A list of tags that can be used to filter testruns",
|
165
|
+
help="A list of tags that can be used to filter testruns.",
|
166
166
|
)
|
167
167
|
|
168
168
|
combined_cloud_parser = configargparse.ArgumentParser(
|
@@ -1,20 +1,16 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: locust-cloud
|
3
|
-
Version: 1.19.
|
3
|
+
Version: 1.19.6.dev10
|
4
4
|
Summary: Locust Cloud
|
5
5
|
Project-URL: homepage, https://locust.cloud
|
6
6
|
Project-URL: repository, https://github.com/locustcloud/locust-cloud
|
7
7
|
License: MIT
|
8
8
|
License-File: LICENSE
|
9
9
|
Requires-Python: >=3.10
|
10
|
-
Requires-Dist: configargparse==1.7
|
11
|
-
Requires-Dist: gevent>=24.11.1
|
12
10
|
Requires-Dist: locust>=2.35.0
|
13
|
-
Requires-Dist: platformdirs
|
14
|
-
Requires-Dist: pyjwt
|
15
|
-
Requires-Dist: python-socketio[client]==5.
|
16
|
-
Requires-Dist: requests==2.32.3
|
17
|
-
Requires-Dist: tomli>=1.1.0; python_version < '3.11'
|
11
|
+
Requires-Dist: platformdirs<5.0.0,>=4.3.6
|
12
|
+
Requires-Dist: pyjwt<3.0,>=2.0
|
13
|
+
Requires-Dist: python-socketio[client]==5.13.0
|
18
14
|
Description-Content-Type: text/markdown
|
19
15
|
|
20
16
|
# Locust Cloud
|
@@ -0,0 +1,18 @@
|
|
1
|
+
docs/.gitignore,sha256=ghNPcjYkjQXNS_eVmu2hQFhq6FIUliAD1O2CJhulS2o,10
|
2
|
+
docs/examples.rst,sha256=RublnAK3jHRsEtbJAr1y2NEEoN0YAjkzP1np-7tJ3aE,9565
|
3
|
+
docs/first-run.rst,sha256=dYYVxVb1RlWPNvhE98H1D_mzTJ1H2NWNn435nag3_jA,691
|
4
|
+
docs/list-available-options.rst,sha256=2bbVkWFT_PePixQtdppZ2AWc_uPi4vBv9p1M5jbdxFM,291
|
5
|
+
docs/images/locust-cloud-screenshot.png,sha256=ag0IxBi-40VexC84MApol1GCgRCL2h-l8NQDTMaeTyE,477350
|
6
|
+
locust_cloud/__init__.py,sha256=9USe4yHuvpP5xrXm0dVsi08pu2l5TcjxQl6Pei8w3lk,713
|
7
|
+
locust_cloud/apisession.py,sha256=kCr271_l0IeMGw0L563mOecqPJj4OD9h2J3vxCM5zYQ,4015
|
8
|
+
locust_cloud/args.py,sha256=jBAKDNckEfP5v_2rKEMWWiWK_sjW6kX3sNgzgQkGk0Q,6974
|
9
|
+
locust_cloud/cloud.py,sha256=Ox2BNQfeVSbLN67mp5yl4ZeSFqfEsPef0H5Jxy5QMU8,6071
|
10
|
+
locust_cloud/common.py,sha256=cFrDVKpi9OEmH6giOuj9HoIUFSBArixNtNHzZIgDvPE,992
|
11
|
+
locust_cloud/input_events.py,sha256=MyxccgboHByICuK6VpQCCJhZQqTZAacNmkSpw-gxBEw,3420
|
12
|
+
locust_cloud/web_login.py,sha256=1j2AQoEM6XVSDtE1q0Ryrs4jFEx07r9IQfZCoFAQXJg,2400
|
13
|
+
locust_cloud/websocket.py,sha256=9Q7nTFuAwVhgW74DlJNcHTZXOQ1drsXi8hX9ciZhWlQ,8998
|
14
|
+
locust_cloud-1.19.6.dev10.dist-info/METADATA,sha256=ErlJa_zEhG47vHphZUWGjAK3q1lqN7Q51ceNhW7KFGc,582
|
15
|
+
locust_cloud-1.19.6.dev10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
16
|
+
locust_cloud-1.19.6.dev10.dist-info/entry_points.txt,sha256=PGyAb4e3aTsGS3N3VGShDl6VzJaXy7QwsEgsLOC7V00,57
|
17
|
+
locust_cloud-1.19.6.dev10.dist-info/licenses/LICENSE,sha256=Ow6fY6ta4KIjdlWalmxGvRP8yLmetvkbkl-SdHMjPIs,1093
|
18
|
+
locust_cloud-1.19.6.dev10.dist-info/RECORD,,
|
@@ -1,13 +0,0 @@
|
|
1
|
-
locust_cloud/__init__.py,sha256=9USe4yHuvpP5xrXm0dVsi08pu2l5TcjxQl6Pei8w3lk,713
|
2
|
-
locust_cloud/apisession.py,sha256=kCr271_l0IeMGw0L563mOecqPJj4OD9h2J3vxCM5zYQ,4015
|
3
|
-
locust_cloud/args.py,sha256=6PLJYmy1lr1qYQR4elsIhws0wJwc4_heS_xbTibO4Yw,6970
|
4
|
-
locust_cloud/cloud.py,sha256=Ox2BNQfeVSbLN67mp5yl4ZeSFqfEsPef0H5Jxy5QMU8,6071
|
5
|
-
locust_cloud/common.py,sha256=cFrDVKpi9OEmH6giOuj9HoIUFSBArixNtNHzZIgDvPE,992
|
6
|
-
locust_cloud/input_events.py,sha256=MyxccgboHByICuK6VpQCCJhZQqTZAacNmkSpw-gxBEw,3420
|
7
|
-
locust_cloud/web_login.py,sha256=1j2AQoEM6XVSDtE1q0Ryrs4jFEx07r9IQfZCoFAQXJg,2400
|
8
|
-
locust_cloud/websocket.py,sha256=9Q7nTFuAwVhgW74DlJNcHTZXOQ1drsXi8hX9ciZhWlQ,8998
|
9
|
-
locust_cloud-1.19.4.dist-info/METADATA,sha256=D4h_fWHJxqnhrRcxdUKq73bZVy1hb7lbMTbylAaxejw,715
|
10
|
-
locust_cloud-1.19.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
11
|
-
locust_cloud-1.19.4.dist-info/entry_points.txt,sha256=PGyAb4e3aTsGS3N3VGShDl6VzJaXy7QwsEgsLOC7V00,57
|
12
|
-
locust_cloud-1.19.4.dist-info/licenses/LICENSE,sha256=Ow6fY6ta4KIjdlWalmxGvRP8yLmetvkbkl-SdHMjPIs,1093
|
13
|
-
locust_cloud-1.19.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|