https://prefect.io logo
Title
f

Florian Giroud

01/27/2023, 5:10 PM
Hi Prefect, I have a question with regards to automation. If we have an automation kick-off another deployment to run, how do we get the id of the original deployment that entered the specified state ? Is that a parameter we can get somewhere ? or using the API ? Would appreciate your inputs there Tx !
c

Christopher Boyd

01/30/2023, 9:47 PM
Hi Florian, You have options to return
flow_run
,
flow
,
deployment
, and
work_queue
using Jinja with automation notifications: https://docs.prefect.io/ui/automations/?h=automation#templating-notifications-with-jinja
f

Florian Giroud

01/31/2023, 7:50 AM
Hi @Christopher Boyd, in that case I’m not interested in notifications, my automation triggers another deployment. Basically I have a flow -> triggers an automation -> triggers another flow In the trigerred flow, how can I get the originator for the automation ?
c

Christopher Boyd

01/31/2023, 2:34 PM
Hi Florian - I understand. The automation creates another flow_run which then immediately executes. To get the originator for the flow_run , you would need a notification for what triggered the new one - the flow_run is not contextually aware of how it was created otherwise
E.g. - the flow_run doesn’t have a mechanism to know that it was created by a previously failed flow that triggered an automation
the automation itself can infer that, and send a notification
f

Florian Giroud

01/31/2023, 2:45 PM
Tx @Christopher Boyd, that’s maybe something to add. The same way we configure the template for the notification, we could configure the payload passed to the job when it’s not a notification
🧐 1
c

Christopher Boyd

01/31/2023, 2:47 PM
That’s an interesting thought, I’ll raise that feedback
:gratitude-thank-you: 1