-
-
Notifications
You must be signed in to change notification settings - Fork 405
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
jobs: prevent parallel execution and plugin specific scheduler #1891
Conversation
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.
Not the most comprehensive review, but a start. Couple of actual questions here—for once, I'm not just playing with docstrings. 😛
OK, there is more to say about the register/unregister situation in the bot.
It's a long process. So in this PR, I'll revert my changes on |
@dgw also, I'll make document |
cbec340
to
13efdd5
Compare
@dgw so, you were totally right in your comments. Because I added so much docstrings, and because there was so much to fix/change/revert, I believe a "rebase" couldn't hurt in that specific case. Most of the docstrings have been updated, added, moved, or replaced, so I think you will have to re-review everything anyway. As said earlier, I won't update the So good luck with the review, hope it won't be too difficult this time. |
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.
Fun times at grammar school. 😛
Changes applied and fixed the docstring. |
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.
Another "Squash what you're gonna squash and we'll "
This commit changes how the Scheduler and the Job work together, and add a new plugins specific Scheduler: * the new Scheduler prevents parallel execution of jobs * jobs are created from callable * the same interface as rules is used for jobs now (with plugin name, label, handler, execute method, and so on) * jobs now manage themselves their set of interval, instead of having a copy of each job for each of its intervals * sopel.tools.jobs is now part of the documentation, but are still marked as internal tools * sopel.plugins.jobs is new and added to the documentation, under the same conditions (i.e. internal stuff)
a98245f
to
e0fd07a
Compare
Done as well. |
Closes #1144
Description
Initially, it was only about preventing parallel execution of jobs, but then I realized I needed way more than that:
Also, I realized that the "catch up" mechanism makes no sense: either the job can be run in time, or it can't, but it won't try to run it more than once because it's late. I can see why it was like that before, but there are several problems with how it was implemented:
In that regard, it's best not to over-engineer the solution, and to just take the most optimistic and safe approach: execute only once at a time, then see if it should execute again or a bit later, given the configured intervals.
And here we are, with a lot of changes for something that seem easy at first. The good news is that it was necessary anyway to work on a better documentation spec for Sopel: in the future, we'll be able to list not only rules and commands, but also jobs! But that will be for a future PR.
Checklist
make qa
(runsmake quality
andmake test
)