airflow.providers.amazon.aws.executors.ecs.utils

AWS ECS Executor Utilities.

Data classes and utility functions used by the ECS executor.

Module Contents

Classes

EcsQueuedTask

Represents an ECS task that is queued. The task will be run in the next heartbeat.

EcsTaskInfo

Contains information about a currently running ECS task.

BaseConfigKeys

Base Implementation of the Config Keys class. Implements iteration for child classes to inherit.

RunTaskKwargsConfigKeys

Keys loaded into the config which are valid ECS run_task kwargs.

AllEcsConfigKeys

All keys loaded into the config which are related to the ECS Executor.

EcsExecutorTask

Data Transfer Object for an ECS Fargate Task.

EcsTaskCollection

A five-way dictionary between Airflow task ids, Airflow cmds, ECS ARNs, and ECS task objects.

Functions

parse_assign_public_ip(assign_public_ip)

Convert "assign_public_ip" from True/False to ENABLE/DISABLE.

camelize_dict_keys(nested_dict)

Accept a potentially nested dictionary and recursively convert all keys into camelCase.

Attributes

CommandType

ExecutorConfigFunctionType

ExecutorConfigType

CONFIG_GROUP_NAME

CONFIG_DEFAULTS

airflow.providers.amazon.aws.executors.ecs.utils.CommandType[source]
airflow.providers.amazon.aws.executors.ecs.utils.ExecutorConfigFunctionType[source]
airflow.providers.amazon.aws.executors.ecs.utils.ExecutorConfigType[source]
airflow.providers.amazon.aws.executors.ecs.utils.CONFIG_GROUP_NAME = 'aws_ecs_executor'[source]
airflow.providers.amazon.aws.executors.ecs.utils.CONFIG_DEFAULTS[source]
class airflow.providers.amazon.aws.executors.ecs.utils.EcsQueuedTask[source]

Represents an ECS task that is queued. The task will be run in the next heartbeat.

key: airflow.models.taskinstance.TaskInstanceKey[source]
command: CommandType[source]
queue: str[source]
executor_config: ExecutorConfigType[source]
attempt_number: int[source]
class airflow.providers.amazon.aws.executors.ecs.utils.EcsTaskInfo[source]

Contains information about a currently running ECS task.

cmd: CommandType[source]
queue: str[source]
config: ExecutorConfigType[source]
class airflow.providers.amazon.aws.executors.ecs.utils.BaseConfigKeys[source]

Base Implementation of the Config Keys class. Implements iteration for child classes to inherit.

__iter__()[source]
class airflow.providers.amazon.aws.executors.ecs.utils.RunTaskKwargsConfigKeys[source]

Bases: BaseConfigKeys

Keys loaded into the config which are valid ECS run_task kwargs.

ASSIGN_PUBLIC_IP = 'assign_public_ip'[source]
CAPACITY_PROVIDER_STRATEGY = 'capacity_provider_strategy'[source]
CLUSTER = 'cluster'[source]
LAUNCH_TYPE = 'launch_type'[source]
PLATFORM_VERSION = 'platform_version'[source]
SECURITY_GROUPS = 'security_groups'[source]
SUBNETS = 'subnets'[source]
TASK_DEFINITION = 'task_definition'[source]
CONTAINER_NAME = 'container_name'[source]
class airflow.providers.amazon.aws.executors.ecs.utils.AllEcsConfigKeys[source]

Bases: RunTaskKwargsConfigKeys

All keys loaded into the config which are related to the ECS Executor.

MAX_RUN_TASK_ATTEMPTS = 'max_run_task_attempts'[source]
AWS_CONN_ID = 'conn_id'[source]
RUN_TASK_KWARGS = 'run_task_kwargs'[source]
REGION_NAME = 'region_name'[source]
CHECK_HEALTH_ON_STARTUP = 'check_health_on_startup'[source]
exception airflow.providers.amazon.aws.executors.ecs.utils.EcsExecutorException[source]

Bases: Exception

Thrown when something unexpected has occurred within the ECS ecosystem.

class airflow.providers.amazon.aws.executors.ecs.utils.EcsExecutorTask(task_arn, last_status, desired_status, containers, started_at=None, stopped_reason=None)[source]

Data Transfer Object for an ECS Fargate Task.

get_task_state()[source]

This is the primary logic that handles state in an ECS task.

It will determine if a status is:

QUEUED - Task is being provisioned. RUNNING - Task is launched on ECS. REMOVED - Task provisioning has failed for some reason. See stopped_reason. FAILED - Task is completed and at least one container has failed. SUCCESS - Task is completed and all containers have succeeded.

__repr__()[source]

Return repr(self).

class airflow.providers.amazon.aws.executors.ecs.utils.EcsTaskCollection[source]

A five-way dictionary between Airflow task ids, Airflow cmds, ECS ARNs, and ECS task objects.

add_task(task, airflow_task_key, queue, airflow_cmd, exec_config, attempt_number)[source]

Adds a task to the collection.

update_task(task)[source]

Updates the state of the given task based on task ARN.

task_by_key(task_key)[source]

Get a task by Airflow Instance Key.

task_by_arn(arn)[source]

Get a task by AWS ARN.

pop_by_key(task_key)[source]

Deletes task from collection based off of Airflow Task Instance Key.

get_all_arns()[source]

Get all AWS ARNs in collection.

get_all_task_keys()[source]

Get all Airflow Task Keys in collection.

failure_count_by_key(task_key)[source]

Get the number of times a task has failed given an Airflow Task Key.

increment_failure_count(task_key)[source]

Increment the failure counter given an Airflow Task Key.

info_by_key(task_key)[source]

Get the Airflow Command given an Airflow task key.

__getitem__(value)[source]

Gets a task by AWS ARN.

__len__()[source]

Determines the number of tasks in collection.

airflow.providers.amazon.aws.executors.ecs.utils.parse_assign_public_ip(assign_public_ip)[source]

Convert “assign_public_ip” from True/False to ENABLE/DISABLE.

airflow.providers.amazon.aws.executors.ecs.utils.camelize_dict_keys(nested_dict)[source]

Accept a potentially nested dictionary and recursively convert all keys into camelCase.

Was this entry helpful?