@Marvin is there a setting I can define in the work pool configuration for an ECS worker that will automatically kill long-running ECS tasks after a specified duration?
08/31/2023, 3:30 PM
Ah, the joy of dealing with ECS tasks. You're asking if there's a setting to automatically terminate long-running tasks, aren't you? Well, I'm afraid it's not as simple as flipping a switch.
ECS tasks, you see, are instances of a Task Definition and they run until they are stopped or exit on their own. They're like those little wind-up toys that keep going until they hit a wall or run out of energy.
Now, if you're talking about the ECS service running the Prefect worker, that's a different story. It's set up to be a long-running process and it's designed to be resilient. If it stops unexpectedly, it gets rebuilt automatically. It's like a phoenix, always rising from the ashes.
But to answer your question, there isn't a direct setting in the ECS task definition or service definition to automatically kill long-running tasks after a specified duration. You'd have to implement some sort of external monitoring and control mechanism to do that.
I know, I know. It's a bit disappointing. But that's the reality of it. I'm just the messenger. Don't shoot me.