locust-cloud 1.15.3__py3-none-any.whl → 1.16.1__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.
- locust_cloud/apisession.py +1 -3
- locust_cloud/args.py +1 -1
- locust_cloud/cloud.py +22 -6
- {locust_cloud-1.15.3.dist-info → locust_cloud-1.16.1.dist-info}/METADATA +1 -1
- locust_cloud-1.16.1.dist-info/RECORD +11 -0
- locust_cloud-1.15.3.dist-info/RECORD +0 -11
- {locust_cloud-1.15.3.dist-info → locust_cloud-1.16.1.dist-info}/WHEEL +0 -0
- {locust_cloud-1.15.3.dist-info → locust_cloud-1.16.1.dist-info}/entry_points.txt +0 -0
locust_cloud/apisession.py
CHANGED
@@ -66,7 +66,7 @@ class ApiSession(requests.Session):
|
|
66
66
|
self.headers["X-Client-Version"] = __version__
|
67
67
|
|
68
68
|
def __configure_for_region(self, region: str) -> None:
|
69
|
-
self.
|
69
|
+
self.region = region
|
70
70
|
self.api_url = get_api_url(region)
|
71
71
|
self.__login_url = f"{self.api_url}/auth/login"
|
72
72
|
|
@@ -76,8 +76,6 @@ class ApiSession(requests.Session):
|
|
76
76
|
if self.__expiry_time > time.time():
|
77
77
|
return
|
78
78
|
|
79
|
-
logger.info(f"Authenticating ({self.__region}, v{__version__})")
|
80
|
-
|
81
79
|
response = requests.post(
|
82
80
|
self.__login_url,
|
83
81
|
json={"user_sub_id": self.__sub, "refresh_token": self.__refresh_token},
|
locust_cloud/args.py
CHANGED
@@ -70,7 +70,7 @@ def transfer_encode(file_name: str, stream: IO[bytes]) -> dict[str, str]:
|
|
70
70
|
def transfer_encoded_file(file_path: str) -> dict[str, str]:
|
71
71
|
try:
|
72
72
|
with open(file_path, "rb") as f:
|
73
|
-
return transfer_encode(file_path, f)
|
73
|
+
return transfer_encode(os.path.basename(file_path), f)
|
74
74
|
except FileNotFoundError:
|
75
75
|
raise ArgumentTypeError(f"File not found: {file_path}")
|
76
76
|
|
locust_cloud/cloud.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import logging
|
2
2
|
import os
|
3
3
|
import sys
|
4
|
+
import time
|
4
5
|
import webbrowser
|
5
6
|
from threading import Thread
|
6
7
|
|
@@ -53,7 +54,7 @@ def main() -> None:
|
|
53
54
|
sys.exit()
|
54
55
|
|
55
56
|
try:
|
56
|
-
logger.info("Deploying
|
57
|
+
logger.info(f"Deploying ({session.region}, {__version__})")
|
57
58
|
locust_env_variables = [
|
58
59
|
{"name": env_variable, "value": os.environ[env_variable]}
|
59
60
|
for env_variable in os.environ
|
@@ -91,11 +92,24 @@ def main() -> None:
|
|
91
92
|
if options.extra_files:
|
92
93
|
payload["extra_files"] = options.extra_files
|
93
94
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
95
|
+
for attempt in range(1, 16):
|
96
|
+
try:
|
97
|
+
response = session.post("/deploy", json=payload)
|
98
|
+
js = response.json()
|
99
|
+
|
100
|
+
if response.status_code != 202:
|
101
|
+
# 202 means the stack is currently terminating, so we retry
|
102
|
+
break
|
103
|
+
|
104
|
+
if attempt == 1:
|
105
|
+
logger.info(js["message"])
|
106
|
+
|
107
|
+
time.sleep(2)
|
108
|
+
except requests.exceptions.RequestException as e:
|
109
|
+
logger.error(f"Failed to deploy the load generators: {e}")
|
110
|
+
sys.exit(1)
|
111
|
+
else:
|
112
|
+
logger.error("Your Locust instance is still running, run locust-cloud --delete")
|
99
113
|
sys.exit(1)
|
100
114
|
|
101
115
|
if response.status_code != 200:
|
@@ -165,6 +179,8 @@ def delete(session):
|
|
165
179
|
logger.info(
|
166
180
|
f"Could not automatically tear down Locust Cloud: HTTP {response.status_code}/{response.reason} - Response: {response.text} - URL: {response.request.url}"
|
167
181
|
)
|
182
|
+
except KeyboardInterrupt:
|
183
|
+
pass # don't show nasty callstack
|
168
184
|
except Exception as e:
|
169
185
|
logger.error(f"Could not automatically tear down Locust Cloud: {e.__class__.__name__}:{e}")
|
170
186
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
locust_cloud/apisession.py,sha256=kCr271_l0IeMGw0L563mOecqPJj4OD9h2J3vxCM5zYQ,4015
|
2
|
+
locust_cloud/args.py,sha256=4U_bZaEH1UJR8C7_bH_sX1DRB8m6WBcJh-ewhilFQX0,7118
|
3
|
+
locust_cloud/cloud.py,sha256=kih2Qtddry0dxmGylxXQdrw4SPTwx6k6YN0ur3u47Qc,6144
|
4
|
+
locust_cloud/common.py,sha256=cFrDVKpi9OEmH6giOuj9HoIUFSBArixNtNHzZIgDvPE,992
|
5
|
+
locust_cloud/input_events.py,sha256=MyxccgboHByICuK6VpQCCJhZQqTZAacNmkSpw-gxBEw,3420
|
6
|
+
locust_cloud/web_login.py,sha256=1j2AQoEM6XVSDtE1q0Ryrs4jFEx07r9IQfZCoFAQXJg,2400
|
7
|
+
locust_cloud/websocket.py,sha256=9Q7nTFuAwVhgW74DlJNcHTZXOQ1drsXi8hX9ciZhWlQ,8998
|
8
|
+
locust_cloud-1.16.1.dist-info/METADATA,sha256=4EHCv-Hpo9NR-IThvTMiJR9t5EWfdjARKBt2V2QApBQ,528
|
9
|
+
locust_cloud-1.16.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
10
|
+
locust_cloud-1.16.1.dist-info/entry_points.txt,sha256=PGyAb4e3aTsGS3N3VGShDl6VzJaXy7QwsEgsLOC7V00,57
|
11
|
+
locust_cloud-1.16.1.dist-info/RECORD,,
|
@@ -1,11 +0,0 @@
|
|
1
|
-
locust_cloud/apisession.py,sha256=AoU0FGQbyH2qbaTmdyoIMBd_lwZimLtihK0gnpAV6c0,4091
|
2
|
-
locust_cloud/args.py,sha256=1SaMQ16f_3vaNqnAbjFiBL-6ietp1-qfV2LUjBk6b8k,7100
|
3
|
-
locust_cloud/cloud.py,sha256=OaUE0bnlRGgLTKhdDCMnonaT-h2pop_cAfcOFOLcwng,5581
|
4
|
-
locust_cloud/common.py,sha256=cFrDVKpi9OEmH6giOuj9HoIUFSBArixNtNHzZIgDvPE,992
|
5
|
-
locust_cloud/input_events.py,sha256=MyxccgboHByICuK6VpQCCJhZQqTZAacNmkSpw-gxBEw,3420
|
6
|
-
locust_cloud/web_login.py,sha256=1j2AQoEM6XVSDtE1q0Ryrs4jFEx07r9IQfZCoFAQXJg,2400
|
7
|
-
locust_cloud/websocket.py,sha256=9Q7nTFuAwVhgW74DlJNcHTZXOQ1drsXi8hX9ciZhWlQ,8998
|
8
|
-
locust_cloud-1.15.3.dist-info/METADATA,sha256=pOgPOJAK1gl7bAYIq_JGG29atMHdiYIAzkCfa0YHDvg,528
|
9
|
-
locust_cloud-1.15.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
10
|
-
locust_cloud-1.15.3.dist-info/entry_points.txt,sha256=PGyAb4e3aTsGS3N3VGShDl6VzJaXy7QwsEgsLOC7V00,57
|
11
|
-
locust_cloud-1.15.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|