ScheduleRecurrence Class

Defines the frequency, interval and start time of a pipeline Schedule.

ScheduleRecurrence also allows you to specify the time zone and the hours or minutes or week days for the recurrence.

Initialize a schedule recurrence.

It also allows to specify the time zone and the hours or minutes or week days for the recurrence.

Inheritance
builtins.object
ScheduleRecurrence

Constructor

ScheduleRecurrence(frequency, interval, start_time=None, time_zone=None, hours=None, minutes=None, week_days=None, time_of_day=None)

Parameters

frequency
str
Required

The unit of time that describes how often the schedule fires. Can be "Minute", "Hour", "Day", "Week", or "Month".

interval
int
Required

A value that specifies how often the schedule fires based on the frequency, which is the number of time units to wait until the schedule fires again.

start_time
datetime or str
default value: None

A datetime object which describes the start date and time. The tzinfo of the datetime object should be none, use time_zone property to specify a time zone if needed. You can also specify this parameter as a string in this format: YYYY-MM-DDThh:mm:ss. If None is provided, the first workload is run instantly and the future workloads are run based on the schedule. If the start time is in the past, the first workload is run at the next calculated run time.

If start_time matches week_days and time_of_day (or hours and minutes), then the first work load does not run at start_time, but instead runs at the next calculated run time.

time_zone
TimeZone
default value: None

Specify the time zone of the start_time. If None is provided UTC is used.

hours
list[int]
default value: None

If you specify "Day" or "Week" for frequency, you can specify one or more integers from 0 to 23, separated by commas, as the hours of the day when you want to run the workflow. For example, if you specify "10", "12" and "14", you get 10 AM, 12 PM, and 2 PM as the hour marks. Note: only time_of_day or hours and minutes can be used.

minutes
list[int]
default value: None

If you specify "Day" or "Week" for frequency, you can specify one or more integers from 0 to 59, separated by commas, as the minutes of the hour when you want to run the workflow. For example, you can specify "30" as the minute mark and using the previous example for hours of the day, you get 10:30 AM, 12:30 PM, and 2:30 PM. Note: only time_of_day or hours and minutes can be used.

week_days
list[str]
default value: None

If you specify "Week" for frequency, you can specify one or more days, separated by commas, when you want to run the workflow: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday".

time_of_day
str
default value: None

If you specify "Day" or "Week" for frequency, you can specify a time of day for the schedule to run as a string in the form hh:mm. For example, if you specify "15:30" then the schedule will run at 3:30pm. Note: only time_of_day or hours and minutes can be used.

frequency
str
Required

The unit of time that describes how often the schedule fires. Can be "Minute", "Hour", "Day", "Week", or "Month".

interval
int
Required

A value that specifies how often the schedule fires based on the frequency, which is the number of time units to wait until the schedule fires again.

start_time
datetime or str
Required

A datetime object which describes the start date and time. The tzinfo of the datetime object should be none, use time_zone property to specify a time zone if needed. Can also be a string in this format: YYYY-MM-DDThh:mm:ss. If None is provided the first workload is run instantly and the future workloads are run based on the schedule. If the start time is in the past, the first workload is run at the next calculated run time.

If start_time matches week_days and time_of_day (or hours and minutes), then the first work load does not run at start_time, but instead runs at the next calculated run time.

time_zone
TimeZone
Required

Specify the time zone of the start_time. If None is provided UTC is used.

hours
list[int]
Required

If you specify "Day" or "Week" for frequency, you can specify one or more integers from 0 to 23, separated by commas, as the hours of the day when you want to run the workflow. For example, if you specify "10", "12" and "14", you get 10 AM, 12 PM, and 2 PM as the hour marks. Note: only time_of_day or hours and minutes can be used.

minutes
list[int]
Required

If you specify "Day" or "Week" for frequency, you can specify one or more integers from 0 to 59, separated by commas, as the minutes of the hour when you want to run the workflow. For example, you can specify "30" as the minute mark and using the previous example for hours of the day, you get 10:30 AM, 12:30 PM, and 2:30 PM. Note: only time_of_day or hours and minutes can be used.

week_days
list[str]
Required

If you specify "Week" for frequency, you can specify one or more days, separated by commas, when you want to run the workflow: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday"

time_of_day
str
Required

If you specify "Day" or "Week" for frequency, you can specify a time of day for the schedule to run as a string in the form hh:mm. For example, if you specify "15:30" then the schedule will run at 3:30pm. Note: only time_of_day or hours and minutes can be used.

Remarks

A ScheduleRecurrence is used when creating a Schedule for a Pipeline as follows:


   from azureml.pipeline.core import Schedule, ScheduleRecurrence

   recurrence = ScheduleRecurrence(frequency="Hour", interval=12)
   schedule = Schedule.create(workspace, name="TestSchedule", pipeline_id=pipeline.id,
                              experiment_name="experiment_name", recurrence=recurrence)

The following are some examples of valid ScheduleRecurrences:


   from azureml.pipeline.core import ScheduleRecurrence

   # Submit the Pipeline every 15 minutes
   recurrence = ScheduleRecurrence(frequency="Minute", interval=15)
   # Submit the Pipeline every 2 weeks on Monday and Wednesday at 6:30pm UTC
   recurrence = ScheduleRecurrence(frequency="Week", interval=2, week_days=["Monday", "Wednesday"],
                                   time_of_day="18:30")
   # Submit the Pipeline on the first day of every month starting November 1, 2019 at 9AM
   recurrence = ScheduleRecurrence(frequency="Month", interval=1, start_time="2019-11-01T09:00:00")
   # Submit the Pipeline every hour on the 55th minute starting on January 13th, 2020 at 12:55pm
   # if the specified start time is in the past, the first workload is run at the next future 55th minute
   # of the hour.
   recurrence = ScheduleRecurrence(frequency="Hour", interval=1, start_time="2020-01-13T12:55:00")

Methods

validate

Validate the schedule recurrence.

validate

Validate the schedule recurrence.

validate()