https://prefect.io logo
Title
r

Rhys Mansal

04/05/2022, 9:29 PM
Sorry to ask multiple questions but I have a flow that is running on ECR which fails with the following message
An error occurred (ClientException) when calling the RegisterTaskDefinition operation: Invalid setting for container 'flow'. At least one of 'memory' or 'memoryReservation' must be specified.
I have set memory (and cpu) in the ECSRun task_definition (both quoted and unquoted) and still get this error. Does anyone know what I might try?
:discourse: 1
k

Kevin Kho

04/05/2022, 9:31 PM
No worries! Here to help. Can I see your task definition?
a

Anna Geller

04/05/2022, 9:34 PM
ECS is super specific about what you need to set there. We saw a similar issue when the image was not set explicitly - you need to check the required arguments for an ECS task definition and you need to set them all explicitly unless you let Prefect create and register a task definition for you - if you need some examples, check out those here with the name "ecs" in it
r

Rhys Mansal

04/05/2022, 9:36 PM
thank you. I think it's the lack of the explicit image then.
👍 1
k

Kevin Kho

04/05/2022, 9:37 PM
no no. yours says memory. I think it was some memory also specified in the task definition
r

Rhys Mansal

04/05/2022, 9:40 PM
currently I have this
with Flow("flow-name",
          state_handlers=[run_name_ts],
          storage=Module("scheduling.flows"),
          run_config=ECSRun(
              task_definition={
                  'containerDefinitions': [
                      {
                          'name': 'flow',
                          'image': '<http://some-string.amazonaws.com/container:0.1.0|some-string.amazonaws.com/container:0.1.0>'
                      }
                  ]
              },
              memory=512,
              cpu=256,
              labels=["dev", "other-string"])) as flow:
k

Kevin Kho

04/05/2022, 9:42 PM
It wants a memory value inside containerDefnitions
:upvote: 1
But with just setup, so need to give task definition, just give the
image
to ECSRun and you should be good. Prefect makes that flow container by default anyway
r

Rhys Mansal

04/05/2022, 9:43 PM
excellent. Thank you