https://prefect.io logo
c

Carlos Velazquez

07/19/2023, 7:54 PM
Hi team, i have an error when traying to run a flow with ECSTask, In my task definitions i have 2 containers, one of them is a mongodb and this one have the follows error:
/usr/local/bin/docker-entrypoint.sh: line 416: exec: python: not found
Important: When trying to run the same flow as a Agents everything it's good. Anyone knows how can i make this possible?
Hi Folks, anyone can help me with that please?
j

Jake Kaplan

07/20/2023, 4:15 PM
Hey, I think it looks probably trying to run the prefect entrypoint in the mongo container? or whatever container that it is that is not supposed to run python. the default prefect entrypoint is
python -m prefect.engine
c

Carlos Velazquez

07/20/2023, 4:22 PM
Hi, well after a lot fight with this, I realized you have this:
ECS_DEFAULT_CONTAINER_NAME = "prefect"
After that i saw the function:
_container_name_from_task_definition
But i don't see it this in any part inside the documentations. if we have more than 1 task definitions we have to put this name default for the container. 🙃
j

Jake Kaplan

07/20/2023, 6:27 PM
ahh is your task definition coming from your work pool or a pre-registered one?
c

Carlos Velazquez

07/20/2023, 7:21 PM
From work-pool yes! It's the only one method that works, Because before I used ECS Task but the support told me I should user ECS Workers!
j

Jake Kaplan

07/20/2023, 7:46 PM
would you be able to file an issue for it here? If the ECS Task supported it the ECS Worker definitely should as well
c

Carlos Velazquez

07/20/2023, 7:51 PM
It's different. Rigtn now i worke with ECSWorkers because with ECS Task with have problem with timeout, this is the main error with ECSTask.
Copy code
We run all of our flows with the ECS configuration on Prefect 1, and we've found that on Prefect 2 the ECS tasks "crash" consistently around 2 minutes. My team thinks there may be some internal timeout in the Prefect code and the issue may be related to the unresolved ticket linked below
however we resolved this with ECSWorkers but because ECSTask doesn't works with very long time flows. idk why! (?)
y

YSF

07/21/2023, 12:35 AM
I just found I have this issue running using an ubuntu image that has python3, is there a way to change that?
j

Jake Kaplan

07/21/2023, 12:36 PM
sorry just getting back to this, @Carlos Velazquez I think I understand what you were saying. Would you be able to share your original task definition that led to the error and then what you did to fix it? (just to make sure I have the full picture, feel free to dm if you'd rather). I'd like to either document what's needed for multiple containers or possibly update the code
c

Carlos Velazquez

07/21/2023, 1:23 PM
Hi @Jake Kaplan of course! i cant share with you our task_definition. But it's just this:
Copy code
locals {
  container_def_serverless_flow_runner = <<TASK_DEFINITION
    [
      {
        "name": "mongodb",
        ...........
      },
      {
        "name": "flow",
        ...........
    ]
  TASK_DEFINITION
}
In this case i have 2 containers with the name
mongodb
and
flow
. But this not works. But when we changed the name of the container
flow
for
prefect
it's works. So it's importante to say, if you have a single container you don't have any problem with that, you can have whatever name that you want. i can realize for it, thankfully for this var in the library:
ECS_DEFAULT_CONTAINER_NAME = "prefect"
So, that was just a blind test and work!
Right now works like this:
Copy code
locals {
  container_def_serverless_flow_runner = <<TASK_DEFINITION
    [
      {
        "name": "mongodb",
        ...........
      },
      {
        "name": "prefect",
        ...........
    ]
  TASK_DEFINITION
}
j

Jake Kaplan

07/21/2023, 1:25 PM
ahhhhh got it. I didn't totally understand exactly where
"name": "flow"
was coming from, but I see it was from the original definition with ECSTask
thank you for helping me understand, I will make sure to get that more explicitly documented
c

Carlos Velazquez

07/21/2023, 1:29 PM
Yeah,
"name": "flow"
it's just a name, like a
mongodb
but we didn't know that prefect need it an specificly one
in this case, prefect need a main container name, will have be: :
prefect
always, but just why you did a logical code with:
ECS_DEFAULT_CONTAINER_NAME = "prefect"