Skip to main content

Run locust on single node or distributed on Databricks.

Project description

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()

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

locust-on-databricks-0.1.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

locust_on_databricks-0.1.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file locust-on-databricks-0.1.0.tar.gz.

File metadata

  • Download URL: locust-on-databricks-0.1.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.8

File hashes

Hashes for locust-on-databricks-0.1.0.tar.gz
Algorithm Hash digest
SHA256 191d3d8d3dd2c5354cdd0dccd08fa8dffcdde076ed137813c2922eafb61a8230
MD5 376fb22551fe86f15840a9c5888401fc
BLAKE2b-256 bdf31634aad509f92c8f8d644484b8bfdb3195e52aa86acc55f80c15f3bfc4c8

See more details on using hashes here.

File details

Details for the file locust_on_databricks-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for locust_on_databricks-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e45c3b446235b5676a225e306aad7681609c226bdf2bb96745e13064aec0d675
MD5 326c91521ba7d2b26172317f09680e0f
BLAKE2b-256 3bcbf16e75a23e1495e67a1d8eb11c6b824ca45cf2727dadc97c8b29d2b1dbfe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page