CronTrigger Class

Cron Trigger for a job schedule.

Inheritance
azure.ai.ml.entities._schedule.trigger.TriggerBase
CronTrigger

Constructor

CronTrigger(*, expression: str, start_time: str | datetime | None = None, end_time: str | datetime | None = None, time_zone: str | TimeZone = TimeZone.UTC)

Keyword-Only Parameters

Name Description
expression
str

The cron expression of schedule, following NCronTab format.

start_time

The start time for the trigger. If using a datetime object, leave the tzinfo as None and use the time_zone parameter to specify a time zone if needed. If using a string, use the format YYYY-MM-DDThh:mm:ss. Defaults to running the first workload instantly and continuing future workloads based on the schedule. If the start time is in the past, the first workload is run at the next calculated run time.

end_time

The start time for the trigger. If using a datetime object, leave the tzinfo as None and use the time_zone parameter to specify a time zone if needed. If using a string, use the format YYYY-MM-DDThh:mm:ss. Note that end_time is not supported for compute schedules.

time_zone

The time zone where the schedule will run. Defaults to UTC(+00:00). Note that this applies to the start_time and end_time.

Default value: TimeZone.UTC

Examples

Configuring a CronTrigger.


   from datetime import datetime

   from azure.ai.ml.constants import TimeZone
   from azure.ai.ml.entities import CronTrigger

   trigger = CronTrigger(
       expression="15 10 * * 1",
       start_time=datetime(year=2022, month=3, day=10, hour=10, minute=15),
       end_time=datetime(year=2022, month=6, day=10, hour=10, minute=15),
       time_zone=TimeZone.PACIFIC_STANDARD_TIME,
   )