This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 79991cd4db0 Fix id_to_job_info memory leak in the AWS Batch executor 
(#72186)
79991cd4db0 is described below

commit 79991cd4db0c9346a28b23c453377f6df0c6b4ed
Author: PoAn Yang <[email protected]>
AuthorDate: Sun Sep 20 22:30:01 2026 +0800

    Fix id_to_job_info memory leak in the AWS Batch executor (#72186)
    
    Signed-off-by: PoAn Yang <[email protected]>
---
 .../amazon/src/airflow/providers/amazon/aws/executors/batch/utils.py  | 1 +
 providers/amazon/tests/unit/amazon/aws/executors/batch/test_utils.py  | 4 +---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git 
a/providers/amazon/src/airflow/providers/amazon/aws/executors/batch/utils.py 
b/providers/amazon/src/airflow/providers/amazon/aws/executors/batch/utils.py
index d47fc93ff5b..4fc127fca86 100644
--- a/providers/amazon/src/airflow/providers/amazon/aws/executors/batch/utils.py
+++ b/providers/amazon/src/airflow/providers/amazon/aws/executors/batch/utils.py
@@ -126,6 +126,7 @@ class BatchJobCollection:
         del self.key_to_id[workload_key]
         del self.id_to_key[job_id]
         del self.id_to_failure_counts[job_id]
+        del self.id_to_job_info[job_id]
         return workload_key
 
     def remove_job(self, job_id: str) -> BatchJobWorkloadKey | None:
diff --git 
a/providers/amazon/tests/unit/amazon/aws/executors/batch/test_utils.py 
b/providers/amazon/tests/unit/amazon/aws/executors/batch/test_utils.py
index 3ee8dca2628..0bf8fc35c91 100644
--- a/providers/amazon/tests/unit/amazon/aws/executors/batch/test_utils.py
+++ b/providers/amazon/tests/unit/amazon/aws/executors/batch/test_utils.py
@@ -206,9 +206,7 @@ class TestBatchJobCollection:
         assert len(self.collection) == 0
         assert self.job_id1 not in self.collection.id_to_key
         assert self.key1 not in self.collection.key_to_id
-        # id_to_job_info is NOT removed by pop_by_id in the current 
implementation.
-        assert self.job_id1 in self.collection.id_to_job_info
-        assert self.collection.id_to_job_info[self.job_id1].cmd == self.cmd1
+        assert self.job_id1 not in self.collection.id_to_job_info
         # id_to_failure_counts is a defaultdict, so accessing a removed key 
returns 0.
         assert self.collection.id_to_failure_counts[self.job_id1] == 0
 

Reply via email to