-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add tasks sequence support #827
Add tasks sequence support #827
Conversation
Codecov Report
@@ Coverage Diff @@
## master #827 +/- ##
==========================================
+ Coverage 66.1% 66.55% +0.44%
==========================================
Files 14 14
Lines 1422 1438 +16
Branches 224 226 +2
==========================================
+ Hits 940 957 +17
+ Misses 431 430 -1
Partials 51 51
Continue to review full report at Codecov.
|
can you also include an update to the docs in your PR if we decide to merge it? |
@cgoldberg Yeah, Is it okay if I add and example in |
Well, finally I decided not to change the quick start because it's supposed to be short. Instead I've updated the |
That's a real good work! I try to do that but met some trouble, thanks for your work! |
I'm +1 on merging this. Anyone else? |
I think you should add |
Adding TaskSequence and seq_task to file locust/init.py sounds like something useful. @cgoldberg what do you say? |
agreed. |
This LGTM |
If there is anything else you think I could add, just tell me! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
let's leave this for another day or 2 to see if any other maintainers comment, then I'll merge it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚢
looks like consensus for this PR is a 👍 ... merging now. |
thanks very much for the contribution! |
My pleasure! |
This pr is related to this issue.
As I said In slack, I know there is an easy workaround of defining only one task in the TaskSet and defining all the behavior there. The problem with the workaround is that it is a bit hacky, since you have to do
self.wait()
whenever it's needed instead of letting the framework handle it.If accepted this pr will
Introduce a new class:
TaskSequence
which accepts a new decorator @seq_task(int) to define the order of the tasks.For example:
In the example above, index_page/1 will be executed first, then load_page/1 fifty times, and then load_sub_page/1 thirty times.
@seq_task(int)
doesn't have a default parameter because I found that if I set the same order value to every task, the final order ends up being kind of random.