-
-
Notifications
You must be signed in to change notification settings - Fork 10
Scheduling
ping edited this page Mar 21, 2023
·
1 revision
The cron schedule in build.yml determines when newsrack will be triggered to execute recipes.
# .github/workflows/build.yml
schedule:
# Customise: Cron interval
- cron: "0 3,7,11,15,19,23 * * *"
If you need more time for each run, you can also set the job timeout-minutes
# .github/workflows/build.yml
# Customise: Total job run time limit
timeout-minutes: 60
Use enable_on to conditionally enable a recipe during a newsrack job run.
from _recipe_utils import Recipe, onlyon_days, onlyat_hours, onlyon_weekdays, first_n_days_of_month, last_n_days_of_month
Recipe(
recipe="example1",
slug="example1",
src_ext="epub",
category="Example",
enable_on=onlyon_weekdays([0, 2, 4]), # only on Mondays, Wednesdays, Fridays
),
Recipe(
recipe="example2",
slug="example2",
src_ext="epub",
category="Example",
enable_on=onlyon_days([1, 14]), # only on days 1, 14 of each month
),
Recipe(
recipe="example3",
slug="example3",
src_ext="epub",
category="Example",
enable_on=onlyat_hours(list(range(6, 12)), -5), # only from 6am-11.59am, for the timezone UTC-5
),
Recipe(
recipe="example4",
slug="example4",
src_ext="epub",
category="Example",
enable_on=first_n_days_of_month(3), # only on the first 3 days of the month
),
Recipe(
recipe="example5",
slug="example5",
src_ext="epub",
category="Example",
enable_on=last_n_days_of_month(7), # only on the last 7 days of the month
),
# instead of using the available functions, you can
# also define your own custom functions for enable_on