https://prefect.io logo
Title
z

Zachary Loertscher

05/15/2023, 3:25 PM
Hey all - I have 2 prefect agents (1 on ECS, 1 on an EC2). I want a deployment to run on the ECS task after the EC2 flow finishes (orchestrator pattern) From my googling, it seems that there are two options: • use an automation (limited to 3 per workspace) • Use a custom script (like here) Has anyone come across a simpler, more scalable way to do this? I'm hoping to avoid adding a bunch of code to my flows just to make a handoff between infras, if possible
1
t

Taylor Curran

05/15/2023, 7:23 PM
Hi Zachary, we’ve actually come a long way since that discourse article was written: Now you can call run_deployment to kick off deployments as a result of any kind of python logic. You can call run_deployment from outside or inside of a task or flow.
:thank_you: 1
I could see something like this working:
@flow
def my_parent_flow():
    a = run_deployment("ecs-deployment")
    if a.state() == "Completed":
        run_deployment("ec2-deployment")
Automations are good for setting global automations rules that you want applied across your workspace.
z

Zachary Loertscher

05/16/2023, 7:22 PM
Thank you @Taylor Curran I will give this a try!