locust-cloud 1.21.5.dev2__tar.gz → 1.21.6__tar.gz

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.
Files changed (34) hide show
  1. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/PKG-INFO +1 -1
  2. locust_cloud-1.21.6/locust_cloud/actions.py +22 -0
  3. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/locust_cloud/args.py +29 -3
  4. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/locust_cloud/cloud.py +1 -19
  5. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/locust_cloud/docs/1-first-run.rst +1 -1
  6. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/.github/workflows/daily-check.yml +0 -0
  7. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/.github/workflows/tests.yml +0 -0
  8. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/.gitignore +0 -0
  9. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/.pre-commit-config.yaml +0 -0
  10. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/.vscode/extensions.json +0 -0
  11. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/.vscode/launch.json +0 -0
  12. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/.vscode/settings.json +0 -0
  13. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/LICENSE +0 -0
  14. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/README.md +0 -0
  15. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/locust_cloud/__init__.py +0 -0
  16. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/locust_cloud/apisession.py +0 -0
  17. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/locust_cloud/common.py +0 -0
  18. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/locust_cloud/docs/.gitignore +0 -0
  19. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/locust_cloud/docs/2-examples.rst +0 -0
  20. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/locust_cloud/docs/images/locust-cloud-screenshot.png +0 -0
  21. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/locust_cloud/docs/locust-cloud.rst +0 -0
  22. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/locust_cloud/input_events.py +0 -0
  23. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/locust_cloud/web_login.py +0 -0
  24. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/locust_cloud/websocket.py +0 -0
  25. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/locustfile.py +0 -0
  26. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/pyproject.toml +0 -0
  27. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/testdata/extra-files/extra.txt +0 -0
  28. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/testdata/extra-package/example/__init__.py +0 -0
  29. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/testdata/extra-package/setup.py +0 -0
  30. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/tests/args_test.py +0 -0
  31. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/tests/cloud_test.py +0 -0
  32. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/tests/web_login_test.py +0 -0
  33. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/tests/websocket_test.py +0 -0
  34. {locust_cloud-1.21.5.dev2 → locust_cloud-1.21.6}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: locust-cloud
3
- Version: 1.21.5.dev2
3
+ Version: 1.21.6
4
4
  Summary: Locust Cloud
5
5
  Project-URL: homepage, https://locust.cloud
6
6
  Project-URL: repository, https://github.com/locustcloud/locust-cloud
@@ -0,0 +1,22 @@
1
+ import logging
2
+
3
+ logger = logging.getLogger(__name__)
4
+
5
+
6
+ def delete(session):
7
+ try:
8
+ logger.info("Tearing down Locust cloud...")
9
+ response = session.delete(
10
+ "/teardown",
11
+ )
12
+
13
+ if response.status_code == 200:
14
+ logger.debug(f"Response message from teardown: {response.json()['message']}")
15
+ else:
16
+ logger.info(
17
+ f"Could not automatically tear down Locust Cloud: HTTP {response.status_code}/{response.reason} - Response: {response.text} - URL: {response.request.url}"
18
+ )
19
+ except KeyboardInterrupt:
20
+ pass # don't show nasty callstack
21
+ except Exception as e:
22
+ logger.error(f"Could not automatically tear down Locust Cloud: {e.__class__.__name__}:{e}")
@@ -8,6 +8,10 @@ import shutil
8
8
  import sys
9
9
  import tempfile
10
10
 
11
+ from locust_cloud.actions import delete
12
+ from locust_cloud.apisession import ApiSession
13
+ from locust_cloud.web_login import logout, web_login
14
+
11
15
  if sys.version_info >= (3, 11):
12
16
  import tomllib
13
17
  else:
@@ -162,20 +166,42 @@ class MergeToTransferEncodedZipFlat(MergeToTransferEncodedZip):
162
166
  setattr(namespace, self.dest, value)
163
167
 
164
168
 
