HI there, i have issue while running a workflow th...
# ask-community
c
HI there, i have issue while running a workflow through ecs agent ,
An error occurred (ClientException) when calling the RegisterTaskDefinition operation: Container.image should not be null or empty
. this is run time error while trying to execute flow . any pointers
šŸ‘€ 1
k
Can I see your
ECSRun
configuration in the Flow?
c
yes sure - ECSRun(task_definition_path=ā€œtest.yamlā€,labels=[ā€˜ecs_test_c’,ā€˜ecs_test_d’], run_task_kwargs={ā€˜cluster’: ā€˜chart-extract’},task_role_arn= ā€˜arnawsiam::***:role/***’ ,execution_role_arn=ā€˜arnawsiam::****:role/exec-role’, image= **.dkr.ecr.us-east-1.amazonaws.com/prefect_image:latest’, env={ā€œimageā€: **.dkr.ecr.us-east-1.amazonaws.com/prefect_image:latestā€} )
test.yaml
executionRoleArn: arn:aws:iam::*****:role/exec-role
containerDefinitions:
- memory: 1024
memoryReservation: 512
volumesFrom: []
image: *******.<http://dkr.ecr.us-east-1.amazonaws.com/prefect_image:latest|dkr.ecr.us-east-1.amazonaws.com/prefect_image:latest>
essential: true
name: fargate-app1
placementConstraints: []
memory: '4096'
taskRoleArn: arn:aws:iam::********:role/exec-role
requiresCompatibilities:
- FARGATE
networkMode: awsvpc
cpu: '1024'
@Kevin Kho ā˜ļø
k
Is this
test.yaml
accessible to your agent?
c
@Kevin Kho -It’s in same path as setup in local.
prefect agent ecs start --task-role-arn arn:aws:iam::*******:role/exec-role --cluster cypher-nlp-chart-extract --log-level INFO  --label ecs_test_c --label ecs_test_d --name fargate-demo --task-definition test.yaml --run-task-kwargs run.yaml --execution-role-arn arn=arn:aws:iam::****:role/exec-role --launch-type FARGATE
k
I’m not sure immediately here. Just to confirm, this works for registering but not running flows right? when you go to the task definition in the ECS UI and open it, do you see an image attached?
Like this? Just scroll down a bit
c
@Kevin Kho Nope i dont see that created through agent
k
It should be created under
Task Definitions
when you register the Flow. What do you see there?
Will look at this more and try to replicate tomorrow
c
ohhk thanks ill check for task registration
k
Hey @Chintan Shah, were you able to see the task in the task definitions?
c
Hi Kevin , not yet , on doing ecsrun it does not register any thing
k
Is this page empty for you?
c
Yes , I don't see my task definition if I search by name provided in yaml file
k
How did you attach it to the flow?
c
Just as you see on ecsrun and ecs start agent command two places
Commands I provided as mentioned above
Is there any example template to refer to . Please share
k
Did you do
flow.run_config = ECSRun()
or
with Flow(…, run_config = ECSRun()) as flow:
?
c
With flow( run_config)
k
Oh and this is the best guide for ECS + Prefect. Have you seen it?
c
Yeah I referred this ..
k
Will debug this today. It’ll take me a bit of time to set it up, but I’ll get back to you
šŸ‘ 1
c
thanks Kevin , i used this for ref.
with Flow('ecs_test_5',   run_config= RUN_CONFIG ) as flow:
say_hello()
šŸ‘ 1
k
I replicated this now. Will work through it
c
Thanks
Awaiting your findings
k
Ok so I figured out the issue. In your task-defnition, the containerDefinition needs the container to be named flow for Prefect. My working example is here . Naming it something else (fargate-app) gives an error. It’s kind of in the docs. Check the docstring of
task_definition
here
šŸ™Œ 1