-
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
Allow LoadTestShapes to reuse run-time, spawn-rate and users parameters #2395
Conversation
196e86b
to
95555ef
Compare
I thought I commented on this but cant seem to find it now. I think this makes sense, but can be done without the extra parameter and just make it the default behavior. Maybe just log an info level message about the fact that |
Oh, I chose this path because I thought you wanted to keep the actual behavior but making it the default is even better ! |
yea, I kind of changed my mind. hmm... I guess there is no way of having it both ways... (getting a clear error message when e.g. run time was specified but not actually read/respected by load shape, without having to add the new parameter) Hmm... let me think about it a bit more. |
Hmm. I had forgotten about the web ui, where it becomes really strange to show the parameters by default. |
Yea. I think my first idea was the most appropriate We had that discussion in an issue, right? Link it from the PR by adding it in the PR description please. So I dont forget stuff :) "reuse-parameters" is a strange parameter name though. Maybe something else, that relates to shapes.. |
You might be mistaking me for someone else about the in-PR discussion. But it means there is already a discussion about it (I will try to find it back). So which way is it ? Default with proper logging or opt-in like it is already ? For the (In the meantime, PR rebased against the current |
95555ef
to
6967a6b
Compare
Uhm. I completely misread your description and thought you were introducing a command line flag. |
This change looks good (I dont know what happened when I read it the first time, maybe reviewing too many PR:s at once:) Two minor things:
|
--run-time, --users and --spawn-rate dont really have a name as a group, but we could call them "common arguments" (they are called "common options" in the help message, and it differentiates them somewhat from "custom arguments" which is handled differently in the UI and other places). Perhaps we should use "hide_common_arguments" in web.py and "reuse_common_arguments" as class variable name? Edit: I do like the word "option" better than "argument" though. How do you feel about hide_common_options / reuse_common_options? |
I agree, options is more concise. (I am on it, PR should be updated soon) |
Not 100% sure I understand what you mean here, but looking forward to your updated PR :) |
6967a6b
to
af5d0c8
Compare
PR updated with:
|
af5d0c8
to
fadb32d
Compare
locust/runners.py
Outdated
logger.info("Shape test starting. User count and spawn rate are ignored for this type of load test") | ||
logger.info("Shape test starting.") | ||
if self.environment.shape_class and not self.environment.shape_class.use_common_options: | ||
logger.info("User count and spawn rate are ignored for this type of load test.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're also logging a warning on line 218 in main.py for this case then it doesnt really need to be said twice, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll keep only one of them and add a link to the documentation too.
Which one do you prefer to keep ? The main one or the runner one (I prefer the main
one as it seems more logical to group parameters validation in)?
Looking really good now. I just made a single comment in the code. |
Last question because we have different behavior for
I think this is the same pattern and we should have a warning for the 3, choose to bail or ignore but do the same in both case. Are you OK for:
|
8e146a2
to
f6e16d2
Compare
31aabef
to
014322b
Compare
I agree with the change regarding warning instead of failing. But we should adjust the first two log lines accordingly. How about merging them into one line: |
…nd users parameters
014322b
to
0b484aa
Compare
I splitted them on 2 lines to avoid having a log line spanning on multiple lines but yes, I can group the first 2 log statements into a single. However I would not add the
PR updated accordingly |
Excellent! |
Currently, it is not possible for a custom
LoadTestShape
to reuse the built-inrun_time
,num_users
andspawn_rate
parameters, even if they need/use it (they are rather classical load testing parameters).There must be an undocumented reason somewhere for this choice.
This pull request allows custom
LoadTestShape
to reuse those command line parameters if explicitly told with thereuse_parameters
attribute.So with this change, the following code will work:
This change is tested, documented and backward compatible. The WebUI swarm form behavior has been adapted to it (
user_count
andspawn_rate
fields are not disabled withreuse_parameters = True
).Note:
build is failing on github while succeeded inI added some output to the test in case of failure to understand why it fails on github.tox
locally (for all Python version).