Hey there! I noticed an extensive
conversation around using the
ECSRun
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!