locust icon indicating copy to clipboard operation
locust copied to clipboard

Custom arguments under argument groups are not shown in the web UI

Open cyberw opened this issue 1 year ago • 5 comments

Prerequisites

Description

I would love for custom arguments to become visible in the web ui, even when they are under an argument group. Right now, for example, none of locust-plugins's arguments are visible.

Ideally they would be grouped by their group names as (still under "custom parameters" of course)

Doesnt need to be fixed in the "old" UI. Pretty soon I feel we are ready to switch the default to modern anyway.

Locustfile contents

@events.init_command_line_parser.add_listener
def add_arguments(parser: LocustArgumentParser):
    run_info = parser.add_argument_group(
        "locust-plugins - Run info",
        "Extra run info for listeners",
    )
    run_info.add_argument(
        "--override-plan-name",
        type=str,
        help="Override test plan name in Timescale, default is to use locustfile file name",
        env_var="LOCUST_OVERRIDE_PLAN_NAME",
        default="",
    )

Right now the UI just serves up a nothing-burger: image

cyberw avatar Jan 19 '24 22:01 cyberw

@andrewbaldwin44 Could you have a look, when you have the time? You could test it out with locust-plugins once you get it working...

cyberw avatar Jan 19 '24 22:01 cyberw

Yeah it seems to be more of an issue with the argument parser, rather than the web UI :) The extra_options that are displayed in the Web UI are compiled in the argument_parser.ui_extra_args_dict method. The arguments are then filtered such that only arguments with the property include_in_web_ui=True are shown.

Although the property include_in_web_ui is defaulted to be True, it is only defaulted to be True when an argument is added through the custom add_argument method, which is not the case for argument groups.

Overriding the add_argument_group proves to be a bit tricky or weird. I'll try to come up with a solution or maybe a different way to filter the args. Then to have them grouped by argument group we will also need to keep track of the group they belong to, which as far as I can tell is not done by default

andrewbaldwin44 avatar Jan 20 '24 04:01 andrewbaldwin44

Aha, I think I can solve the add_argument_group part. I’ll have a go at it at least..

cyberw avatar Jan 20 '24 07:01 cyberw

Hmm. My approach didnt work. Happy to see someone else have a go at it..

cyberw avatar Jan 29 '24 20:01 cyberw

I'm also looking into it. Maybe I share the working code snippet here once I'm able to get it to work.

pranavthombare avatar Jan 30 '24 17:01 pranavthombare

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 10 days.

github-actions[bot] avatar Mar 31 '24 01:03 github-actions[bot]

This issue was closed because it has been stalled for 10 days with no activity. This does not necessarily mean that the issue is bad, but it most likely means that nobody is willing to take the time to fix it. If you have found Locust useful, then consider contributing a fix yourself!

github-actions[bot] avatar Apr 11 '24 01:04 github-actions[bot]