Hello Guys, I'm configuring Prefect with ECS agen...
# ask-community
l
Hello Guys, I'm configuring Prefect with ECS agent. I'm using Prefect Cloud. I registered a flow and when I go to test it, it always has a pending status. I'm using AWS ECR as Storage. When I access the Dashboard to follow the flow and see the logs, I get:
Submitted for execution: Task arn:aws:ecs:us-east-2:<my-account>:task/my-fargate-cluster/1eb7b9cbd17c448ab4fcdc76e4692297
Has anyone experienced a similar problem and can you help me? Thanks!
k
Hey @lucas oliveira, the most frequent cause I have seen for this is the ECS/Fargate is not able to download the image or start the image. Do you see task logs in ECS? You can add cloudwatch logs so that you can get more info
l
It doesn't even create the task in ECS. I am believing that the agent is not able to communicate with ECS. Is there any way I can test this communication between the agent and ECS?
k
You can try putting your agent with debug level logs with
prefect ecs agent start --log-level=debug
but you can check also if the task even registered. ECSRun will register the new task definition. That should be a good clue if it can communicate
Task registered under ECS**
a
a stupid question but did you wait a bit? 🙂 with Fargate the flow usually stays in a Submitted state for a bit until the instance on Fargate gets provisioned
do you see an ECS task being created in the ECS dashboard in the AWS management console? can you access CloudWatch logs for this task?
l
I don't see the task being created in ECS. Because of that I believe I'm having an error in the creation of the task, but I can't see what the error is.
I'm configuring the ECS task like this:
run_config = ECSRun(
memory=512,
cpu=256,    execution_role_arn="arn:aws:iam::<my-account>:role/AllowPrefectAgentExecuteTask",
image="anisienia/prefect-pydata",
)
k
You don’t even see anything under the registered tasks in ECS?
a
btw this image is super outdated - image=“anisienia/prefect-pydata”, it was built as part of a tutorial written a long time ago. If you’re interested, there is an updated version for ECS - this should work well: https://towardsdatascience.com/how-to-cut-your-aws-ecs-costs-with-fargate-spot-and-prefect-1a1ba5d2e2df Can you perhaps try running a super simple ECS hello world example like this? https://github.com/anna-geller/packaging-prefect-flows/blob/master/flows/github_ecs_run.py I would be interested to see how you define storage as well
l
Hello, I managed to implement following the tutorial above. I believe my old implementation was not working due to not having correctly configured the aws rules. Thank you very much!
🙌 2