Skip to main content

Trigger

Represents a trigger in the Flyte platform.

Attributes

AttributeTypeDescription
pb2trigger_definition_pb2.TriggerThe underlying Protobuf message containing the canonical definition and state of the trigger.
details`TriggerDetailsNone` = None

Methods


create()

@classmethod
def create(
trigger: flyte.Trigger,
task_name: str,
task_version: str | None = None
) - > [Trigger](trigger.md?sid=flyte_remote__trigger_trigger)

Create a new trigger in the Flyte platform.

Parameters

NameTypeDescription
triggerflyte.TriggerThe flyte.Trigger object containing the trigger definition.
task_namestrOptional name of the task to associate with the trigger.
task_version`strNone` = None

Returns

TypeDescription
[Trigger](trigger.md?sid=flyte_remote__trigger_trigger)The newly created Trigger instance containing the deployment details.

get()

@classmethod
def get(
name: str,
task_name: str
) - > TriggerDetails

Retrieve a trigger by its name and associated task name.

Parameters

NameTypeDescription
namestrThe unique name of the trigger to retrieve.
task_namestrThe name of the task associated with the trigger.

Returns

TypeDescription
TriggerDetailsThe detailed information and metadata for the specified trigger.

listall()

@classmethod
def listall(
task_name: str | None = None,
task_version: str | None = None,
limit: int = 100
) - > AsyncIterator[[Trigger](trigger.md?sid=flyte_remote__trigger_trigger)]

List all triggers associated with a specific task or all tasks if no task name is provided.

Parameters

NameTypeDescription
task_name`strNone` = None
task_version`strNone` = None
limitint = 100The maximum number of triggers to return in a single batch.

Returns

TypeDescription
AsyncIterator[[Trigger](trigger.md?sid=flyte_remote__trigger_trigger)]An asynchronous iterator yielding Trigger instances matching the filter criteria.

update()

@classmethod
def update(
name: str,
task_name: str,
active: bool
)

Pause a trigger by its name and associated task name.

Parameters

NameTypeDescription
namestrThe name of the trigger to update.
task_namestrThe name of the task associated with the trigger.
activeboolThe desired state of the trigger; set to True to enable or False to pause.

delete()

@classmethod
def delete(
name: str,
task_name: str,
project: str | None = None,
domain: str | None = None
)

Delete a trigger by its name.

Parameters

NameTypeDescription
namestrThe name of the trigger to be removed.
task_namestrThe name of the task associated with the trigger.
project`strNone` = None
domain`strNone` = None

id()

@classmethod
def id() - > identifier_pb2.TriggerIdentifier

Get the unique identifier for the trigger.

Returns

TypeDescription
identifier_pb2.TriggerIdentifierThe protobuf identifier containing the trigger's name, project, and domain.

name()

@classmethod
def name() - > str

Get the name of the trigger.

Returns

TypeDescription
strThe string name of the trigger.

task_name()

@classmethod
def task_name() - > str

Get the name of the task associated with this trigger.

Returns

TypeDescription
strThe name of the task that this trigger executes.

automation_spec()

@classmethod
def automation_spec() - > common_pb2.TriggerAutomationSpec

Get the automation specification for the trigger.

Returns

TypeDescription
common_pb2.TriggerAutomationSpecThe protobuf specification defining the automation logic (e.g., schedule).

url()

@classmethod
def url() - > str

Get the console URL for viewing the trigger.

Returns

TypeDescription
strA fully qualified URL to view the trigger in the Flyte Console.

get_details()

@classmethod
def get_details() - > TriggerDetails

Get detailed information about this trigger.

Returns

TypeDescription
TriggerDetailsThe full details of the trigger, fetched from the platform if not already cached.

is_active()

@classmethod
def is_active() - > bool

Check if the trigger is currently active.

Returns

TypeDescription
boolTrue if the trigger is enabled and running, False otherwise.