Closed fikrapdso closed 1 month ago
in documenttions it mention
When using shapes, the the Users, Spawn Rate and Run Time options will be hidden from the UI, and if you specify them on command line Locust will log a warning
But I am still able to see those fields in UI.
locust -f scripts/websocket_load_test.py --logfile halo.txt
# locustfile.py import json import logging import os import time import websocket from locust import HttpUser from locust import LoadTestShape from locust import TaskSet from locust import between from locust import task from locust_plugins.users.socketio import SocketIOUser DUMMY_COURSE_SLUG = os.getenv("DUMMY_COURSE_SLUG", default="xx") DUMMY_CHAPTER_SLUG = os.getenv("DUMMY_CHAPTER_SLUG", default="yy") DUMMY_EXERCISE_SLUG = os.getenv("DUMMY_EXERCISE_SLUG", default="zz") BASE_URL = os.getenv("BASE_URL", default="ws://localhost:3001") URL = "ws://localhost:3001/" class StepLoadShape(LoadTestShape): # Define a new LoadTestShape class stages = [] for minute in range(5): duration = minute * 60 users = minute * 2 stages.append( { "duration": duration, "users": users, "spawn_rate": 1, }, ) def tick(self): run_time = self.get_run_time() for stage in self.stages: if run_time < stage["duration"]: tick_data = ( stage["users"], stage["spawn_rate"], ) return tick_data return None class MySocketIOUser(SocketIOUser): wait_time = between(20, 20) @task def my_task(self): logging.info("task")
python 3.12
2.31.8
Mac os
@andrewbaldwin44 Maybe you can take a look at this when you're back?
Prerequisites
Description
in documenttions it mention
But I am still able to see those fields in UI.
Command line
locust -f scripts/websocket_load_test.py --logfile halo.txt
Locustfile contents
Python version
python 3.12
Locust version
2.31.8
Operating system
Mac os