https://prefect.io logo
#prefect-community
Title
# prefect-community
c

Carlos Soza

04/09/2022, 2:57 PM
Hello Team Prefect, I have some question about ECSAgent, because when i tried to run my flow i’ve got botocore.errorfactory.ClientException: An error occurred (ClientException) when calling the RegisterTaskDefinition operation: Container.image should not be null or empty. After having debugged, I’ve detected that the problem was the containerDefinitions used by the agent has two entries, one with my ECSRun configuration and other with only {“name”:“flow”}. But my configuration only had one. My question is, this is a bug or is mandatory using ‘flow’ in the containerDefinitions name parameter?. (I have using prefect 1.2.0, DockerStorage, ECSRun and ECSAgent. And my configuration for the task_definition is directly in the code.)
k

Kevin Kho

04/09/2022, 3:19 PM
I think this is just because the task definition is registered first but then overwritten during runtime. See this. You can just at an image that doesn’t exist, and the run configuration will replace it
c

Carlos Soza

04/09/2022, 3:29 PM
ok, thanks, i’ll see that
I fixed my issue writing ‘flow’ in the containerDefinitions name in my ECSRun config. Working config:
Copy code
flow.run_config = ECSRun(
        task_definition={
            "containerDefinitions": [
                {
                    "name": "flow",
                    "image": MY_ECR_IMAGE",
                    },
                }
            ],
            "family": flow_name,
            "networkMode": "awsvpc",
            "memory": "4096",
            "cpu": "2048",
            "requiresCompatibilities": ["FARGATE"],
            "taskRoleArn": MY_TASK_ARN_ROLE,
        },
        execution_role_arn=MY_EXECUTION_ROLE,
        task_role_arn="MY_TASK_ARN_ROLE,
        labels=["prefect-ecs-agent"],
    )
When i change the name a custom name I’ve get the error. Not working config:
Copy code
flow.run_config = ECSRun(
        task_definition={
            "containerDefinitions": [
                {
                    "name": "flow_test",
                    "image": MY_ECR_IMAGE",
                    },
                }
            ],
            "family": flow_name,
            "networkMode": "awsvpc",
            "memory": "4096",
            "cpu": "2048",
            "requiresCompatibilities": ["FARGATE"],
            "taskRoleArn": MY_TASK_ARN_ROLE,
        },
        execution_role_arn=MY_EXECUTION_ROLE,
        task_role_arn="MY_TASK_ARN_ROLE,
        labels=["prefect-ecs-agent"],
    )
It’s not a problem for me to used ‘flow’ as a container name, but if this can help to improve this great tool, im glad. thanks a lot.
k

Kevin Kho

04/09/2022, 4:16 PM
We need to know which container to run the flow in because there can be multiple containers so the
flow
name is a requirement. And glad you got it working!
👀 1
6 Views