169
+ class WebLogin(argparse.Action):
170
+ def __call__(self, parser, namespace, values, option_string=None):
171
+ web_login()
172
+ parser.exit()
173
+
174
+
175
+ class WebLogout(argparse.Action):
176
+ def __call__(self, parser, namespace, values, option_string=None):
177
+ logout()
178
+ parser.exit()
179
+
180
+
181
+ class StackTeardown(argparse.Action):
182
+ def __call__(self, parser, namespace, values, option_string=None):
183
+ session = ApiSession(namespace.non_interactive)
184
+ delete(session)
185
+ parser.exit()
186
+
187
+
165
188
  cloud_parser = configargparse.ArgumentParser(add_help=False)
166
189
  cloud_parser.add_argument(
167
190
  "--login",
168
- action="store_true",
191
+ nargs=0,
192
+ action=WebLogin,
169
193
  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.",
170
194
  )
171
195
  cloud_parser.add_argument(
172
196
  "--logout",
173
- action="store_true",
197
+ nargs=0,
198
+ action=WebLogout,
174
199
  help="Removes the authentication credentials",
175
200
  )
176
201
  cloud_parser.add_argument(
177
202
  "--delete",
178
- action="store_true",
203
+ nargs=0,
204
+ action=StackTeardown,
179
205
  help="Delete a running cluster. Useful if locust-cloud was killed/disconnected or if there was an error.",
180
206
  )
181
207
  cloud_parser.add_argument(
@@ -5,6 +5,7 @@ import webbrowser
5
5
  from threading import Thread
6
6
 
7
7
  import requests
8
+ from locust_cloud.actions import delete
8
9
  from locust_cloud.apisession import ApiSession
9
10
  from locust_cloud.args import combined_cloud_parser
10
11
  from locust_cloud.common import __version__
@@ -176,22 +177,3 @@ def main():
176
177
  finally:
177
178
  logger.debug("Shutting down websocket")
178
179
  websocket.shutdown()
179
-
180
-
181
- def delete(session):
182
- try:
183
- logger.info("Tearing down Locust cloud...")
184
- response = session.delete(
185
- "/teardown",
186
- )
187
-
188
- if response.status_code == 200:
189
- logger.debug(f"Response message from teardown: {response.json()['message']}")
190
- else:
191
- logger.info(
192
- f"Could not automatically tear down Locust Cloud: HTTP {response.status_code}/{response.reason} - Response: {response.text} - URL: {response.request.url}"
193
- )
194
- except KeyboardInterrupt:
195
- pass # don't show nasty callstack
196
- except Exception as e:
197
- logger.error(f"Could not automatically tear down Locust Cloud: {e.__class__.__name__}:{e}")
@@ -23,7 +23,7 @@ Then you can launch a distributed test using Locust Cloud:
23
23
  [2025-05-13 12:30:58,252] INFO: Deploying (us-east-1, 1.21.5)
24
24
  [2025-05-13 12:31:06,366] INFO: Waiting for load generators to be ready...
25
25
  [2025-05-13 10:31:11,119] master-lsdhr-8hwhs/INFO/locust.main: Starting Locust 2.37.1 (locust_exporter 1.18.4)
26
- [2025-05-13 10:31:11,120] master-lsdhr-8hwhs/INFO/locust.main: Starting web interface at https://us-east-1.webui.locust.cloud/your_customer, press enter to open your default browser.
26
+ [2025-05-13 10:31:11,120] master-lsdhr-8hwhs/INFO/locust.main: Starting web interface at https://us-east-1.webui.locust.cloud/your_company, press enter to open your default browser.
27
27
  [2025-05-13 10:31:11,760] master-lsdhr-8hwhs/INFO/locust.runners: worker-jdnf6-jl8qq_a45c04a8d925448ea647fdcda2e8cf80 (index 0) reported as ready. 1 workers connected.
28
28
  [2025-05-13 10:31:11,765] master-lsdhr-8hwhs/INFO/locust.runners: worker-jdnf6-pk8cl_6749cd6c0d244b3a9611d6a4e0a8d30b (index 1) reported as ready. 2 workers connected.
29
29
  ...