locust 2.36.3.dev6__py3-none-any.whl → 2.36.3.dev19__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/_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '2.36.3.dev6'
21
- __version_tuple__ = version_tuple = (2, 36, 3, 'dev6')
20
+ __version__ = version = '2.36.3.dev19'
21
+ __version_tuple__ = version_tuple = (2, 36, 3, 'dev19')
locust/argument_parser.py CHANGED
@@ -18,8 +18,6 @@ from typing import Any, NamedTuple
18
18
  from urllib.parse import urlparse
19
19
  from uuid import uuid4
20
20
 
21
- from locust_cloud.args import add_locust_cloud_argparse
22
-
23
21
  if sys.version_info >= (3, 11):
24
22
  import tomllib
25
23
  else:
@@ -38,6 +36,13 @@ version = locust.__version__
38
36
 
39
37
  DEFAULT_CONFIG_FILES = ("~/.locust.conf", "locust.conf", "pyproject.toml")
40
38
 
39
+ try:
40
+ from locust_cloud.args import add_locust_cloud_argparse
41
+ except ModuleNotFoundError as e:
42
+ add_locust_cloud_argparse = lambda _: None
43
+ if e.msg != "No module named 'locust_cloud'":
44
+ raise
45
+
41
46
 
42
47
  # Clean up downloaded locustfile on exit
43
48
  def exit_handler(filename) -> None:
@@ -768,6 +773,12 @@ Typically ONLY these options (and --locustfile) need to be specified on workers,
768
773
  action="store_true",
769
774
  help="Prints the final stats in JSON format to stdout. Useful for parsing the results in other programs/scripts. Use together with --headless and --skip-log for an output only with the json data.",
770
775
  )
776
+ stats_group.add_argument(
777
+ "--json-file",
778
+ metavar="<filename>",
779
+ dest="json_file",
780
+ help="Prints the final stats in JSON format to file path specified.",
781
+ )
771
782
 
772
783
  log_group = parser.add_argument_group("Logging options")
773
784
  log_group.add_argument(
locust/main.py CHANGED
@@ -35,6 +35,7 @@ except ModuleNotFoundError as e:
35
35
  if e.msg != "No module named 'locust_plugins'":
36
36
  raise
37
37
  try:
38
+ # remove in future release
38
39
  import locust_cloud # pyright: ignore[reportMissingImports] # noqa: F401
39
40
 
40
41
  locust_cloud_version = f" (locust-cloud {importlib.metadata.version('locust-cloud')})"
@@ -43,6 +44,15 @@ except ModuleNotFoundError as e:
43
44
  locust_cloud = None
44
45
  if e.msg != "No module named 'locust_cloud'":
45
46
  raise
47
+ try:
48
+ import locust_exporter # pyright: ignore[reportMissingImports] # noqa: F401
49
+
50
+ locust_exporter_version = f" (locust_exporter {importlib.metadata.version('locust-exporter')})"
51
+ except ModuleNotFoundError as e:
52
+ locust_exporter_version = ""
53
+ locust_exporter = None
54
+ if e.msg != "No module named 'locust_exporter'":
55
+ raise
46
56
 
47
57
  if TYPE_CHECKING:
48
58
  from collections.abc import Callable
@@ -178,7 +188,7 @@ def main():
178
188
  children = []
179
189
  logger = logging.getLogger(__name__)
180
190
 
181
- logger.info(f"Starting Locust {version}{locust_cloud_version}")
191
+ logger.info(f"Starting Locust {version}{locust_exporter_version}")
182
192
 
183
193
  if options.processes:
184
194
  if os.name == "nt":
@@ -630,6 +640,8 @@ See https://github.com/locustio/locust/wiki/Installation#increasing-maximum-numb
630
640
  runner.quit()
631
641
  if options.json:
632
642
  stats.print_stats_json(runner.stats)
643
+ if options.json_file:
644
+ stats.save_stats_json(runner.stats, options.json_file)
633
645
  elif not isinstance(runner, locust.runners.WorkerRunner):
634
646
  stats.print_stats(runner.stats, current=False)
635
647
  stats.print_percentile_stats(runner.stats)
locust/stats.py CHANGED
@@ -820,6 +820,11 @@ def print_stats_json(stats: RequestStats) -> None:
820
820
  print(json.dumps(stats.serialize_stats(), indent=4))
821
821
 
822
822
 
823
+ def save_stats_json(stats: RequestStats, filename: str) -> None:
824
+ with open(f"{filename}.json", "w") as _:
825
+ json.dumps(stats.serialize_stats(), indent=4)
826
+
827
+
823
828
  def get_stats_summary(stats: RequestStats, current=True) -> list[str]:
824
829
  """
825
830
  stats summary will be returned as list of string
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: locust
3
- Version: 2.36.3.dev6
3
+ Version: 2.36.3.dev19
4
4
  Summary: Developer-friendly load testing framework
5
5
  Project-URL: homepage, https://locust.io/
6
6
  Project-URL: repository, https://github.com/locustio/locust
@@ -30,7 +30,7 @@ Requires-Dist: flask-login>=0.6.3
30
30
  Requires-Dist: flask>=2.0.0
31
31
  Requires-Dist: gevent<25.0.0,>=24.10.1
32
32
  Requires-Dist: geventhttpclient>=2.3.1
33
- Requires-Dist: locust-cloud>=1.20.5
33
+ Requires-Dist: locust-cloud>=1.21.1
34
34
  Requires-Dist: msgpack>=1.0.0
35
35
  Requires-Dist: psutil>=5.9.1
36
36
  Requires-Dist: pywin32; sys_platform == 'win32'
@@ -1,7 +1,7 @@
1
1
  locust/__init__.py,sha256=aWeuBPUxONjwNm1xp4v8L4BO14SuYLjscIiwJVX1Ui4,1746
2
2
  locust/__main__.py,sha256=vBQ82334kX06ImDbFlPFgiBRiLIinwNk3z8Khs6hd74,31
3
- locust/_version.py,sha256=-QGfDD9D1YpFgJu-aQNUJdB0k3nLm9u-yxLlNpzjXBE,526
4
- locust/argument_parser.py,sha256=c0A7smgqHj7nCwV_pSzDgeYR5HvZZliAAj2QgmbyKbM,33037
3
+ locust/_version.py,sha256=Mm80naUBKbXfaZGa_fV-Dm-QvOIzq8xDBNVtu_lLSjY,528
4
+ locust/argument_parser.py,sha256=ImwORtwFDe0qHP2r8kI-g0i0fbJJ8IG21hniq69kVHY,33383
5
5
  locust/clients.py,sha256=o-277lWQdpmPnoRTdf3IQVNPQT8LMFDtPtuxbLHQIIs,19286
6
6
  locust/debug.py,sha256=7CCm8bIg44uGH2wqBlo1rXBzV2VzwPicLxLewz8r5CQ,5099
7
7
  locust/dispatch.py,sha256=prdwtb9EoN4A9klgiKgWuwQmvFB8hEuFHOK6ot62AJI,16202
@@ -11,11 +11,11 @@ locust/exception.py,sha256=jGgJ32ubuf4pWdlaVOkbh2Y0LlG0_DHi-lv3ib8ppOE,1791
11
11
  locust/html.py,sha256=VjoAEZEolJ8il4HLACBlVA81Qk36fBwlDj_7ojAEFss,4132
12
12
  locust/input_events.py,sha256=lqLDB2Ax-OQ7-vtYNkGjySjfaWVobBzqf0GxRwjcLcQ,3323
13
13
  locust/log.py,sha256=5E2ZUOa3V4sfCqa-470Gle1Ik9L5nxYitsjEB9tRwE0,3455
14
- locust/main.py,sha256=p3wl2cSFNE2dp5ESkph-BAw46AVdpbhMUsQ71u3yvXk,27793
14
+ locust/main.py,sha256=4gAGnHbaAUaPcEiImLuoyLeZ6LxNGL1cGWLET3e8h8Y,28271
15
15
  locust/py.typed,sha256=gkWLl8yD4mIZnNYYAIRM8g9VarLvWmTAFeUfEbxJLBw,65
16
16
  locust/runners.py,sha256=niYmGsfOpxMfVmTXGod4MYTefpaZ2wirFlhqxRw5mq4,70617
17
17
  locust/shape.py,sha256=t-lwBS8LOjWcKXNL7j2U3zroIXJ1b0fazUwpRYQOKXw,1973
18
- locust/stats.py,sha256=D2iJ7Ei1Z_e3cF5n8TdSstpewZytnSmstTjxr5c9uNw,47264
18
+ locust/stats.py,sha256=bpqpqqa-vxmKF_-qqUtiuAZkZwJbEHtjTK_cAjfOCgo,47430
19
19
  locust/web.py,sha256=I4xHIHq34F7AY-KXs9NfQ3vTqN6QX4O74KBkTUpNkhs,30471
20
20
  locust/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  locust/contrib/fasthttp.py,sha256=BCuKG0qpBIhXdejjPSbAMSaSd6piJtuLdx96_LWbIgI,29349
@@ -51,8 +51,8 @@ locust/webui/dist/assets/graphs-light.png,sha256=7L6pOehXqCojQclzeP91l-LskFQAw_n
51
51
  locust/webui/dist/assets/index-OsbNSvrF.js,sha256=7HLGlI9Pmknt3Nqf2hfZG7drC0jyMPi9Z5-x21F_4e8,1721633
52
52
  locust/webui/dist/assets/testruns-dark.png,sha256=np6MvpgJ2gkKQ66SOmukLtjsMtHqTSr5dNfza-2XtCo,267621
53
53
  locust/webui/dist/assets/testruns-light.png,sha256=iLAxBZh3kRsfGkcB1-1KSAbFgGji43IqiUrYuJlUoPk,276839
54
- locust-2.36.3.dev6.dist-info/METADATA,sha256=TRbMBILpPcSXwW3ES2-lpV_4YVHr-MFPJeIWPXJ-zqs,9403
55
- locust-2.36.3.dev6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
56
- locust-2.36.3.dev6.dist-info/entry_points.txt,sha256=RAdt8Ku-56m7bFjmdj-MBhbF6h4NX7tVODR9QNnOg0E,44
57
- locust-2.36.3.dev6.dist-info/licenses/LICENSE,sha256=5hnz-Vpj0Z3kSCQl0LzV2hT1TLc4LHcbpBp3Cy-EuyM,1110
58
- locust-2.36.3.dev6.dist-info/RECORD,,
54
+ locust-2.36.3.dev19.dist-info/METADATA,sha256=SJVmGgq-NePrrXgf2_6tJAmdqF37Eri2SxlsKsJzdTM,9404
55
+ locust-2.36.3.dev19.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
56
+ locust-2.36.3.dev19.dist-info/entry_points.txt,sha256=RAdt8Ku-56m7bFjmdj-MBhbF6h4NX7tVODR9QNnOg0E,44
57
+ locust-2.36.3.dev19.dist-info/licenses/LICENSE,sha256=5hnz-Vpj0Z3kSCQl0LzV2hT1TLc4LHcbpBp3Cy-EuyM,1110
58
+ locust-2.36.3.dev19.dist-info/RECORD,,