Skip to main content

Trigger

Represents a trigger in the Flyte platform.

Attributes

AttributeTypeDescription
pb2trigger_definition_pb2.TriggerThis attribute stores a trigger_definition_pb2.Trigger object, which is the protobuf representation of the trigger, used for interacting with the Flyte API.
details`TriggerDetailsNone` = None

Methods


create()

@classmethod
def create(
trigger: flyte.Trigger,
task_name: str,
task_version: str | 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`

Returns

TypeDescription
[Trigger](trigger.md?sid=flyte_remote__trigger_trigger)

get()

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

Retrieve a trigger by its name and associated task name.

Parameters

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

Returns

TypeDescription
TriggerDetails

listall()

@classmethod
def listall(
task_name: str | None,
task_version: str | 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`
task_version`strNone`
limitint = 100The maximum number of triggers to return in a single page.

Returns

TypeDescription
AsyncIterator[[Trigger](trigger.md?sid=flyte_remote__trigger_trigger)]

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.
activeboolA boolean indicating whether the trigger should be active (True) or paused (False).

delete()

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

Delete a trigger by its name.

Parameters

NameTypeDescription
namestrThe name of the trigger to delete.
task_namestrThe name of the task associated with the trigger.
project`strNone`
domain`strNone`

id()

@classmethod
def id() - > identifier_pb2.TriggerIdentifier

Get the unique identifier for the trigger.

Returns

TypeDescription
identifier_pb2.TriggerIdentifier

name()

@classmethod
def name() - > str

Get the name of the trigger.

Returns

TypeDescription
str

task_name()

@classmethod
def task_name() - > str

Get the name of the task associated with this trigger.

Returns

TypeDescription
str

automation_spec()

@classmethod
def automation_spec() - > common_pb2.TriggerAutomationSpec

Get the automation specification for the trigger.

Returns

TypeDescription
common_pb2.TriggerAutomationSpec

url()

@classmethod
def url() - > str

Get the console URL for viewing the trigger.

Returns

TypeDescription
str

get_details()

@classmethod
def get_details() - > TriggerDetails

Get detailed information about this trigger.

Returns

TypeDescription
TriggerDetails

is_active()

@classmethod
def is_active() - > bool

Check if the trigger is currently active.

Returns

TypeDescription
bool