Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions airflow/providers/amazon/aws/operators/ecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ class EcsRunTaskOperator(EcsBaseOperator):
When capacity_provider_strategy is specified, the launch_type parameter is omitted.
If no capacity_provider_strategy or launch_type is specified,
the default capacity provider strategy for the cluster is used.
:param volume_configurations: the volume configurations to use when using capacity provider. The name of the volume must match
the name from the task definition.
You can configure the settings like size, volume type, IOPS, throughput and others mentioned in
(https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_TaskManagedEBSVolumeConfiguration.html)
:param group: the name of the task group associated with the task
:param placement_constraints: an array of placement constraint objects to use for
the task
Expand Down Expand Up @@ -420,6 +424,7 @@ class EcsRunTaskOperator(EcsBaseOperator):
"overrides",
"launch_type",
"capacity_provider_strategy",
"volume_configurations",
"group",
"placement_constraints",
"placement_strategy",
Expand Down Expand Up @@ -450,6 +455,7 @@ def __init__(
overrides: dict,
launch_type: str = "EC2",
capacity_provider_strategy: list | None = None,
volume_configurations: list | None = None,
group: str | None = None,
placement_constraints: list | None = None,
placement_strategy: list | None = None,
Expand Down Expand Up @@ -479,6 +485,7 @@ def __init__(
self.overrides = overrides
self.launch_type = launch_type
self.capacity_provider_strategy = capacity_provider_strategy
self.volume_configurations = volume_configurations
self.group = group
self.placement_constraints = placement_constraints
self.placement_strategy = placement_strategy
Expand Down Expand Up @@ -614,6 +621,8 @@ def _start_task(self):

if self.capacity_provider_strategy:
run_opts["capacityProviderStrategy"] = self.capacity_provider_strategy
if self.volume_configurations is not None:
run_opts["volumeConfigurations"] = self.volume_configurations
elif self.launch_type:
run_opts["launchType"] = self.launch_type
if self.platform_version is not None:
Expand Down
1 change: 1 addition & 0 deletions tests/providers/amazon/aws/operators/test_ecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def test_template_fields_overrides(self):
"overrides",
"launch_type",
"capacity_provider_strategy",
"volume_configurations",
"group",
"placement_constraints",
"placement_strategy",
Expand Down