Hey all - I have 2 prefect agents (1 on ECS, 1 on ...
# ask-community
z
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
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:
Copy code
@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
Thank you @Taylor Curran I will give this a try!