Copilot commented on code in PR #62907:
URL: https://github.com/apache/airflow/pull/62907#discussion_r2894235347


##########
airflow-e2e-tests/tests/airflow_e2e_tests/xcom_object_storage_tests/test_xcom_object_storage_backend.py:
##########
@@ -0,0 +1,89 @@
+# 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.
+from __future__ import annotations
+
+import time
+from datetime import datetime, timezone
+from pprint import pprint
+from uuid import uuid4
+
+import pytest
+
+from airflow_e2e_tests.constants import XCOM_BUCKET
+from airflow_e2e_tests.e2e_test_utils.clients import AirflowClient, 
get_s3_client
+
+
+class TestXComObjectStorageBackend:
+    airflow_client = AirflowClient()
+    dag_id = "example_xcom_test"
+    retry_interval_in_seconds = 5
+    max_retries = 12
+
+    def test_dag_succeeds_and_xcom_values_stored_in_s3(self):
+        """Test that a DAG using XComObjectStorageBackend completes 
successfully and persists XCom values to S3."""
+        self.airflow_client.un_pause_dag(self.dag_id)
+
+        trigger_resp = self.airflow_client.trigger_dag(
+            self.dag_id,
+            json={
+                "dag_run_id": f"test_xcom_object_storage_backend_{uuid4()}",
+                "logical_date": datetime.now(timezone.utc).isoformat(),
+            },
+        )
+        dag_run_id = trigger_resp["dag_run_id"]
+        state = self.airflow_client.wait_for_dag_run(
+            dag_id=self.dag_id,
+            run_id=dag_run_id,
+        )
+
+        # try to get all the logs to help debugging
+        if state != "success":
+            task_instances_resp = 
self.airflow_client.get_task_instances(self.dag_id, dag_run_id)
+            for task_instance in task_instances_resp["task_instances"]:
+                task_id = task_instance["task_id"]
+                try_number = task_instance["try_number"]
+                try:
+                    print(f"\nLogs for task {task_id} (try {try_number}):")
+                    task_logs_resp = self.airflow_client.get_task_logs(
+                        dag_id=self.dag_id, task_id="bash_pull", 
run_id=dag_run_id, try_number=try_number

Review Comment:
   Bug: The debug log-fetching loop iterates over all task instances but always 
fetches logs for `task_id="bash_pull"` instead of using the `task_id` variable 
extracted from each task instance. This means when the DAG fails, you'll only 
see `bash_pull` logs repeated for every task instance, making debugging harder. 
The `task_id` parameter should use the `task_id` variable from the loop.
   ```suggestion
                           dag_id=self.dag_id, task_id=task_id, 
run_id=dag_run_id, try_number=try_number
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to