-
Notifications
You must be signed in to change notification settings - Fork 3
When wikis have pending jobs, create a Kubernetes job to work through the items #603
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
Conversation
5b892a9 to
b0bc4d9
Compare
| // Schedule site stat updates for each wiki and platform-summary | ||
| $schedule->command('schedule:stats')->daily(); | ||
|
|
||
| $schedule->job(new PollForMediaWikiJobsJob)->everyMinute(); |
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.
If we wanted to have this run at a higher frequency, we'd have two options:
- this package https://github.com/spatie/laravel-short-schedule
- creating a wrapper job that dispatches multiple child jobs during a minute, sleeping inbetween
I would guess the former is a bit cleaner.
|
|
||
| private function enqueueWiki (string $wikiDomain): void | ||
| { | ||
| dispatch(new ProcessMediaWikiJobsJob($wikiDomain)); |
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.
Do we want/need this to fan out to another job (as is) or should we rather merge the two jobs into one?
413019a to
de4fe26
Compare
111f98c to
a534670
Compare
487b0a8 to
df08fb6
Compare
| ] | ||
| ]); | ||
|
|
||
| $job = $kubernetesClient->jobs()->apply($jobSpec); |
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.
Turns out that when using apply instead of create and using a unique .metadata.name per wiki, we can have Kubernetes deduplicate jobs for us and we don't have to check anything at all. Only downside is that we have to use a .spec.ttlSecondsAfterFinished of 0. Still think being able to keep this job free from any logic at all is worth it.
2ca82ad to
b9939e1
Compare
deer-wmde
left a comment
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.
Can confirm this worked locally for me! details: https://phabricator.wikimedia.org/T330389#8895083
Follows up on #601 which my fat fingers accidentally deleted.
Ticket https://phabricator.wikimedia.org/T330389
Requires wbstack/charts#114, wmde/wbaas-deploy#885