This is an automated email from the ASF dual-hosted git repository.
eladkal 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 fdfe2150eff Fix Google Cloud Batch error messages to include job name
(#69783)
fdfe2150eff is described below
commit fdfe2150eff733a1d2c092d496097634f384b0ac
Author: Hojeong Park <[email protected]>
AuthorDate: Tue Jul 14 03:43:51 2026 +0900
Fix Google Cloud Batch error messages to include job name (#69783)
The missing f-string prefixes caused Cloud Batch errors to display the
literal `{job_name}`.
---
.../google/src/airflow/providers/google/cloud/hooks/cloud_batch.py | 4 ++--
providers/google/tests/unit/google/cloud/hooks/test_cloud_batch.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git
a/providers/google/src/airflow/providers/google/cloud/hooks/cloud_batch.py
b/providers/google/src/airflow/providers/google/cloud/hooks/cloud_batch.py
index 55b627fea62..11c6dfc30f5 100644
--- a/providers/google/src/airflow/providers/google/cloud/hooks/cloud_batch.py
+++ b/providers/google/src/airflow/providers/google/cloud/hooks/cloud_batch.py
@@ -154,12 +154,12 @@ class CloudBatchHook(GoogleBaseHook):
if status == JobStatus.State.FAILED:
message = (
"Unexpected error in the operation: "
- "Batch job with name {job_name} has failed its
execution."
+ f"Batch job with name {job_name} has failed its
execution."
)
raise AirflowException(message)
if status == JobStatus.State.DELETION_IN_PROGRESS:
message = (
- "Unexpected error in the operation: Batch job with
name {job_name} is being deleted."
+ f"Unexpected error in the operation: Batch job with
name {job_name} is being deleted."
)
raise AirflowException(message)
time.sleep(polling_period_seconds)
diff --git a/providers/google/tests/unit/google/cloud/hooks/test_cloud_batch.py
b/providers/google/tests/unit/google/cloud/hooks/test_cloud_batch.py
index 5300e294de9..3c0cda1fb61 100644
--- a/providers/google/tests/unit/google/cloud/hooks/test_cloud_batch.py
+++ b/providers/google/tests/unit/google/cloud/hooks/test_cloud_batch.py
@@ -107,7 +107,7 @@ class TestCloudBathHook:
def test_wait_job_does_not_succeed(self, mock_batch_service_client, state,
cloud_batch_hook):
mock_job = self._mock_job_with_status(state)
mock_batch_service_client.return_value.get_job.return_value = mock_job
- with pytest.raises(AirflowException):
+ with pytest.raises(AirflowException, match="job1"):
cloud_batch_hook.wait_for_job("job1")
@mock.patch(