Skip to main content

locust-on-databricks

Installation

pip install locust-on-databricks

Usage

OOTB Examples

For OOTB please look at examples in

  1. 01 Locust Test Single Node.py
  2. 02 Locust Test Distributed.py

The dummy example locustfile is here: locustfile.py

API Usage

Construct the runner:

from lod import LocustRunner

runner = LocustRunner(
    locustfile_path="locustfile.py",  # path to your locustfile
    # port=8089, # port is optional
)

Construct your initial swarm:

runner = runner.set_initial_swarm(
    host="https://google.com",
    user_count=10,
    spawn_rate=2,
    # run_time = "5m"
)

Start your locust server:

runner.start_locust()

Wait for running locust swarm to finish

runner.block_until_end_of_swarm(
    timeout_in_seconds=300,
    # check_every_n_seconds=5, # poll every n seconds default is 5s
)

Capture results/snapshots into a directory

This will create:

  1. request metrics csv
  2. failures csv
  3. exceptions csv
  4. html report
runner.save_artifacts(
    # save_directory="artifacts" # default is artifacts but recommended you save to volumes
    # file_prefix="" # default is empty prefix to your artifacts
)

Stop your locust server:

runner.stop_locust()

Search for "Access Locust Web UI at" in the output and open the link in your browser.

Distributed Runner

Construct a distributed runner:

runner = runner
.distributed()
.set_initial_swarm(
    host="https://google.com",
    user_count=10,
    spawn_rate=2,
    # run_time = "5m"
)

Construct a distributed runner with custom worker to core ratio:

runner = runner
.distributed(process_to_core_count_ratio=2.0)
.set_initial_swarm(
    host="https://google.com",
    user_count=10,
    spawn_rate=2,
    # run_time = "5m"
)

process_to_core_count_ratio is defaulted to 2 and it will spin up twice the number of workers as you have cores. You can tweak this as needed.

Run and stop new swarms

Run a new swarm:

runner.run_swarm(
    host="https://google.com",
    user_count=10,
    spawn_rate=2,
    # run_time = "5m"
)

Stop a running swarm

runner.stop_swarm()

Limitations

Starting a new swarm in the ui is bugged and the swarm rest api from the ui is not working.

Disclaimer

locust-on-databricks is not developed, endorsed not supported by Databricks. It is provided as-is; no warranty is derived from using this package. For more details, please refer to the license.

Metadata

Release files for locust-on-databricks 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for locust-on-databricks 0.2.1
File Size Uploaded Provenance
locust_on_databricks-0.2.1.tar.gz 16.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for locust-on-databricks 0.2.1
File Interpreter ABI Platform
locust_on_databricks-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.4 kB

Release files / locust_on_databricks-0.2.1.tar.gz

Download URL locust_on_databricks-0.2.1.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f4c7ac0effa40bcea2aba5f25824068aba677771bf74335979f796c15f50828a
BLAKE2b-256 checksum
How to use checksums
6cde0c32b1ecb3988c84a406934279839b082afabf45f074544cce93582ed1b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.8

Release files / locust_on_databricks-0.2.1-py3-none-any.whl

Download URL locust_on_databricks-0.2.1-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c65b50acf8b487a8558e4f4ee0f528936d13295bc4ca47a166d6e9dd49b01283
BLAKE2b-256 checksum
How to use checksums
d917e8a8dce6dc0354d0cae2b1e2975a06c0a4c1999f0e312d1081db7d3952fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.8

Security for locust-on-databricks 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page