Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
638 views
in Technique[技术] by (71.8m points)

python - Locust : self.environment.runner.quit even the RPS still not 0

I want to know when I use below function in python-locust code for stopping running when I get non 200 response code from testing API endpoint.

 if response.status_code != 200:
    self.environment.runner.quit()

When I met response code != 200, all users are stopping. The number of users graph is reduce to 0 but total requests per second are not( My problem graph picture)

Why RPS not reduce to 0, please kindly tell me what exactly what it is ?

PS. I use Python 3.8.2 and locust 1.4.1

Thank you

Brs,

question from:https://stackoverflow.com/questions/65899044/locust-self-environment-runner-quit-even-the-rps-still-not-0

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I have tested your code using the host value from the original image. I get the error:

ConnectionError(ProtocolError('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer')))

So the response status code is 0 with an error and the test runner get stopped. I see everything ok in my side, but I run the latest code from: https://github.com/locustio/locust

It seems that what you have experienced it's an issue already solved at: https://github.com/locustio/locust/issues/1677

You could try to see if the issue remains after the new test with the latest Locust version 1.4.3 that it's already available on: https://pypi.org/project/locust/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...