I'm struggling to format a cron schedule for gcp properly and the docs aren't really helping me out.
Cron #1: Run every 50 minutes from 11:00 to 21:00 only on the months from march to october inclusive
schedule: every 50 minutes from 11:00 to 21:00 of mar,apr,may,jun,jul,aug,sep,oct
Cron #2: Run every day at 22:00 only on the months from march to october inclusive
schedule: every day 22:00 of mar,apr,may,jun,jul,aug,sep,oct
Neither of those work, but they were one of my attempts. What am I doing wrong here?
Referring to the Formatting the schedule docs below.
There is no supported syntax for your 1st cron:
[INTERVAL_VALUE]
is only supported by END-TIME INTERVAL and START-TIME INTERVAL formats, but neither of them allows specifying months in the [INTERVAL_SCOPE]
. [INTERVAL_SCOPE]
is CUSTOM INTERVAL, but that only supports day specifications in [INTERVAL_VALUE]
.But you can achieve an equivalent functionality by using the finer time specification in cron.yaml
and making a check for the remaining conditions inside the cron job itself, doing nothing if the condition is not met. So your 1st cron would be achieved with:
this cron.yaml
entry:
schedule: every 50 minutes from 11:00 to 21:00
Your 2nd cron is possible using a CUSTOM INTERVAL, you just need to place the hour at the end of the [INTERVAL_SCOPE]
. From the doc:
[INTERVAL_SCOPE]: Specifies a clause that corresponds with the specified [INTERVAL_VALUE]. Custom intervals can include the
of [MONTH]
clause, which specifies a single month in a year, or a comma-separated list of multiple months. You must also define a specific time for when you want the job to run, for example:of [MONTH] [HH:MM]
.
So your entry would be:
schedule: every day of mar,apr,may,jun,jul,aug,sep,oct 22:00