Fix AWS Batch Executor compatibility with Airflow 3 in try_adopt_task_instances#68027
Merged
o-nikolas merged 3 commits intoJun 22, 2026
Merged
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
ambaena
marked this pull request as ready for review
June 4, 2026 16:57
Contributor
Author
|
Fixed the test failure caused by Python 3.10 compatibility. |
o-nikolas
approved these changes
Jun 22, 2026
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
cetingokhan
pushed a commit
to cetingokhan/airflow
that referenced
this pull request
Jun 24, 2026
…xec (apache#68027) Build either an Airflow 2 `airflow` CLI command or an Airflow 3 python execution of task execution with a json payload representing this task.
75 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #62192
The AWS Batch Executor still calls
TaskInstance.command_as_list()fromtry_adopt_task_instances(). That method is not available in Airflow 3 after the Task SDK changes.This is triggered when the scheduler restarts or fails over and tries to adopt orphaned task instances that still have an
external_executor_idpointing to an AWS Batch job. The scheduler callsadopt_or_reset_orphaned_tasks(), the Batch executor describes the existing Batch jobs, and then crashes while rebuilding the command for the adopted task instance:AttributeError: TaskInstance object has no attribute command_as_listThe normal submission path already handles Task SDK workloads. This change makes the adoption path use the same Task SDK command serialization on Airflow 3 while keeping the existing
command_as_list()behavior for Airflow 2.This mirrors the ECS executor fix from #62192 for the AWS Batch executor.
Testing:
prek run --files providers/amazon/src/airflow/providers/amazon/aws/executors/batch/batch_executor.py providers/amazon/tests/unit/amazon/aws/executors/batch/test_batch_executor.pyuv run --project providers/amazon pytest providers/amazon/tests/unit/amazon/aws/executors/batch/test_batch_executor.py -k "try_adopt_task_instances or serialize_workload_to_command or build_task_command" -xvsDisclosure: I used an AI assistant to help investigate the failure mode and cross-check the proposed fix. I reviewed the final code and tests myself.
Note
✅ Ready for review · @ambaena →
@potiuk· 2026-06-12 13:30 UTCThanks @ambaena — all checks are green and this PR is marked ready for maintainer review. The ball is with the maintainers now; a maintainer will take the next look.
Automated triage — may be imperfect.