You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "bmyers-ozette (via GitHub)" <gi...@apache.org> on 2025/09/04 21:24:17 UTC
[PR] Include platform version for fargate only [airflow]
bmyers-ozette opened a new pull request, #55279:
URL: https://github.com/apache/airflow/pull/55279
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
Currently if you omit the Launch type entirely, the platform version is still included in the request. This breaks the case where the desired behavior is to omit the launch type and use the default capacity provider strategy for the cluster. This PR Inverts the logic to only include the platform version when the launch type is FARGATE.
<!-- Please keep an empty line above the dashes. -->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Include platform version for fargate only [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #55279:
URL: https://github.com/apache/airflow/pull/55279#issuecomment-3691844774
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Include platform version for fargate only [airflow]
Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas commented on code in PR #55279:
URL: https://github.com/apache/airflow/pull/55279#discussion_r2323800717
##########
providers/amazon/src/airflow/providers/amazon/aws/executors/ecs/ecs_executor_config.py:
##########
@@ -81,9 +81,12 @@ def build_task_kwargs() -> dict:
if not cluster.get("defaultCapacityProviderStrategy"):
task_kwargs[all_config_keys.LAUNCH_TYPE] = ECS_LAUNCH_TYPE_FARGATE
- # If you're using the EC2 launch type, you should not/can not provide the platform_version. In this
- # case we'll drop it on the floor on behalf of the user, instead of throwing an exception.
- if is_launch_type_ec2:
+ # The platform_version should be provided for FARGATE launch type only. In other
+ # cases we'll drop it on the floor on behalf of the user, instead of throwing an exception.
+ is_launch_type_fargate: bool = (
+ task_kwargs.get(all_config_keys.LAUNCH_TYPE, None) == ECS_LAUNCH_TYPE_FARGATE
+ )
+ if not is_launch_type_fargate:
Review Comment:
If the launch type is None (i.e. emitted to use the default capacity provider as you describe in your description) how do we know that the platform_version should be dropped? What if the launch type is ultimately fargate via the default capacity provider and the user would like to still select a launch type here in the config? This code change as it is would drop the platform version in that perfectly acceptable case, right?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Include platform version for fargate only [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #55279:
URL: https://github.com/apache/airflow/pull/55279#issuecomment-3424208246
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Include platform version for fargate only [airflow]
Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas commented on code in PR #55279:
URL: https://github.com/apache/airflow/pull/55279#discussion_r2325619726
##########
providers/amazon/src/airflow/providers/amazon/aws/executors/ecs/ecs_executor_config.py:
##########
@@ -81,9 +81,12 @@ def build_task_kwargs() -> dict:
if not cluster.get("defaultCapacityProviderStrategy"):
task_kwargs[all_config_keys.LAUNCH_TYPE] = ECS_LAUNCH_TYPE_FARGATE
- # If you're using the EC2 launch type, you should not/can not provide the platform_version. In this
- # case we'll drop it on the floor on behalf of the user, instead of throwing an exception.
- if is_launch_type_ec2:
+ # The platform_version should be provided for FARGATE launch type only. In other
+ # cases we'll drop it on the floor on behalf of the user, instead of throwing an exception.
+ is_launch_type_fargate: bool = (
+ task_kwargs.get(all_config_keys.LAUNCH_TYPE, None) == ECS_LAUNCH_TYPE_FARGATE
+ )
+ if not is_launch_type_fargate:
Review Comment:
I'm curious to hear from @vincbeck and @ferruzzi for more points of view.
But note that if we go forward with this it is a behaviour change so we'll need to do a deprecation process.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Include platform version for fargate only [airflow]
Posted by "bmyers-ozette (via GitHub)" <gi...@apache.org>.
bmyers-ozette commented on code in PR #55279:
URL: https://github.com/apache/airflow/pull/55279#discussion_r2325461634
##########
providers/amazon/src/airflow/providers/amazon/aws/executors/ecs/ecs_executor_config.py:
##########
@@ -81,9 +81,12 @@ def build_task_kwargs() -> dict:
if not cluster.get("defaultCapacityProviderStrategy"):
task_kwargs[all_config_keys.LAUNCH_TYPE] = ECS_LAUNCH_TYPE_FARGATE
- # If you're using the EC2 launch type, you should not/can not provide the platform_version. In this
- # case we'll drop it on the floor on behalf of the user, instead of throwing an exception.
- if is_launch_type_ec2:
+ # The platform_version should be provided for FARGATE launch type only. In other
+ # cases we'll drop it on the floor on behalf of the user, instead of throwing an exception.
+ is_launch_type_fargate: bool = (
+ task_kwargs.get(all_config_keys.LAUNCH_TYPE, None) == ECS_LAUNCH_TYPE_FARGATE
+ )
+ if not is_launch_type_fargate:
Review Comment:
It's a fair question. I don't see any way to predict in advance what launch type is picked by the ECS scheduler when falling back to the default capacity provider. However I think my change is the lesser of 2 evils since including the platform version completely breaks the run-task api call if the launch type is EC2, but dropping the platform version still works and defaults to latest if the launch type ends up being Fargate.
Certainly open to other ideas or suggestions on how to reconcile this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Include platform version for fargate only [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #55279: Include platform version for fargate only
URL: https://github.com/apache/airflow/pull/55279
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Include platform version for fargate only [airflow]
Posted by "bmyers-ozette (via GitHub)" <gi...@apache.org>.
bmyers-ozette commented on code in PR #55279:
URL: https://github.com/apache/airflow/pull/55279#discussion_r2452588591
##########
providers/amazon/src/airflow/providers/amazon/aws/executors/ecs/ecs_executor_config.py:
##########
@@ -81,9 +81,12 @@ def build_task_kwargs() -> dict:
if not cluster.get("defaultCapacityProviderStrategy"):
task_kwargs[all_config_keys.LAUNCH_TYPE] = ECS_LAUNCH_TYPE_FARGATE
- # If you're using the EC2 launch type, you should not/can not provide the platform_version. In this
- # case we'll drop it on the floor on behalf of the user, instead of throwing an exception.
- if is_launch_type_ec2:
+ # The platform_version should be provided for FARGATE launch type only. In other
+ # cases we'll drop it on the floor on behalf of the user, instead of throwing an exception.
+ is_launch_type_fargate: bool = (
+ task_kwargs.get(all_config_keys.LAUNCH_TYPE, None) == ECS_LAUNCH_TYPE_FARGATE
+ )
+ if not is_launch_type_fargate:
Review Comment:
Any other thoughts on this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Include platform version for fargate only [airflow]
Posted by "bmyers-ozette (via GitHub)" <gi...@apache.org>.
bmyers-ozette commented on code in PR #55279:
URL: https://github.com/apache/airflow/pull/55279#discussion_r2325461634
##########
providers/amazon/src/airflow/providers/amazon/aws/executors/ecs/ecs_executor_config.py:
##########
@@ -81,9 +81,12 @@ def build_task_kwargs() -> dict:
if not cluster.get("defaultCapacityProviderStrategy"):
task_kwargs[all_config_keys.LAUNCH_TYPE] = ECS_LAUNCH_TYPE_FARGATE
- # If you're using the EC2 launch type, you should not/can not provide the platform_version. In this
- # case we'll drop it on the floor on behalf of the user, instead of throwing an exception.
- if is_launch_type_ec2:
+ # The platform_version should be provided for FARGATE launch type only. In other
+ # cases we'll drop it on the floor on behalf of the user, instead of throwing an exception.
+ is_launch_type_fargate: bool = (
+ task_kwargs.get(all_config_keys.LAUNCH_TYPE, None) == ECS_LAUNCH_TYPE_FARGATE
+ )
+ if not is_launch_type_fargate:
Review Comment:
It's a fair question. I don't see any way to predict in advance what launch type is picked by the ECS scheduler when falling back to the default capacity provider strategy. However I think my change is the lesser of 2 evils since including the platform version completely breaks the run-task api call if the launch type is EC2, but dropping the platform version still works and defaults to latest if the launch type ends up being Fargate.
Certainly open to other ideas or suggestions on how to reconcile this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Include platform version for fargate only [airflow]
Posted by "bmyers-ozette (via GitHub)" <gi...@apache.org>.
bmyers-ozette commented on PR #55279:
URL: https://github.com/apache/airflow/pull/55279#issuecomment-3258863772
> You'll need to update the tests as well.
I'll look into the tests if we agree on the approach.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org