forked from flathub-infra/website
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add scheduler to be able to schedule worker jobs to certain times
- Loading branch information
Showing
7 changed files
with
809 additions
and
672 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,5 +80,7 @@ class Settings(BaseSettings): | |
|
||
backend_node_url: str | None = None | ||
|
||
is_worker: bool = False | ||
|
||
|
||
settings = Settings() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from apscheduler.triggers.cron import CronTrigger | ||
|
||
JOBS = [] | ||
|
||
|
||
def cron(crontab): | ||
"""Wrap a Dramatiq actor in a cron schedule.""" | ||
trigger = CronTrigger.from_crontab(crontab) | ||
|
||
def decorator(actor): | ||
module_path = actor.fn.__module__ | ||
func_name = actor.fn.__name__ | ||
JOBS.append((trigger, module_path, func_name)) | ||
return actor | ||
|
||
return decorator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters