flytekit.CronSchedule#

class flytekit.CronSchedule(cron_expression=None, schedule=None, offset=None, kickoff_time_input_arg=None)[source]#

Use this when you have a launch plan that you want to run on a cron expression. This uses standard cron format in case where you are using default native scheduler using the schedule attribute.

CronSchedule(
    schedule="*/1 * * * *",  # Following schedule runs every min
)

See the User Guide for further examples.

Parameters
  • cron_expression (str) – This should be a cron expression in AWS style.Shouldn’t be used in case of native scheduler.

  • schedule (str) – This takes a cron alias (see _VALID_CRON_ALIASES) or a croniter parseable schedule. Only one of this or cron_expression can be set, not both. This uses standard cron format and is supported by native scheduler

  • offset (str) –

  • kickoff_time_input_arg (str) –

    This is a convenient argument to use when your code needs to know what time a run was kicked off. Supply the name of the input argument of your workflow to this argument here. Note that until Flyte has an atomic clock, there could be a few seconds here and there. That is, if your run is supposed to kick off at 3pm UTC every Weds, it may actually be 15:00:02 or something. Example

    @workflow
    def my_wf(kickoff_time: datetime): ...
    
    schedule = CronSchedule(
        schedule="*/1 * * * *"
        kickoff_time_input_arg="kickoff_time")
    

Methods

classmethod from_flyte_idl(pb2_object)#
Parameters

pb2_object (flyteidl.admin.schedule_pb2.Schedule) –

Return type

Schedule

serialize_to_string()#
Return type

str

short_string()#
Return type

Text

to_flyte_idl()#
Return type

flyteidl.admin.schedule_pb2.Schedule

verbose_string()#
Return type

Text

Attributes

cron_expression

Text

Type

rtype

cron_schedule

Schedule.CronSchedule

Type

rtype

is_empty
kickoff_time_input_arg
rate

Schedule.FixedRate

Type

rtype

schedule_expression