Skip to content

modified ui_extra_args_dict function to pick arguments#3245

Merged
cyberw merged 9 commits intolocustio:masterfrom
sonianuj287:fix-custom-argument
Oct 23, 2025
Merged

modified ui_extra_args_dict function to pick arguments#3245
cyberw merged 9 commits intolocustio:masterfrom
sonianuj287:fix-custom-argument

Conversation

@sonianuj287
Copy link
Copy Markdown
Contributor

@sonianuj287 sonianuj287 commented Oct 18, 2025

Problem

When running Locust in distributed mode (master-worker), custom command-line arguments were not displayed correctly in the Web UI. The Web UI would show default values instead of the actual values passed via command line to the master.
issue - #3206

Root Cause

The ui_extra_args_dict() function was always parsing arguments from scratch without considering the already-parsed options stored in environment.parsed_options

Solution

Added test: Created comprehensive unit test in test_parser.py to verify the fix.

Solution
Modified argument_parser.py: Added an optional parsed_options parameter to ui_extra_args_dict() so it can use already-parsed options instead of re-parsing from scratch.

Modified web.py: Updated the call to ui_extra_args_dict() to pass the current parsed_options, ensuring the Web UI displays actual current values.

Added test: Created comprehensive unit test in test_parser.py to verify the fix.

@sonianuj287
Copy link
Copy Markdown
Contributor Author

Hi @ivan-krupin-magicmedia @cyberw

I've create a PR, please review it.
Thanks :)

@cyberw
Copy link
Copy Markdown
Collaborator

cyberw commented Oct 18, 2025

Uh, there's some changes in this PR that don't relate to the issue? If you want me to look at it, please keep it minimal.

@sonianuj287
Copy link
Copy Markdown
Contributor Author

Uh, there's some changes in this PR that don't relate to the issue? If you want me to look at it, please keep it minimal.

Hi @cyberw , please review them. I've removed some more irrelevant code

@cyberw
Copy link
Copy Markdown
Collaborator

cyberw commented Oct 19, 2025

Still some irrelevant code changes.

@sonianuj287
Copy link
Copy Markdown
Contributor Author

Solution

Added test: Created comprehensive unit test in test_parser.py to verify the fix.

Solution Modified argument_parser.py: Added an optional parsed_options parameter to ui_extra_args_dict() so it can use already-parsed options instead of re-parsing from scratch.

Modified web.py: Updated the call to ui_extra_args_dict() to pass the current parsed_options, ensuring the Web UI displays actual current values.

Added test: Created comprehensive unit test in test_parser.py to verify the fix.

removed more irrelevant code

@cyberw
Copy link
Copy Markdown
Collaborator

cyberw commented Oct 19, 2025

Cool stuff! You can probably ignore the unrelated test fails.

I wonder, why are you testing this?
https://github.com/locustio/locust/pull/3245/files#diff-189588e8d0bd156168943d9dc5fc5338f9970bd476b4162e6579606b2408a0f8R409

Perhaps you could validate in a more end-to-end fashion, maybe adding the check somewhere here (right now it only tests the forwarding of args, it it should be reasonably easy to add)

requests.post(

@sonianuj287
Copy link
Copy Markdown
Contributor Author

Hi @cyberw , so sorry to spam your inbox. Just want to work here more, please help me with reviewing and suggesting changes. Thanks :)

@sonianuj287
Copy link
Copy Markdown
Contributor Author

Hi @cyberw @amandasaurus @sanga @pjenvey , please review this PR and suggest me changes.
Thanks :)

@cyberw cyberw merged commit ee6ca50 into locustio:master Oct 23, 2025
16 of 18 checks passed
@cyberw
Copy link
Copy Markdown
Collaborator

cyberw commented Oct 23, 2025

Looks great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants