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

When running distributed, stop the test if certain condition is met #1067

Closed
grganzaroli opened this issue Aug 16, 2019 · 3 comments
Closed

Comments

@grganzaroli
Copy link

Hey guys I've created a custom client that does a HTTP request, and after I need to parse the response.

If the response falls into a certain condition (let's say, I get a 404 response for example) I want to stop the test immediatly.

It does work perfectly for when I'm running locally, but when I run it distributed, I can stop the slave nodes, but the master node keeps running until the specified time is reached

For example, consider the code below:

@task 
def my_task(self):
     response = self.client.my_request()
     is_condition_met = parse_response(response)
     # Condition met, stop the test
     if is_condition_met:
          if isinstance(runners.locust_runner, LocalLocustRunner):
               # This part works just fine
               runners.locust_runner.quit()
          if isinstance(runners.locust_runner, SlavelLocustRunner):
               # Probably here I need to do something to tell the master node that I want to stop the test, but how? 
               runners.locust_runner.quit()

I don't know if this is the best approch for my case, maybe the master node needs to be responsible for stopping the test, but how to do that?

I'm open to suggestions, I hope you guys can help me, thanks in advance.

@cgoldberg
Copy link
Member

please ask general questions in the Slack channel

@max-rocket-internet
Copy link
Contributor

This is a very interesting issue.

Can you reopen it @cgoldberg?

Is there a way to send a message from a slave to the master?

@cgoldberg
Copy link
Member

This is a very interesting issue.

I don't see an issue here. All I see is a statement and a question asking for suggestions... nothing points to a concrete bug/problem with Locust. I agree there could be an interesting discussion around this topic, but this Issue tracker is not intended for questions and discussion.

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

No branches or pull requests

3 participants