Locust Cloud Client
Locust Cloud is a Python library that acted as a client for the now-defunct Locust Cloud service, enabling users to deploy and manage distributed Locust load tests on a hosted cloud platform. The underlying Locust Cloud service has been shut down. The library's latest version is 1.30.0, and it follows the release cadence of its primary dependency, Locust, though its utility is now limited due to the service discontinuation.
Warnings
- breaking The Locust Cloud service, for which this library acts as a client, has been officially shut down. This means the primary functionality of `locust-cloud` (deploying and running tests on the hosted platform) is no longer operational.
- deprecated The `locust-cloud` library is deprecated due to the shutdown of its dependent service. No further development or support is expected for this client library.
- gotcha This library acts as a command-line interface (CLI) extension to the main `locust` command. It does not provide Python modules for direct programmatic import into your test scripts beyond what the core `locust` library offers. Your `locustfile.py` should only import from `locust`.
Install
-
pip install locust-cloud -
pip install locust
Imports
- HttpUser
from locust import HttpUser, task
- run_test_locally
This library primarily extends the 'locust' command-line interface.
Quickstart
# my_locustfile.py
from locust import HttpUser, task, between
class WebsiteUser(HttpUser):
wait_time = between(1, 2)
host = "http://127.0.0.1:8089" # Or a mock server provided by Locust Cloud
@task
def index_page(self):
self.client.get("/")
@task(3)
def view_items(self):
for item_id in range(10):
self.client.get(f"/item?id={item_id}", name="/item")
# To have run this with Locust Cloud (before its shutdown):
# 1. Ensure you have Locust Cloud credentials configured (e.g., via `locust --cloud --login` or environment variables).
# 2. Run your test:
# LOCUSTCLOUD_USERNAME=os.environ.get('LOCUSTCLOUD_USERNAME', '') \
# LOCUSTCLOUD_PASSWORD=os.environ.get('LOCUSTCLOUD_PASSWORD', '') \
# LOCUSTCLOUD_REGION=os.environ.get('LOCUSTCLOUD_REGION', 'us-east-1') \
# locust --cloud -f my_locustfile.py --headless --users 10 --spawn-rate 1