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

stop_timeout defined in Locust class takes precedence over --run-time option #1117

Closed
kowalcj0 opened this issue Oct 22, 2019 · 3 comments
Closed
Labels

Comments

@kowalcj0
Copy link

Describe the bug

stop_timeout defined in Locust class takes precedence over --run-time option.

Expected behavior

To my mind --run-time should take precedence over stop_timeout.

Actual behavior

ditto

Steps to reproduce

Create a simple Locust class with stop_timeout defined:

locustfile.py:

from locust import HttpLocust, TaskSet, task

class SUTTasks(TaskSet):

    @task
    def landing_page(self):
        self.client.get("/")

class SUT(HttpLocust):
    stop_timeout = 10
    task_set = SUTTasks
    host = "https://www.google.com/"

Run the test with --run-time longer than stop_timeout, e.g. 20s:
locust --only-summary --no-web --run-time=20s
Then the test will stop after 10s not after 20s as defined by --run-time:
Check the timestamps in the log below:

[2019-10-22 10:31:32,645] local/INFO/locust.runners: All locusts hatched: SUT: 1
[2019-10-22 10:31:42,570] local/INFO/locust.runners: All locusts dead
[2019-10-22 10:31:42,571] local/INFO/locust.main: Shutting down (exit code 0), bye

Environment settings

  • OS: Linux 5.3.6
  • Python version: 3.7.4
  • Locust version: 0.11.0
@kowalcj0 kowalcj0 added the bug label Oct 22, 2019
@heyman
Copy link
Member

heyman commented Oct 22, 2019

Don't use Locust.stop_timeout. It should be removed from the code base (I wasn't actually aware
it was still around). As far as I can tell It's not documented anywhere so it shouldn't be considered as part of the official API. The time limit mechanism in the current implementation schedules a greenlet - which issues a call to locust_runner.quit() - at the specified time. It does not depend on the individual locust users ending their run loop.

@kowalcj0
Copy link
Author

Since I discovered it I'm not using it any more :)

@heyman
Copy link
Member

heyman commented Oct 30, 2019

Old code removed in 4e42d46.

@heyman heyman closed this as completed Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants