Skip to main content

prefect.server.events.actions

The actions consumer watches for actions that have been triggered by Automations and carries them out. Also includes the various concrete subtypes of Actions

Functions

record_action_happening

Record that an action has happened, with an expiration of an hour.

action_has_already_happened

Check if the action has already happened

consumer

Classes

ActionFailed

Action

An Action that may be performed when an Automation is triggered Methods:

act

Perform the requested Action

fail

logging_context

Common logging context for all actions

model_validate_list

reset_fields

Reset the fields of the model that are in the _reset_fields set. Returns:
  • A new instance of the model with the reset fields.

succeed

DoNothing

Do nothing when an Automation is triggered Methods:

act

describe_for_cli

A human-readable description of the action

EmitEventAction

Methods:

act

create_event

Create an event from the TriggeredAction

describe_for_cli

A human-readable description of the action

ExternalDataAction

Base class for Actions that require data from an external source such as the Orchestration API Methods:

describe_for_cli

A human-readable description of the action

events_api_client

orchestration_client

reason_from_response

JinjaTemplateAction

Base class for Actions that use Jinja templates supplied by the user and are rendered with a context containing data from the triggered action, and the orchestration API. Methods:

events_api_client

instantiate_object

orchestration_client

reason_from_response

templates_in_dictionary

validate_template

DeploymentAction

Base class for Actions that operate on Deployments and need to infer them from events Methods:

deployment_id_to_use

describe_for_cli

A human-readable description of the action

selected_deployment_requires_id

DeploymentCommandAction

Executes a command against a matching deployment Methods:

act

command

Execute the deployment command

events_api_client

orchestration_client

reason_from_response

selected_deployment_requires_id

RunDeployment

Runs the given deployment with the given parameters Methods:

act

command

command

Execute the deployment command

instantiate_object

render_parameters

templates_in_dictionary

validate_parameters

validate_template

PauseDeployment

Pauses the given Deployment Methods:

act

command

command

Execute the deployment command

ResumeDeployment

Resumes the given Deployment Methods:

act

command

command

Execute the deployment command

FlowRunAction

An action that operates on a flow run Methods:

events_api_client

flow_run

orchestration_client

reason_from_response

FlowRunStateChangeAction

Changes the state of a flow run associated with the trigger Methods:

act

flow_run

new_state

Return the new state for the flow run

ChangeFlowRunState

Changes the state of a flow run associated with the trigger Methods:

act

new_state

new_state

Return the new state for the flow run

CancelFlowRun

Cancels a flow run associated with the trigger Methods:

act

new_state

new_state

Return the new state for the flow run

DeleteFlowRun

Deletes a flow run associated with the trigger Methods:

act

flow_run

SuspendFlowRun

Suspends a flow run associated with the trigger Methods:

act

new_state

new_state

Return the new state for the flow run

ResumeFlowRun

Resumes a paused or suspended flow run associated with the trigger Methods:

act

flow_run

CallWebhook

Call a webhook when an Automation is triggered. Methods:

act

ensure_payload_is_a_string

Temporary measure while we migrate payloads from being a dictionary to a string template. This covers both reading from the database where values may currently be a dictionary, as well as the API, where older versions of the frontend may be sending a JSON object with the single "message" key.

instantiate_object

templates_in_dictionary

validate_payload_templates

Validate user-provided payload template.

validate_template

SendNotification

Send a notification when an Automation is triggered Methods:

act

instantiate_object

is_valid_template

render

templates_in_dictionary

validate_template

WorkPoolAction

Base class for Actions that operate on Work Pools and need to infer them from events Methods:

describe_for_cli

A human-readable description of the action

selected_work_pool_requires_id

work_pool_id_to_use

WorkPoolCommandAction

Methods:

act

command

Issue the command to the Work Pool

events_api_client

orchestration_client

reason_from_response

target_work_pool

PauseWorkPool

Pauses a Work Pool Methods:

act

command

command

Issue the command to the Work Pool

target_work_pool

ResumeWorkPool

Resumes a Work Pool Methods:

act

command

command

Issue the command to the Work Pool

target_work_pool

WorkQueueAction

Base class for Actions that operate on Work Queues and need to infer them from events Methods:

describe_for_cli

A human-readable description of the action

selected_work_queue_requires_id

work_queue_id_to_use

WorkQueueCommandAction

Methods:

act

command

Issue the command to the Work Queue

events_api_client

orchestration_client

reason_from_response

selected_work_queue_requires_id

PauseWorkQueue

Pauses a Work Queue Methods:

act

command

command

Issue the command to the Work Queue

ResumeWorkQueue

Resumes a Work Queue Methods:

act

command

command

Issue the command to the Work Queue

AutomationAction

Base class for Actions that operate on Automations and need to infer them from events Methods:

automation_id_to_use

describe_for_cli

A human-readable description of the action

selected_automation_requires_id

AutomationCommandAction

Methods:

act

command

Issue the command to the Work Queue

events_api_client

orchestration_client

reason_from_response

selected_automation_requires_id

PauseAutomation

Pauses a Work Queue Methods:

act

command

command

Issue the command to the Work Queue

ResumeAutomation

Resumes a Work Queue Methods:

act

command

command

Issue the command to the Work Queue