Skip to content

Update ECS executor to support Task SDK#48513

Merged
o-nikolas merged 5 commits into
apache:mainfrom
aws-mwaa:onikolas/ecs_exec_task_sdk
Apr 7, 2025
Merged

Update ECS executor to support Task SDK#48513
o-nikolas merged 5 commits into
apache:mainfrom
aws-mwaa:onikolas/ecs_exec_task_sdk

Conversation

@o-nikolas

@o-nikolas o-nikolas commented Mar 28, 2025

Copy link
Copy Markdown
Contributor

Summary

Follows the paradigm used in the k8s executor except the serialized workload is passed along as string instead of a file, since there is no (easy) way to plumb a file into the ECS container at run time.

In the future using a secret to pass along the workload could be another possible approach, but this requires the use of another cloud service (i.e. Secret Manager or Parameter Store).

Testing

I tested the ECS executor and execute_workload changes in combination and everything is passing green.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
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.

@vincbeck

Copy link
Copy Markdown
Contributor

Closing and re-opening to run test (they somehow did not run)

@vincbeck vincbeck closed this Mar 31, 2025
@vincbeck vincbeck reopened this Mar 31, 2025

@vincbeck vincbeck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good! Good job with figuring out all these things. Two questions:

  • Can we add unit tests? ECS executor changes are not tested
  • It looks like it is but just double checking. With these changes, is ECS executor still compatible with AF2?

@o-nikolas

Copy link
Copy Markdown
Contributor Author

Overall looks good! Good job with figuring out all these things. Two questions:

* Can we add unit tests? ECS executor changes are not tested

Sure, I can look at adding some. But most all of the actual behaviour of the executor itself hasn't changed. Just the interface to it (which should honestly be tested by the base executor once all this stuff moves into that class). But I'll look at adding a few.

* It looks like it is but just double checking. With these changes, is ECS executor still compatible with AF2?

Yupp it should be still working with AF2, I can do a manual test to verify 👍

@o-nikolas

Copy link
Copy Markdown
Contributor Author

Follow up on this:

Overall looks good! Good job with figuring out all these things. Two questions:

* Can we add unit tests? ECS executor changes are not tested

Sure, I can look at adding some. But most all of the actual behaviour of the executor itself hasn't changed. Just the interface to it (which should honestly be tested by the base executor once all this stuff moves into that class). But I'll look at adding a few.

Unit test added! It pretty comprehensively tests the task SDK path beginning to end. Let me know what you think!

* It looks like it is but just double checking. With these changes, is ECS executor still compatible with AF2?

Yupp it should be still working with AF2, I can do a manual test to verify 👍

Manually setup a repro with AF2 and the current executor, everything works as expected!

Comment thread task-sdk/src/airflow/sdk/execution_time/execute_workload.py
@o-nikolas

Copy link
Copy Markdown
Contributor Author

CC @ashb @amoghrajesh

@vincbeck vincbeck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread providers/amazon/src/airflow/providers/amazon/aws/executors/ecs/ecs_executor.py Outdated

@amoghrajesh amoghrajesh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@o-nikolas thanks, your changes mostly look good. Some comments

Comment thread providers/amazon/src/airflow/providers/amazon/aws/executors/ecs/utils.py Outdated
Comment thread task-sdk/src/airflow/sdk/execution_time/execute_workload.py
Comment thread task-sdk/src/airflow/sdk/execution_time/execute_workload.py Outdated
Comment thread task-sdk/src/airflow/sdk/execution_time/execute_workload.py
Follows the paradigm used in the k8s executor except the serialized
workload is passed along as string instead of a file, since there
is no (easy) way to plumb a file into the ECS container at run time.

In the future using a secret to pass along the workload could be
another possible approach, but this requires the use of another
cloud service (i.e. Secret Manager or Parameter Store).
@o-nikolas
o-nikolas force-pushed the onikolas/ecs_exec_task_sdk branch from a8154dd to 9f65a6f Compare April 4, 2025 21:48
@o-nikolas
o-nikolas force-pushed the onikolas/ecs_exec_task_sdk branch from 9f65a6f to 9ca3c45 Compare April 4, 2025 21:58
@o-nikolas
o-nikolas merged commit 8e8c84f into apache:main Apr 7, 2025
1 check passed
@o-nikolas
o-nikolas deleted the onikolas/ecs_exec_task_sdk branch April 7, 2025 16:03
simonprydden pushed a commit to simonprydden/airflow that referenced this pull request Apr 8, 2025
* Update ECS executor to support Task SDK

Follows the paradigm used in the k8s executor except the serialized
workload is passed along as string instead of a file, since there
is no (easy) way to plumb a file into the ECS container at run time.

In the future using a secret to pass along the workload could be
another possible approach, but this requires the use of another
cloud service (i.e. Secret Manager or Parameter Store).

* Add unit test to test task sdk path

* Small fix in arg ordering

* Only import within Airflow 3 scope for back compat tests

* fixes from PR review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers area:task-sdk provider:amazon AWS/Amazon - related issues provider:cncf-kubernetes Kubernetes (k8s) provider related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants