Skip to main content

Trigger

Specification for a scheduled trigger that can be associated with any Flyte task. Triggers run tasks on a schedule (cron or fixed-rate). They are set only in the @env.task decorator via the triggers parameter. The same Trigger object can be associated with multiple tasks.

Attributes

AttributeTypeDescription
namestrUnique name for the trigger (required).
automationUnion[[Cron](cron.md?sid=flyte__trigger_cron), [FixedRate](fixedrate.md?sid=flyte__trigger_fixedrate)]Schedule type — Cron(...) or FixedRate(...) (required).
descriptionstr = ""Human-readable description (max 255 characters).
auto_activatebool = TrueWhether to activate the trigger automatically on deployment.
inputs`Dict[str, Any]None` = None
env_vars`Dict[str, str]None` = None
interruptible`boolNone` = None
overwrite_cachebool = FalseForce cache refresh on triggered runs.
queue`strNone` = None
labels`Mapping[str, str]None` = None
annotations`Mapping[str, str]None` = None
notifications`NamedRuleNotification
custom_context`Mapping[str, str]None` = None

Constructor

Signature

def Trigger(
name: str = null,
automation: Union[[Cron](cron.md?sid=flyte__trigger_cron), [FixedRate](fixedrate.md?sid=flyte__trigger_fixedrate)] = null,
description: str = "",
auto_activate: bool = True,
inputs: Dict[str, Any]| None = None,
env_vars: Dict[str, str]| None = None,
interruptible: bool | None = None,
overwrite_cache: bool = False,
queue: str | None = None,
labels: Mapping[str, str]| None = None,
annotations: Mapping[str, str]| None = None,
notifications: NamedRule | Notification | Tuple[[Notification](../notify/notifiers/notification.md?sid=flyte_notify__notifiers_notification), ...]| None = None,
custom_context: Mapping[str, str]| None = None
) - > null

Parameters

NameTypeDescription
namestr = nullUnique name for the trigger (required).
automationUnion[[Cron](cron.md?sid=flyte__trigger_cron), [FixedRate](fixedrate.md?sid=flyte__trigger_fixedrate)] = nullSchedule type — Cron(...) or FixedRate(...) (required).
descriptionstr = ""Human-readable description (max 255 characters). Default "".
auto_activatebool = TrueWhether to activate the trigger automatically on deployment.
Default `True`. |

| inputs | Dict[str, Any]| None = None | Default input values for triggered runs. Use flyte.TriggerTime to bind the trigger's scheduled time to an input parameter. | | env_vars | Dict[str, str]| None = None | Environment variables for triggered runs (overrides the task's configured values). | | interruptible | bool | None = None | Whether triggered runs use spot/preemptible instances. None (default) preserves the task's configured behavior. Overrides the task's configured value. | | overwrite_cache | bool = False | Force cache refresh on triggered runs. Default False. | | queue | str | None = None | Queue name for triggered runs (overrides the task's configured value). | | labels | Mapping[str, str]| None = None | Kubernetes labels to attach to triggered runs. | | annotations | Mapping[str, str]| None = None | Kubernetes annotations to attach to triggered runs. | | notifications | NamedRule | Notification | Tuple[[Notification](../notify/notifiers/notification.md?sid=flyte_notify__notifiers_notification), ...]| None = None | null | | custom_context | Mapping[str, str]| None = None | Metadata propagated through the entire task hierarchy of triggered runs. Readable inside any task via flyte.ctx().custom_context. |


Methods


daily()

@classmethod
def daily(
trigger_time_input_key: str | None = None,
name: str = "daily",
description: str = "A trigger that runs daily at midnight",
auto_activate: bool = True,
inputs: Dict[str, Any]| None = None,
env_vars: Dict[str, str]| None = None,
interruptible: bool | None = None,
overwrite_cache: bool = False,
queue: str | None = None,
labels: Mapping[str, str]| None = None,
annotations: Mapping[str, str]| None = None,
custom_context: Mapping[str, str]| None = None
) - > [Trigger](../remote/trigger/trigger.md?sid=flyte_remote__trigger_trigger)

Creates a Cron trigger that runs daily at midnight.

Parameters

NameTypeDescription
trigger_time_input_key`strNone` = None
namestr = "daily"The name of the trigger, default is "daily".
descriptionstr = "A trigger that runs daily at midnight"A description of the trigger.
auto_activatebool = TrueWhether the trigger should be automatically activated.
inputs`Dict[str, Any]None` = None
env_vars`Dict[str, str]None` = None
interruptible`boolNone` = None
overwrite_cachebool = FalseWhether to overwrite the cache.
queue`strNone` = None
labels`Mapping[str, str]None` = None
annotations`Mapping[str, str]None` = None
custom_context`Mapping[str, str]None` = None

Returns

TypeDescription
[Trigger](../remote/trigger/trigger.md?sid=flyte_remote__trigger_trigger)A trigger that runs daily at midnight.

hourly()

@classmethod
def hourly(
trigger_time_input_key: str | None = None,
name: str = "hourly",
description: str = "A trigger that runs every hour",
auto_activate: bool = True,
inputs: Dict[str, Any]| None = None,
env_vars: Dict[str, str]| None = None,
interruptible: bool | None = None,
overwrite_cache: bool = False,
queue: str | None = None,
labels: Mapping[str, str]| None = None,
annotations: Mapping[str, str]| None = None,
custom_context: Mapping[str, str]| None = None
) - > [Trigger](../remote/trigger/trigger.md?sid=flyte_remote__trigger_trigger)

Creates a Cron trigger that runs every hour.

Parameters

NameTypeDescription
trigger_time_input_key`strNone` = None
namestr = "hourly"The name of the trigger, default is "hourly".
descriptionstr = "A trigger that runs every hour"A description of the trigger.
auto_activatebool = TrueWhether the trigger should be automatically activated.
inputs`Dict[str, Any]None` = None
env_vars`Dict[str, str]None` = None
interruptible`boolNone` = None
overwrite_cachebool = FalseWhether to overwrite the cache.
queue`strNone` = None
labels`Mapping[str, str]None` = None
annotations`Mapping[str, str]None` = None
custom_context`Mapping[str, str]None` = None

Returns

TypeDescription
[Trigger](../remote/trigger/trigger.md?sid=flyte_remote__trigger_trigger)A trigger that runs every hour, on the hour.

minutely()

@classmethod
def minutely(
trigger_time_input_key: str | None = None,
name: str = "minutely",
description: str = "A trigger that runs every minute",
auto_activate: bool = True,
inputs: Dict[str, Any]| None = None,
env_vars: Dict[str, str]| None = None,
interruptible: bool | None = None,
overwrite_cache: bool = False,
queue: str | None = None,
labels: Mapping[str, str]| None = None,
annotations: Mapping[str, str]| None = None,
custom_context: Mapping[str, str]| None = None
) - > [Trigger](../remote/trigger/trigger.md?sid=flyte_remote__trigger_trigger)

Creates a Cron trigger that runs every minute.

Parameters

NameTypeDescription
trigger_time_input_key`strNone` = None
namestr = "minutely"The name of the trigger, default is "every_minute".
descriptionstr = "A trigger that runs every minute"A description of the trigger.
auto_activatebool = TrueWhether the trigger should be automatically activated.
inputs`Dict[str, Any]None` = None
env_vars`Dict[str, str]None` = None
interruptible`boolNone` = None
overwrite_cachebool = FalseWhether to overwrite the cache.
queue`strNone` = None
labels`Mapping[str, str]None` = None
annotations`Mapping[str, str]None` = None
custom_context`Mapping[str, str]None` = None

Returns

TypeDescription
[Trigger](../remote/trigger/trigger.md?sid=flyte_remote__trigger_trigger)A trigger that runs every minute.

weekly()

@classmethod
def weekly(
trigger_time_input_key: str | None = None,
name: str = "weekly",
description: str = "A trigger that runs weekly on Sundays at midnight",
auto_activate: bool = True,
inputs: Dict[str, Any]| None = None,
env_vars: Dict[str, str]| None = None,
interruptible: bool | None = None,
overwrite_cache: bool = False,
queue: str | None = None,
labels: Mapping[str, str]| None = None,
annotations: Mapping[str, str]| None = None,
custom_context: Mapping[str, str]| None = None
) - > [Trigger](../remote/trigger/trigger.md?sid=flyte_remote__trigger_trigger)

Creates a Cron trigger that runs weekly on Sundays at midnight.

Parameters

NameTypeDescription
trigger_time_input_key`strNone` = None
namestr = "weekly"The name of the trigger, default is "weekly".
descriptionstr = "A trigger that runs weekly on Sundays at midnight"A description of the trigger.
auto_activatebool = TrueWhether the trigger should be automatically activated.
inputs`Dict[str, Any]None` = None
env_vars`Dict[str, str]None` = None
interruptible`boolNone` = None
overwrite_cachebool = FalseWhether to overwrite the cache.
queue`strNone` = None
labels`Mapping[str, str]None` = None
annotations`Mapping[str, str]None` = None
custom_context`Mapping[str, str]None` = None

Returns

TypeDescription
[Trigger](../remote/trigger/trigger.md?sid=flyte_remote__trigger_trigger)A trigger that runs weekly on Sundays at midnight.

monthly()

@classmethod
def monthly(
trigger_time_input_key: str | None = None,
name: str = "monthly",
description: str = "A trigger that runs monthly on the 1st at midnight",
auto_activate: bool = True,
inputs: Dict[str, Any]| None = None,
env_vars: Dict[str, str]| None = None,
interruptible: bool | None = None,
overwrite_cache: bool = False,
queue: str | None = None,
labels: Mapping[str, str]| None = None,
annotations: Mapping[str, str]| None = None,
custom_context: Mapping[str, str]| None = None
) - > [Trigger](../remote/trigger/trigger.md?sid=flyte_remote__trigger_trigger)

Creates a Cron trigger that runs monthly on the 1st at midnight.

Parameters

NameTypeDescription
trigger_time_input_key`strNone` = None
namestr = "monthly"The name of the trigger, default is "monthly".
descriptionstr = "A trigger that runs monthly on the 1st at midnight"A description of the trigger.
auto_activatebool = TrueWhether the trigger should be automatically activated.
inputs`Dict[str, Any]None` = None
env_vars`Dict[str, str]None` = None
interruptible`boolNone` = None
overwrite_cachebool = FalseWhether to overwrite the cache.
queue`strNone` = None
labels`Mapping[str, str]None` = None
annotations`Mapping[str, str]None` = None
custom_context`Mapping[str, str]None` = None

Returns

TypeDescription
[Trigger](../remote/trigger/trigger.md?sid=flyte_remote__trigger_trigger)A trigger that runs monthly on the 1st at midnight.