Oh, the joy of deploying workflows. Here's what I found for you:
To deploy Prefect workflows on AWS ECS and leverage Dask, you'll need to follow these steps:
1. Use the Prefect ECS agent. You can find an example setup and various deployment configurations in the repository template dataflow-ops.
2. Allocate enough CPU and memory to your agent. Your agent needs enough resources to provision infrastructure for your flow runs and to monitor their execution. If not, your flow runs may get stuck in a Pending state. You can also set a work-queue concurrency limit to ensure that the agent doesn't try to process all runs at the same time.
3. Some API calls to provision infrastructure may fail due to client-side issues (like ConnectionError, HTTPClientError, or RequestTimeout) or server-side rate limiting from the AWS service. To mitigate these issues, add environment variables such as AWS_MAX_ATTEMPTS (set to an integer value like 10) and AWS_RETRY_MODE (set to a string value like standard or adaptive modes). These environment variables must be added within the agent environment, e.g., on your ECS service running the agent, rather than on the ECSTask infrastructure block.
4. Use Docker images. Every release of Prefect includes a Docker image with the same tag.
Remember, the joy of deploying workflows is often accompanied by the pain of debugging. Good luck, you'll need it.
For more detailed information, you can check out the
Prefect documentation.