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

Added user-defined wait_function to locust and TaskSet #785

Merged
merged 4 commits into from Apr 27, 2018

Conversation

Projects
None yet
4 participants
@ps-george
Contributor

ps-george commented Apr 27, 2018

Most real-world inter-arrival times are exponentially distributed so it would be nice to be able to model that using locust. I've added the possibility for a user-defined wait_function, so any desired inter-arrival time can be modelled. Added some examples of exponential wait times I'd like to be able to model. If wait_function is not set, it will default to exactly as before, i.e. random.randint(self.min_wait,self.max_wait)

Change-log needs updating if merging this.

@codecov

This comment has been minimized.

codecov bot commented Apr 27, 2018

Codecov Report

Merging #785 into master will increase coverage by 0.26%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #785      +/-   ##
==========================================
+ Coverage   64.99%   65.26%   +0.26%     
==========================================
  Files          14       14              
  Lines        1417     1422       +5     
  Branches      222      224       +2     
==========================================
+ Hits          921      928       +7     
+ Misses        444      443       -1     
+ Partials       52       51       -1
Impacted Files Coverage Δ
locust/core.py 79.5% <100%> (+0.52%) ⬆️
locust/clients.py 89.88% <0%> (+2.24%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04e1bb2...469edf8. Read the comment docs.

@heyman

This comment has been minimized.

Member

heyman commented Apr 27, 2018

Thanks for the PR!

This is currently possible to achieve by overriding the wait() method in the TaskSet class. However I think this is a nicer API. This would also resolve #18 :).

I'm +1

Does anyone else has thoughts on this?

ps-george added some commits Apr 27, 2018

@aldenpeterson-wf

This comment has been minimized.

Contributor

aldenpeterson-wf commented Apr 27, 2018

+1 as well. I wish it was easier to figure out what sections of docs to update short of having them all memorized.

Also this is a great PR example too. A small, concise, clear feature request with a good API... 🏆

@heyman heyman merged commit 28340a8 into locustio:master Apr 27, 2018

3 checks passed

codecov/patch 100% of diff hit (target 64.99%)
Details
codecov/project 65.26% (+0.26%) compared to 04e1bb2
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@cgoldberg

This comment has been minimized.

Member

cgoldberg commented Apr 27, 2018

thanks for including an example too!

@ps-george

This comment has been minimized.

Contributor

ps-george commented May 1, 2018

Thanks for the fast and welcoming response!

@aldenpeterson-wf

This comment has been minimized.

Contributor

aldenpeterson-wf commented May 1, 2018

@ps-george realistically it's easy in a PR like this ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment