Exceptions raised in setup method causes Locust to break
See original GitHub issueIn locustio 0.13.5, there is a very odd bug that prevents the setup method from using requests to make HTTP requests. When doing an HTTP POST request, the setup function unexpectedly returns. No exception is printed, but the remainder of the function does not execute. This is what my code looks like (edited down for confidentiality):
class MyLocust(HttpLocust):
def setup(self):
print('Creating test data')
response = requests.post('https://my-service.company.com', json=test_data)
assert response.status_code == 201
print('Created test data')
I added a try/catch to my code and apparently the requests.post()
call throws a GreenletExit
exception. After much consternation I was able to narrow the issue down to gevent. It appears that the gevent._ssl3
module’s call to self._wait(self._read_event, timeout_exc=_SSLErrorReadTimeout)
on line 332 throws this GreenletExit
error.
Important note: this error does not manifest in locustio 0.12.2 or lower.
Issue Analytics
- State:
- Created 4 years ago
- Comments:21 (5 by maintainers)
Top Results From Across the Web
How to fail setup in Locust? - python - Stack Overflow
To do that, I'm raising an exception, but locust continues with the tests until time limit is reached. I'd like for it to...
Read more >Writing a locustfile — Locust 0.13.1 documentation
A locustfile is a normal python file. The only requirement is that it declares at least one class— let's call it the locust...
Read more >Locust - Read the Docs
Locust is an easy-to-use, distributed, user load testing tool. It is intended for load-testing web sites (or other systems).
Read more >A Global Review on Locusts (Orthoptera: Acrididae) and Their ...
We draw attention to “telecoupling” a process in which land management practices like grazing have ecological feedbacks on locust populations, ...
Read more >Preventing desert locust plagues: optimizing management ...
Outbreaks occur when concentration and multiplication cause a marked increase in locust numbers and densities so that individuals gregarize ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, preferably you could use the
setup()
function the same in both the Locust and the TaskSet. But if there are technical limitations that prevent this, having two functions that operate subtly differently is not a very good experience.@cyberw I tried moving the
setup()
into the TaskSet and it appears to work! I still think you should do something aboutsetup()
in the Locust throwing this error though. The fact that it appears to support normalsetup()
functions is misleading and, if the TaskSet is the preferred place to set it, perhaps it would be better to deprecate that particular function.