locust: Locust doesn't exit when a load shape returns None
Hi
When locust test is run it should automatically stop running when a LoadTestShape class tick method signals a test is complete by returning None.
But the test is finished but locust is doesn’t exit, master pod restart again. I’m using Docker to run Locust. (Version: 2.1.0)
class User(HttpUser):
def on_start(self):
print("test is starting")
wait_time = between(0, 0)
tasks = {SequenceOfTasks}
@events.test_stop.add_listener
def on_stop(self):
print("------------------------------------------------------------------------------------")
print("------------------------------------------------------------------------------------")
print("test is stopping")
print("------------------------------------------------------------------------------------")
print("------------------------------------------------------------------------------------")
self.environment.runner.quit()
self.driver.quit()
class MyCustomShape(LoadTestShape):
stages = [
{"duration": 60, "users": 10, "spawn_rate": 10}
]
def tick(self):
run_time = self.get_run_time()
for stage in self.stages:
print(run_time)
print(stage["duration"])
print(stage["users"])
if run_time < stage["duration"]:
tick_data = (stage["users"], stage["spawn_rate"])
return tick_data
return None
This is my worker log workerlog.txt
and it is my master log two part before restart and after restart masterlog.txt
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (3 by maintainers)
I think it happens anyway at times, not related to LoadShapes.
Yes, I think we should close this 🙂