<@ULVA73B9P> When running a deployment as an actio...
# marvin-in-the-wild
j
@Marvin When running a deployment as an action in an automation where the trigger was a flow failing, can I access the failing flows parameters in the new flow run that is triggered?
m
To access the parameters of a failing flow in a new flow run triggered by an automation, you can pass the necessary parameters when configuring the automation. Here’s a brief overview: 1. Create the automation: In the automation’s definition, specify that the trigger is the failure of a flow. 2. Retrieve parameters: Make sure to retrieve the parameters of the failing flow when the new flow run is triggered. Here is an example outline to guide you:
Copy code
python
# This is an example event-driven automation YAML configuration
automations:
  - name: Handle Failed Flow
    description: React to a failed flow by triggering a new flow run
    enabled: true
    trigger:
      type: event
      situational:
        resource:
          type: prefect.flow-run
          failed:
            role: any
    actions:
      - type: run-deployment
        parameters: "parameters from the failed flow"

# You can access the failed flow's parameters in your new flow run
from prefect import flow

@flow
def new_flow(failed_flow_parameters: dict):
    # Use the parameters from the failed flow
    print(f"Failed Flow Parameters: {failed_flow_parameters}")

# This flow will be triggered by the automation when another flow fails
To get a clear, step-by-step guide tailored to your setup, refer to the official documentation links: - Automations Guide - Automations Concepts