Mitchell Bregman
03/31/2021, 4:41 PMECSRun
run configuration, with ECSAgent
and Docker
storage. I am running into a similar issue - not entirely sure if there is a workaround currently, but here is the error I cannot get past:
[2021-03-31 15:09:51,907] ERROR - agent | Error while deploying flow: InvalidParameterException('An error occurred (InvalidParameterException) when calling the RunTask operation: Task definition does not support launch_type FARGATE.')
My setup:
# flow.py
import prefect
from prefect import Flow, task
@task
def say_hello():
logger = prefect.context.get("logger")
<http://logger.info|logger.info>("Got here!!!!")
with Flow("Test") as flow:
say_hello()
--
# deploy.py
flow.run_configs = ECSRun(
run_task_kwargs={'cluster': 'my-cluster'},
execution_role_arn='arn:aws:iam::{ACCOUNT_NUMBER}:role/my-ecs-task-role',
labels=['ecs']
)
flow.storage = Docker(
env_vars=config.ENVIRONMENT_VARIABLES,
extra_dockerfile_commands=[
f"RUN pip install -e /service",
],
files={f"{os.path.join(os.path.expanduser('~'), 'project')}": "/service"},
image_name=config.DOCKER_IMAGE_NAME,
image_tag=config.DOCKER_IMAGE_TAG,
registry_url=config.DOCKER_REGISTRY_URL,
)
Here is how I am running the agent:
prefect agent ecs start --token {PREFECT_RUNNER_TOKEN} --cluster my-cluster --label ecs --launch-type FARGATE
My issue is, I have no idea if I am doing something wrong on the AWS side of things or not; I am trying to wrap my head around the root cause. I’m also noticing there are task_definitions
and task_role_arn
parameters and I’m unsure if I am expected to use them or not, where to set those up. Any insight would be extremely appreciated!Jim Crist-Harif
03/31/2021, 4:46 PMJim Crist-Harif
03/31/2021, 4:46 PMMitchell Bregman
03/31/2021, 4:50 PMMitchell Bregman
03/31/2021, 4:54 PMJim Crist-Harif
03/31/2021, 4:56 PMMitchell Bregman
03/31/2021, 5:07 PMJim Crist-Harif
03/31/2021, 8:08 PMMitchell Bregman
03/31/2021, 10:18 PMbotocore.errorfactory.ClientException: An error occurred (ClientException) when calling the RegisterTaskDefinition operation: Fargate requires task definition to have execution role ARN to support ECR images.
but I think thats on my end… testing some things currently.Mitchell Bregman
04/01/2021, 12:13 AMJim Crist-Harif
04/01/2021, 1:59 AMexecution_role_arn
to ECSRun
or using the --execution-role-arn
flag on the agent.Jim Crist-Harif
04/01/2021, 1:59 AM