https://prefect.io logo
m

Mohan kancherla

07/26/2023, 3:56 PM
Hello, Does anyone if prefect can provide this? I have a flow running in Deployment A and there are additional flows in deployment B. I need to verify if the flow in deployment A is successfully ran (in the scheduled time) to kick-off flows in Deployment B. I tried searching in documents but couldn't find anything helpful. Can anyone please guide me if this is possible or share the related document?
d

Deceivious

07/26/2023, 4:13 PM
Not out of the box. But you can use the prefect python client OR api to code the functionality you want on Deployment B flow run.
n

Nate

07/26/2023, 4:46 PM
hi @Mohan kancherla - there's a few ways to go about this - 2 common patterns are: ā€¢ events, if you're on prefect cloud. you can create an automation to
Run a Deployment
when you see a
prefect.flow-run.Completed
event that has your
Deployment A
as a related resource ā€¢ you can have a parent flow that orchestrates the deployments
Copy code
from prefect.deployments import run_deployment

@flow
def parent():
    A = run_deployment("flow-a/deployment-a")
    if A.state.is_completed():
       B = run_deployment("flow-b/deployment-b")
m

Mohan kancherla

07/26/2023, 4:52 PM
I like the approach 2 and does it also accepts the environmental variables(parameters) to the flow, in the run deployment?
n

Nate

07/26/2023, 5:10 PM
you can pass
parameters
to
run_deployment
, which should be a dictionary of the parameters that the flow run accepts (must be JSON serializable!)
šŸ‘ 1
m

Mohan kancherla

07/26/2023, 5:57 PM
Thank you
d

Deceivious

07/27/2023, 8:19 AM
Ah my interpretation of
in the scheduled time
was that they were not late šŸ˜„