Skip to content
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

Starting load test from the cli but monitoring from the web UI #831

Closed
ahmetb opened this issue Jun 29, 2018 · 9 comments
Closed

Starting load test from the cli but monitoring from the web UI #831

ahmetb opened this issue Jun 29, 2018 · 9 comments

Comments

@ahmetb
Copy link

ahmetb commented Jun 29, 2018

I think this is a feature request. I'm expecting that I can use locust CLI to start the load test, but monitor the results from the web UI.

Description of issue / feature request

When I run locust --host=... -c 10 -r 5 it doesn't start anything. Because it starts the web UI, which presents the user a form to manually start the load test.

Expected behavior

I expect locust to start the test and let me monitor the results from the web UI.

Actual behavior

locust ignores the -c and -r when --no-web is specified.

Environment settings (for bug reports)

  • Locust version: 0.8.1
@cgoldberg
Copy link
Member

presents the user a form to manually start the load test.

I'm -1 on changing that functionality.

@ahmetb
Copy link
Author

ahmetb commented Jun 30, 2018

My use case is that I want to run a continuous load test in headless mode and monitor results without looking at process logs. This sounds quite reasonable to me.

Care to explain your -1?

@cgoldberg
Copy link
Member

@ahmetb
sorry for the hasty -1... I should clarify...

I thought that you were proposing to remove the setup screen where you define users and hatch rate and do everything via CLI... but now I understand your use case.

It's definitely a reasonable feature to invoke a test from the CLI while still allowing you to monitor via the web UI. However I don't want to replace the manual start we currently use... I'd want tboth ways of configuring a test to co-exist.

so to summarize this feauture..

  • If both -c and -r are specified, always launch the test immediately. When you visit the web UI, it should take you directly into the monitor screen and bypass the start screen. Does that sound right?

The only edge case I can think of is if -c or -r are specified, but not both.. and --no-web is not set.. In that case, we can't immediately start the test. So we could raise an error and exit with a message that this is an invalid configuration. Or we can delay starting until user starts the test manually from the setup screen.

Now the rub...

We lack development resources at the moment... I personally don't have time to devote to implementing this, but I will review a PR if you submit one (it should also include an update to the docs).

@ahmetb
Copy link
Author

ahmetb commented Jul 2, 2018

If both -c and -r are specified, always launch the test immediately. When you visit the web UI, it should take you directly into the monitor screen and bypass the start screen. Does that sound right?

Yes!

if -c or -r are specified, but not both

I think most load test software assumes hatch rate of "all at once" by default. So I think you can infer that you should start the test if both specified, without introducing any new flags.

I don't need this feature right now, just wanted to put it in the backlog to improve the project.

@nealedj
Copy link

nealedj commented Nov 28, 2018

As a bit of a hack to gain a programmatic interface you could start locust with the web UI and then make a POST request to the /swarm endpoint with the hatch_rate and locust_count values.

E.g. curl -XPOST -d "hatch_rate=5&locust_count=100" http://my-locust-master-host/swarm

Then GET /stop when you're done.

@ghost
Copy link

ghost commented Oct 9, 2019

@nealedj How do I pass run-time parameter through CURL -XPOST?
I mean How to say to the curl -XPOST that I want to run the locust test for specific duration.

@cgoldberg
Copy link
Member

@nityasantoshi,

that is not currently supported

@cyberw cyberw added the wontfix label Nov 10, 2019
@cyberw
Copy link
Collaborator

cyberw commented Nov 10, 2019

While there is a possible use case for this, it is not very common, so I will close it (feel free to reopen if you absolutely want the feature and are willing to create a PR for it :)

There are other reporting solutions that work well with --no-web, like using https://github.com/SvenskaSpel/locust-plugins (Timescale + Grafana)

@cyberw
Copy link
Collaborator

cyberw commented Aug 29, 2021

I'm making a fix for this...

@cyberw cyberw closed this as completed in 6fef54d Aug 30, 2021
cyberw added a commit that referenced this issue Aug 30, 2021
Add --autostart and --autoquit parameters, fixes #831
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants