locust 2.18.2.dev5__py3-none-any.whl → 2.18.3__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.
Potentially problematic release.
This version of locust might be problematic. Click here for more details.
- locust/_version.py +2 -2
- locust/html.py +13 -6
- locust/main.py +4 -4
- locust/web.py +5 -14
- locust/webui/dist/assets/{index-b46361c2.js → index-15a4a1a0.js} +52 -52
- locust/webui/dist/index.html +1 -1
- {locust-2.18.2.dev5.dist-info → locust-2.18.3.dist-info}/METADATA +6 -9
- {locust-2.18.2.dev5.dist-info → locust-2.18.3.dist-info}/RECORD +12 -12
- {locust-2.18.2.dev5.dist-info → locust-2.18.3.dist-info}/LICENSE +0 -0
- {locust-2.18.2.dev5.dist-info → locust-2.18.3.dist-info}/WHEEL +0 -0
- {locust-2.18.2.dev5.dist-info → locust-2.18.3.dist-info}/entry_points.txt +0 -0
- {locust-2.18.2.dev5.dist-info → locust-2.18.3.dist-info}/top_level.txt +0 -0
locust/_version.py
CHANGED
@@ -12,5 +12,5 @@ __version__: str
|
|
12
12
|
__version_tuple__: VERSION_TUPLE
|
13
13
|
version_tuple: VERSION_TUPLE
|
14
14
|
|
15
|
-
__version__ = version = '2.18.
|
16
|
-
__version_tuple__ = version_tuple = (2, 18,
|
15
|
+
__version__ = version = '2.18.3'
|
16
|
+
__version_tuple__ = version_tuple = (2, 18, 3)
|
locust/html.py
CHANGED
@@ -10,26 +10,31 @@ from .user.inspectuser import get_ratio
|
|
10
10
|
from html import escape
|
11
11
|
from json import dumps
|
12
12
|
from .runners import MasterRunner, STATE_STOPPED, STATE_STOPPING
|
13
|
-
from flask import render_template as flask_render_template
|
14
13
|
|
15
14
|
|
16
15
|
PERCENTILES_FOR_HTML_REPORT = [0.50, 0.6, 0.7, 0.8, 0.9, 0.95, 0.99, 1.0]
|
17
16
|
|
18
17
|
|
19
|
-
def render_template(file, **kwargs):
|
20
|
-
|
21
|
-
env = Environment(loader=FileSystemLoader(templates_path), extensions=["jinja2.ext.do"])
|
18
|
+
def render_template(file, template_path, **kwargs):
|
19
|
+
env = Environment(loader=FileSystemLoader(template_path), extensions=["jinja2.ext.do"])
|
22
20
|
template = env.get_template(file)
|
23
21
|
return template.render(**kwargs)
|
24
22
|
|
25
23
|
|
26
24
|
def get_html_report(
|
27
25
|
environment,
|
28
|
-
static_path=os.path.join(os.path.dirname(__file__), "static"),
|
29
26
|
show_download_link=True,
|
30
27
|
use_modern_ui=False,
|
31
28
|
theme="",
|
32
29
|
):
|
30
|
+
root_path = os.path.dirname(os.path.abspath(__file__))
|
31
|
+
if use_modern_ui:
|
32
|
+
static_path = os.path.join(root_path, "webui", "dist", "assets")
|
33
|
+
template_path = os.path.join(root_path, "webui", "dist")
|
34
|
+
else:
|
35
|
+
static_path = os.path.join(root_path, "static")
|
36
|
+
template_path = os.path.join(root_path, "templates")
|
37
|
+
|
33
38
|
stats = environment.runner.stats
|
34
39
|
|
35
40
|
start_ts = stats.start_time
|
@@ -94,8 +99,9 @@ def get_html_report(
|
|
94
99
|
}
|
95
100
|
|
96
101
|
if use_modern_ui:
|
97
|
-
res =
|
102
|
+
res = render_template(
|
98
103
|
"report.html",
|
104
|
+
template_path,
|
99
105
|
template_args={
|
100
106
|
"is_report": True,
|
101
107
|
"requests_statistics": [stat.to_dict(escape_string_values=True) for stat in requests_statistics],
|
@@ -128,6 +134,7 @@ def get_html_report(
|
|
128
134
|
else:
|
129
135
|
res = render_template(
|
130
136
|
"report.html",
|
137
|
+
template_path,
|
131
138
|
int=int,
|
132
139
|
round=round,
|
133
140
|
escape=escape,
|
locust/main.py
CHANGED
@@ -495,8 +495,8 @@ See https://github.com/locustio/locust/wiki/Installation#increasing-maximum-numb
|
|
495
495
|
logger.info("Got SIGTERM signal")
|
496
496
|
shutdown()
|
497
497
|
|
498
|
-
def save_html_report():
|
499
|
-
html_report = get_html_report(environment, show_download_link=False)
|
498
|
+
def save_html_report(use_modern_ui=False):
|
499
|
+
html_report = get_html_report(environment, show_download_link=False, use_modern_ui=use_modern_ui)
|
500
500
|
logger.info("writing html report to file: %s", options.html_file)
|
501
501
|
with open(options.html_file, "w", encoding="utf-8") as file:
|
502
502
|
file.write(html_report)
|
@@ -512,10 +512,10 @@ See https://github.com/locustio/locust/wiki/Installation#increasing-maximum-numb
|
|
512
512
|
|
513
513
|
main_greenlet.join()
|
514
514
|
if options.html_file:
|
515
|
-
save_html_report()
|
515
|
+
save_html_report(options.modern_ui)
|
516
516
|
except KeyboardInterrupt:
|
517
517
|
if options.html_file:
|
518
|
-
save_html_report()
|
518
|
+
save_html_report(options.modern_ui)
|
519
519
|
except Exception:
|
520
520
|
raise
|
521
521
|
shutdown()
|
locust/web.py
CHANGED
@@ -110,9 +110,9 @@ class WebUI:
|
|
110
110
|
self.app = app
|
111
111
|
app.jinja_env.add_extension("jinja2.ext.do")
|
112
112
|
app.debug = True
|
113
|
-
|
114
|
-
app.root_path =
|
115
|
-
self.webui_build_path =
|
113
|
+
root_path = os.path.dirname(os.path.abspath(__file__))
|
114
|
+
app.root_path = root_path
|
115
|
+
self.webui_build_path = os.path.join(root_path, "webui", "dist")
|
116
116
|
self.app.config["BASIC_AUTH_ENABLED"] = False
|
117
117
|
self.auth: Optional[BasicAuth] = None
|
118
118
|
self.greenlet: Optional[gevent.Greenlet] = None
|
@@ -144,9 +144,7 @@ class WebUI:
|
|
144
144
|
|
145
145
|
@app.route("/assets/<path:path>")
|
146
146
|
def send_assets(path):
|
147
|
-
|
148
|
-
|
149
|
-
return send_from_directory(f"{webui_build_path}/assets", path)
|
147
|
+
return send_from_directory(os.path.join(self.webui_build_path, "assets"), path)
|
150
148
|
|
151
149
|
@app.route("/")
|
152
150
|
@self.auth_required_if_enabled
|
@@ -287,16 +285,9 @@ class WebUI:
|
|
287
285
|
@app.route("/stats/report")
|
288
286
|
@self.auth_required_if_enabled
|
289
287
|
def stats_report() -> Response:
|
290
|
-
if self.modern_ui:
|
291
|
-
self.set_static_modern_ui()
|
292
|
-
static_path = f"{self.webui_build_path}/assets"
|
293
|
-
else:
|
294
|
-
static_path = f"{self.root_path}/static"
|
295
|
-
|
296
288
|
theme = request.args.get("theme", "")
|
297
289
|
res = get_html_report(
|
298
290
|
self.environment,
|
299
|
-
static_path=static_path,
|
300
291
|
show_download_link=not request.args.get("download"),
|
301
292
|
use_modern_ui=self.modern_ui,
|
302
293
|
theme=theme,
|
@@ -542,7 +533,7 @@ class WebUI:
|
|
542
533
|
|
543
534
|
def set_static_modern_ui(self):
|
544
535
|
self.app.template_folder = self.webui_build_path
|
545
|
-
self.app.static_folder =
|
536
|
+
self.app.static_folder = os.path.join(self.webui_build_path, "assets")
|
546
537
|
self.app.static_url_path = "/assets/"
|
547
538
|
|
548
539
|
def update_template_args(self):
|