Under which category would you file this issue?
Providers
Apache Airflow version
main (development)
What happened and how to reproduce it?
When EcsRunTaskOperator runs in deferrable mode with awslogs_region set to a different region than region_name, the CloudWatch logs forwarded during deferral are fetched from the wrong region.
EcsRunTaskOperator.execute passes only region_name=self.region_name to TaskDoneTrigger:
https://github.com/apache/airflow/blob/main/providers/amazon/src/airflow/providers/amazon/aws/operators/ecs.py#L553-L564
and TaskDoneTrigger.run uses that single region for both the ECS waiter client and the CloudWatch get_log_events client:
https://github.com/apache/airflow/blob/main/providers/amazon/src/airflow/providers/amazon/aws/triggers/ecs.py#L190-L223
So _forward_logs queries awslogs_group/log_stream in the task's region instead of the logs region. The stream is not found there, and the trigger logs "Tried to get logs from stream ... but it didn't exist (yet)" for the whole task duration; no task logs are forwarded while deferred.
Steps to reproduce:
- Create an ECS task definition whose
awslogs driver ships logs to a CloudWatch log group in region B, while the task runs in region A.
- Run an
EcsRunTaskOperator with deferrable=True, region_name="<region A>", awslogs_region="<region B>", awslogs_group and awslogs_stream_prefix set.
- Observe that no container logs are relayed during deferral, only the "didn't exist (yet)" warnings.
What you think should happen instead?
The trigger should read logs from awslogs_region (falling back to region_name when unset), matching the non-deferrable path.
This is the remaining half of the log-region resolution fixed in #70464: that PR made the post-deferral fetch in execute_complete use resolve_awslogs_region(), but the in-deferral forwarding in TaskDoneTrigger still uses the ECS region. The likely fix is a separate log-region parameter on TaskDoneTrigger (the single region_name is used for two different clients), defaulted for backward compatibility with in-flight serialized triggers.
Operating System
Not Applicable
Deployment
Other
Apache Airflow Provider(s)
amazon
Versions of Apache Airflow Providers
apache-airflow-providers-amazon (main)
Official Helm Chart version
Not Applicable
Anything else?
Found while reviewing #70464.
Are you willing to submit PR?
Code of Conduct
Drafted-by: Claude Code (Fable 5) (no human review before posting)
Under which category would you file this issue?
Providers
Apache Airflow version
main (development)
What happened and how to reproduce it?
When
EcsRunTaskOperatorruns in deferrable mode withawslogs_regionset to a different region thanregion_name, the CloudWatch logs forwarded during deferral are fetched from the wrong region.EcsRunTaskOperator.executepasses onlyregion_name=self.region_nametoTaskDoneTrigger:https://github.com/apache/airflow/blob/main/providers/amazon/src/airflow/providers/amazon/aws/operators/ecs.py#L553-L564
and
TaskDoneTrigger.runuses that single region for both the ECS waiter client and the CloudWatchget_log_eventsclient:https://github.com/apache/airflow/blob/main/providers/amazon/src/airflow/providers/amazon/aws/triggers/ecs.py#L190-L223
So
_forward_logsqueriesawslogs_group/log_streamin the task's region instead of the logs region. The stream is not found there, and the trigger logs "Tried to get logs from stream ... but it didn't exist (yet)" for the whole task duration; no task logs are forwarded while deferred.Steps to reproduce:
awslogsdriver ships logs to a CloudWatch log group in region B, while the task runs in region A.EcsRunTaskOperatorwithdeferrable=True,region_name="<region A>",awslogs_region="<region B>",awslogs_groupandawslogs_stream_prefixset.What you think should happen instead?
The trigger should read logs from
awslogs_region(falling back toregion_namewhen unset), matching the non-deferrable path.This is the remaining half of the log-region resolution fixed in #70464: that PR made the post-deferral fetch in
execute_completeuseresolve_awslogs_region(), but the in-deferral forwarding inTaskDoneTriggerstill uses the ECS region. The likely fix is a separate log-region parameter onTaskDoneTrigger(the singleregion_nameis used for two different clients), defaulted for backward compatibility with in-flight serialized triggers.Operating System
Not Applicable
Deployment
Other
Apache Airflow Provider(s)
amazon
Versions of Apache Airflow Providers
apache-airflow-providers-amazon (main)
Official Helm Chart version
Not Applicable
Anything else?
Found while reviewing #70464.
Are you willing to submit PR?
Code of Conduct
Drafted-by: Claude Code (Fable 5) (no human review before posting)