Comments (2)
What do you mean "the api call hangs until the time running out"?
In the middle my Locust running, if the response1 failure happened, and I had it "return", then till the end of this locust running, I don't see any extra response1 or response2 calls are made.
Thanks for the tips, I will give a try.
Thanks.
Jack
from locust.
If I was to have it executed with extra users, in some running session, the first API call hits the failure, and return back 400 code. In my current code, I was doing "return", which hopes the current session to be stopped, and a new one would be started. But I don't see it happens. What I have noticed is, all the API call hangs until the time running out.
What do you mean "the api call hangs until the time running out"?
I recommend running the test in a debugger or adding some print statements.
a) return
is fine, should work pretty much the way you expect, unless you mean you want to run on_start again
b) dont throw StopUser, it is an internal thing (we should probably rename it _StopUser or something...)
c) not really. The one thing that I think you may be confused about is the fact that Users loop forever. Their session is never terminated and on_start only happens once. If you need fine grained control use a flag:
class MyUser(HttpUser):
first_run = True
@task
def t(self):
if self.first_run:
self.first_run = False
# Initialization code goes here
...
# if current call fails, needs to restart from scratch.
if response1.status_code != 200:
self.first_run = True
return
Another way to do it is just to call on start directly:
# if current call fails, needs to restart from scratch.
if response1.status_code != 200:
self.on_start()
return
from locust.
Related Issues (20)
- Getting "NameError: name 'open' is not defined" error while running Locust test scenarios HOT 5
- Locust stops sending requests (boto3 / sqs) HOT 11
- The run_single_user mode doesn't fire some of the events
- Locust --processes argument generating multiple html reports HOT 4
- `'NoneType' object has no attribute 'get'` when `stream=True` in `FastHttpSession.request` HOT 2
- Would it be feasible/possible to add new event hook prior to request being made HOT 3
- Add an UI extension exemple that display proxy cache hit/miss
- Integrating with Locust HOT 4
- Locust tasks block when executing queries with pyodbc, but not in ThreadPool
- Use `random.choices` when selecting a task instead of `random.choice` HOT 4
- Users can raise `RescheduleTask` but TaskSets cannot? HOT 2
- TaskSet's `_task_queue` should be a `collections.deque`? HOT 1
- cannot specify task of UserClass when locust run on distributed mode HOT 5
- Monkey patching error HOT 3
- Wrong distribution of virtual users by user classes HOT 5
- Running two services test with different volume to be run in parallel HOT 3
- Abnormal Response Time Percentiles Reported After a Load Increase HOT 3
- Custom Threshold Rules HOT 3
- Event spawning_complete fires every time a user is created HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from locust.