https://prefect.io logo
Title
e

Ethan Veres

03/03/2023, 2:00 PM
Hi all! New to prefect v2 and wrapping my head around the deployment for an ECSTask. Correct me if I’m wrong, but each flow run has to deploy a new task definition to run? How can I have more than one flow run at a time?
z

Zanie

03/03/2023, 3:37 PM
If you pre-define your task definition, the flow run can use that instead.
We’ll intelligently make a copy of that task definition if you run the flow with settings that require a new task definition.
e

Ethan Veres

03/03/2023, 3:37 PM
Cool - but it still has to redeploy no?
z

Zanie

03/03/2023, 3:38 PM
What do you mean by redeploy?
We create a new run of the task definition per flow run
e

Ethan Veres

03/03/2023, 3:39 PM
Thanks for your help btw! hmmm.. From what I can tell, every time I click “Run” on a flow in the UI, my ECS task redeploys in AWS
is that correct?
z

Zanie

03/03/2023, 3:39 PM
You’ll need to be more specific than “redeploys” 🙂
Have you specified a
task_definition_arn
in your flow run infrastructure config?
e

Ethan Veres

03/03/2023, 3:43 PM
Sorry! Let me try and spell out what I’ve done so far: 1. Created a custom
agent
Docker image with my flow code baked in and pushed it to ECR 2. Created an ECS service and task definition in Terraform and deployed it to my AWS instance that has a
container definition
called
prefect
that uses the custom Docker image 3. Created an ECSTask block in the Prefect UI with the
task_definition_arn
specified to my task definition created by terraform (I made sure that the ecs task doesn’t override anything defined)
I can see the agent starting up correctly in my logs
z

Zanie

03/03/2023, 4:26 PM
And when you run the flow an ECS task is created from your task definition to run it, yeah?
e

Ethan Veres

03/03/2023, 4:27 PM
it stops the current task
and runs it with the correct task def
z

Zanie

03/03/2023, 4:27 PM
It shouldn’t stop any tasks
e

Ethan Veres

03/03/2023, 4:28 PM
hmm so maybe another bug in my code that’s causing an exception
thanks! will do some debugging