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
| Attribute | Type | Description |
|---|---|---|
| name | str | Unique name for the trigger (required). |
| automation | Union[[Cron](cron.md?sid=flyte__trigger_cron), [FixedRate](fixedrate.md?sid=flyte__trigger_fixedrate)] | Schedule type — Cron(...) or FixedRate(...) (required). |
| description | str = "" | Human-readable description (max 255 characters). |
| auto_activate | bool = True | Whether to activate the trigger automatically on deployment. |
| inputs | `Dict[str, Any] | None` = None |
| env_vars | `Dict[str, str] | None` = None |
| interruptible | `bool | None` = None |
| overwrite_cache | bool = False | Force cache refresh on triggered runs. |
| queue | `str | None` = None |
| labels | `Mapping[str, str] | None` = None |
| annotations | `Mapping[str, str] | None` = None |
| notifications | `NamedRule | Notification |
| 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
| Name | Type | Description |
|---|---|---|
| name | str = null | Unique name for the trigger (required). |
| automation | Union[[Cron](cron.md?sid=flyte__trigger_cron), [FixedRate](fixedrate.md?sid=flyte__trigger_fixedrate)] = null | Schedule type — Cron(...) or FixedRate(...) (required). |
| description | str = "" | Human-readable description (max 255 characters). Default "". |
| auto_activate | bool = True | Whether 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
| Name | Type | Description |
|---|---|---|
| trigger_time_input_key | `str | None` = None |
| name | str = "daily" | The name of the trigger, default is "daily". |
| description | str = "A trigger that runs daily at midnight" | A description of the trigger. |
| auto_activate | bool = True | Whether the trigger should be automatically activated. |
| inputs | `Dict[str, Any] | None` = None |
| env_vars | `Dict[str, str] | None` = None |
| interruptible | `bool | None` = None |
| overwrite_cache | bool = False | Whether to overwrite the cache. |
| queue | `str | None` = None |
| labels | `Mapping[str, str] | None` = None |
| annotations | `Mapping[str, str] | None` = None |
| custom_context | `Mapping[str, str] | None` = None |
Returns
| Type | Description |
|---|---|
[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
| Name | Type | Description |
|---|---|---|
| trigger_time_input_key | `str | None` = None |
| name | str = "hourly" | The name of the trigger, default is "hourly". |
| description | str = "A trigger that runs every hour" | A description of the trigger. |
| auto_activate | bool = True | Whether the trigger should be automatically activated. |
| inputs | `Dict[str, Any] | None` = None |
| env_vars | `Dict[str, str] | None` = None |
| interruptible | `bool | None` = None |
| overwrite_cache | bool = False | Whether to overwrite the cache. |
| queue | `str | None` = None |
| labels | `Mapping[str, str] | None` = None |
| annotations | `Mapping[str, str] | None` = None |
| custom_context | `Mapping[str, str] | None` = None |
Returns
| Type | Description |
|---|---|
[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
| Name | Type | Description |
|---|---|---|
| trigger_time_input_key | `str | None` = None |
| name | str = "minutely" | The name of the trigger, default is "every_minute". |
| description | str = "A trigger that runs every minute" | A description of the trigger. |
| auto_activate | bool = True | Whether the trigger should be automatically activated. |
| inputs | `Dict[str, Any] | None` = None |
| env_vars | `Dict[str, str] | None` = None |
| interruptible | `bool | None` = None |
| overwrite_cache | bool = False | Whether to overwrite the cache. |
| queue | `str | None` = None |
| labels | `Mapping[str, str] | None` = None |
| annotations | `Mapping[str, str] | None` = None |
| custom_context | `Mapping[str, str] | None` = None |
Returns
| Type | Description |
|---|---|
[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
| Name | Type | Description |
|---|---|---|
| trigger_time_input_key | `str | None` = None |
| name | str = "weekly" | The name of the trigger, default is "weekly". |
| description | str = "A trigger that runs weekly on Sundays at midnight" | A description of the trigger. |
| auto_activate | bool = True | Whether the trigger should be automatically activated. |
| inputs | `Dict[str, Any] | None` = None |
| env_vars | `Dict[str, str] | None` = None |
| interruptible | `bool | None` = None |
| overwrite_cache | bool = False | Whether to overwrite the cache. |
| queue | `str | None` = None |
| labels | `Mapping[str, str] | None` = None |
| annotations | `Mapping[str, str] | None` = None |
| custom_context | `Mapping[str, str] | None` = None |
Returns
| Type | Description |
|---|---|
[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
| Name | Type | Description |
|---|---|---|
| trigger_time_input_key | `str | None` = None |
| name | str = "monthly" | The name of the trigger, default is "monthly". |
| description | str = "A trigger that runs monthly on the 1st at midnight" | A description of the trigger. |
| auto_activate | bool = True | Whether the trigger should be automatically activated. |
| inputs | `Dict[str, Any] | None` = None |
| env_vars | `Dict[str, str] | None` = None |
| interruptible | `bool | None` = None |
| overwrite_cache | bool = False | Whether to overwrite the cache. |
| queue | `str | None` = None |
| labels | `Mapping[str, str] | None` = None |
| annotations | `Mapping[str, str] | None` = None |
| custom_context | `Mapping[str, str] | None` = None |
Returns
| Type | Description |
|---|---|
[Trigger](../remote/trigger/trigger.md?sid=flyte_remote__trigger_trigger) | A trigger that runs monthly on the 1st at midnight. |