prefect_aws.workers.ecs_worker
Prefect worker for executing flow runs as ECS tasks.
Get started by creating a work pool:
FARGATE_SPOT can be used to use spot instances for your Fargate tasks or EC2 can be
used to run your tasks on a cluster backed by EC2 instances.
Generally, it is very useful to enable CloudWatch logging for your ECS tasks; this can
help you debug task failures. To enable CloudWatch logging, you must provide an
execution role ARN with permissions to create and write to log streams. See the
configure_cloudwatch_logs field documentation for details.
The worker can be configured to use an existing task definition by setting the task
definition arn variable or by providing a “taskDefinition” in the task run request. When
a task definition is provided, the worker will never create a new task definition which
may result in variables that are templated into the task definition payload being
ignored.
Functions
parse_identifier
mask_sensitive_env_values
mask_api_key
Classes
ECSIdentifier
The identifier for a running ECS task.
CapacityProvider
The capacity provider strategy to use when running the task.
ECSJobConfiguration
Job configuration for an ECS worker.
Methods:
at_least_one_container_is_essential
cloudwatch_logs_options_requires_configure_cloudwatch_logs
configure_cloudwatch_logs_requires_execution_role_arn
container_name_default_from_task_definition
json_template
network_configuration_requires_vpc_id
vpc_id is provided when custom network configuration mode is
enabled for network settings.
prepare_for_flow_run
task_run_request_requires_arn_if_no_task_definition_given
ECSVariables
Variables for templating an ECS job.
ECSWorkerResult
The result of an ECS job.
ECSWorker
A Prefect worker to run flow runs as ECS tasks.
Methods:
kill_infrastructure
infrastructure_pid: The infrastructure identifier in format “cluster::task_arn”.configuration: The job configuration used to connect to AWS.grace_seconds: Not used for ECS (ECS handles graceful shutdown internally).
InfrastructureNotFound: If the task doesn’t exist.