Kieran
01/18/2021, 2:40 PMdefault_client = docker.from_env()
FLOW_NAME = "hello-flow"
flow_schedule = CronSchedule("0 8 * * *")
flow_storage = Docker(
base_url=default_client.api.base_url,
tls_config=docker.TLSConfig(default_client.api.cert),
registry_url="<http://_________.dkr.ecr.eu-west-2.amazonaws.com/xxxxx/prefect|_________.dkr.ecr.eu-west-2.amazonaws.com/xxxxx/prefect>"
)
flow_run_config = ECSRun(
cpu="512",
memory="512",
run_task_kwargs={"requiresCompatibilities": ["FARGATE"], "compatibilities": ["FARGATE"]}
)
with Flow(
name=FLOW_NAME,
schedule=flow_schedule,
storage=flow_storage,
run_config=flow_run_config
) as flow:
say_hello()
if is_serializable(flow):
flow.register(project_name="Test", registry_url=flow_storage)
else:
raise TypeError("Flow did not serialise.")
We are getting the following error from our task logs:
An error occurred (InvalidParameterException) when calling the RunTask operation: Task definition does not support launch_type FARGATE.
In an attempt to resolve this issue I tried adding run_task_kwargs
as above but with no luck.
Does anyone have any pointers?
(I can see from the ECS task definition panel that the Compatibilities
is set to EC2 and Requires compatibilities
is blank and from this thread that could be the cause...)prefect agent ecs start --cluster prefect-cluster --launch-type EC2
josh
01/19/2021, 2:52 PMdefault
cluster or do you have another one created? I feel like Iโve seen this when the cluster the agent is trying to deploy to isnโt permissioned properly to use Fargate ๐คKieran
01/19/2021, 3:02 PMjosh
01/19/2021, 3:05 PMSagun Garg
01/21/2021, 7:54 AMRROR - agent | Failed to infer default networkConfiguration, please explicitly configure using `--run-task-kwargs`
ValueError: Failed to infer default networkConfiguration, please explicitly configure using `--run-task-kwargs`
--run-task-kwargs
I have already implemented a task_definition.yaml as below as suggested by another community member in another thread but still no relief
networkMode: awsvpc
cpu: 1024
memory: 2048
containerDefinitions:
- name: flow
taskRoleArn: <ecs_task_role_arn>
executionRoleArn: <insert_ecsTaskExecutionRole_arn>
Kieran
01/25/2021, 9:46 PMJay Sundaram
03/13/2021, 9:11 PMKieran
03/16/2021, 7:06 PMnetworkMode: awsvpc
cpu: 256
memory: 512
containerDefinitions:
- name: flow
requiresCompatibilities:
- FARGATE
executionRoleArn: arn:aws:iam::xxxxxxxxxx:role/tf-iam-role-prefect-ecs-tasks <--- change to whatever you need