-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editing a running test in the Web UI with class-picker restarts user count back at 0 #2204
Comments
There's definitely an error if you don't stop the runners, but off of the top of my head I don't remember what it is. I'll try to see if there's a workaround for it. |
If it helps, this was the monkeypatch I am using to acheive the expected behaviour for my usage. I haven't tested it thoroughly though. diff --git a/locust/web.py b/locust/web.py
index de688030..452dbf85 100644
--- a/locust/web.py
+++ b/locust/web.py
@@ -174,6 +174,8 @@ class WebUI:
# Defaulting to using all available user classes
user_classes = self.environment.available_user_classes
+ restart_required = list(user_classes.values()) != self.environment.user_classes
+
self._update_user_classes(user_classes)
# Updating ShapeClass if specified in WebUI Form
@@ -185,7 +187,8 @@ class WebUI:
# Stopping Runners and setting user dispatchers to None so that they
# are recreated with the appropriate UserClasses
- self._stop_runners()
+ if restart_required:
+ self._stop_runners()
parsed_options_dict = vars(environment.parsed_options) if environment.parsed_options else {}
for key, value in request.form.items(): |
I have a fix here: #2207. It turns out that I didn't need to stop the runners, just set the user_dispatcher to |
Hello @mikenester thanks for the quick turnaround! However from my quick test it seems to still have the same behaviour. I took the latest dev build Then I ran a simple locust against my endpoint going from 3 to 10, 15 and back to 5 users. This is what I got: Seems like setting the user_dispatcher to None still resets the users. Is that possible? |
Ahh sorry, it was working on my end. I'll talk another look at it today. |
Thanks, let me know if you need any more details if you can't repro the same behaviour on your side 👍 |
Second fix here: #2210 Looks like I was wrong about
I removed the step completely to check for errors and didn't see any. I'm a little nervous about it though, as I specifically remembering that some workflows would cause an error. I think it was:
I couldn't replicate any errors when testing this out, however. |
Hi @mikenester, PR looks good to me 👍
I just tested this workflow and it seems to be fine for me as well. Hopefully it doesn't cause any other issues. Thanks again for the support! |
👍👍 @edmundlam please close this when you have tried it out using a dev release. |
Tested with |
Describe the bug
When I edit a running load test in the Web UI with
class-picker
active, it restarts the users back at 0 users and ramps up to the desired count.This is different from the behaviour without
--class-picker
, where if I edit to go from 10 to 20 users, it will merely add 10 more users on top of the existing 10.Checking the code in
web.py
, it seems that if class-picker is active, the code will always restart the runners.I'm wondering if we can skip the restarting of the runners if the user classes requested in the
POST /swarm
request are the same as those currently running. Especially since the "Edit" form for a running task doesn't let you change the class of users!If this is something that you would agree to, I would be willing to open a PR to contribute the change. Thanks!
Expected behavior
When using --class-picker, increasing from 10 to 20 will add 10 more users
Actual behavior
When using --class-picker, increasing from 10 to 20 users will start from 0 again, and ramp up to 20 users.
Steps to reproduce
You can also run without --class-picker to see that the expected behaviour occurs when
--class-picker
is not set.Environment
locust -f tests/load/locustfile.py --config tests/load/locust.conf
# withclass-picker = true
in the confThe text was updated successfully, but these errors were encountered: