This is an automated email from the ASF dual-hosted git repository.
shahar1 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 740c6880e1c Preserve BigQueryIntervalCheckTrigger params after
triggerer restart (#67053)
740c6880e1c is described below
commit 740c6880e1ca7276cda4d8b1615aee114e33cda2
Author: deepinsight coder <[email protected]>
AuthorDate: Sun May 17 12:58:16 2026 -0700
Preserve BigQueryIntervalCheckTrigger params after triggerer restart
(#67053)
---
.../providers/google/cloud/triggers/bigquery.py | 3 +++
.../unit/google/cloud/triggers/test_bigquery.py | 21 +++++++++++++++++++--
scripts/ci/prek/check_trigger_serialize_init.py | 3 ---
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git
a/providers/google/src/airflow/providers/google/cloud/triggers/bigquery.py
b/providers/google/src/airflow/providers/google/cloud/triggers/bigquery.py
index ff31833a7c3..f0f47a2c0cf 100644
--- a/providers/google/src/airflow/providers/google/cloud/triggers/bigquery.py
+++ b/providers/google/src/airflow/providers/google/cloud/triggers/bigquery.py
@@ -480,6 +480,9 @@ class
BigQueryIntervalCheckTrigger(BigQueryInsertJobTrigger):
"table": self.table,
"metrics_thresholds": self.metrics_thresholds,
"location": self.location,
+ "dataset_id": self.dataset_id,
+ "table_id": self.table_id,
+ "poll_interval": self.poll_interval,
"date_filter_column": self.date_filter_column,
"days_back": self.days_back,
"ratio_formula": self.ratio_formula,
diff --git a/providers/google/tests/unit/google/cloud/triggers/test_bigquery.py
b/providers/google/tests/unit/google/cloud/triggers/test_bigquery.py
index f974cccc338..25a29b8118d 100644
--- a/providers/google/tests/unit/google/cloud/triggers/test_bigquery.py
+++ b/providers/google/tests/unit/google/cloud/triggers/test_bigquery.py
@@ -29,6 +29,7 @@ from gcloud.aio.bigquery import Table
from multidict import CIMultiDict, CIMultiDictProxy
from yarl import URL
+from airflow.providers.common.compat.module_loading import import_string
from airflow.providers.google.cloud.hooks.bigquery import
BigQueryTableAsyncHook
from airflow.providers.google.cloud.triggers.bigquery import (
BigQueryCheckTrigger,
@@ -51,6 +52,7 @@ TEST_DATASET_ID = "bq_dataset"
TEST_TABLE_ID = "bq_table"
TEST_LOCATION = "US"
POLLING_PERIOD_SECONDS = 4.0
+INTERVAL_CHECK_POLLING_PERIOD_SECONDS = 9.0
TEST_SQL_QUERY = "SELECT count(*) from Any"
TEST_PASS_VALUE = 2
TEST_TOLERANCE = 1
@@ -125,7 +127,7 @@ def interval_check_trigger():
ignore_zero=TEST_IGNORE_ZERO,
dataset_id=TEST_DATASET_ID,
table_id=TEST_TABLE_ID,
- poll_interval=POLLING_PERIOD_SECONDS,
+ poll_interval=INTERVAL_CHECK_POLLING_PERIOD_SECONDS,
impersonation_chain=TEST_IMPERSONATION_CHAIN,
)
@@ -613,6 +615,9 @@ class TestBigQueryIntervalCheckTrigger:
"project_id": TEST_GCP_PROJECT_ID,
"table": TEST_TABLE_ID,
"location": None,
+ "dataset_id": TEST_DATASET_ID,
+ "table_id": TEST_TABLE_ID,
+ "poll_interval": INTERVAL_CHECK_POLLING_PERIOD_SECONDS,
"metrics_thresholds": TEST_METRIC_THRESHOLDS,
"date_filter_column": TEST_DATE_FILTER_COLUMN,
"days_back": TEST_DAYS_BACK,
@@ -620,6 +625,18 @@ class TestBigQueryIntervalCheckTrigger:
"ignore_zero": TEST_IGNORE_ZERO,
}
+ def test_interval_check_trigger_round_trip(self, interval_check_trigger):
+ """Assert explicit interval check parameters survive triggerer
re-instantiation."""
+ classpath, kwargs = interval_check_trigger.serialize()
+
+ trigger_cls = import_string(classpath)
+ reconstructed_trigger = trigger_cls(**kwargs)
+
+ assert reconstructed_trigger.serialize() == (classpath, kwargs)
+ assert reconstructed_trigger.dataset_id == TEST_DATASET_ID
+ assert reconstructed_trigger.table_id == TEST_TABLE_ID
+ assert reconstructed_trigger.poll_interval ==
INTERVAL_CHECK_POLLING_PERIOD_SECONDS
+
@pytest.mark.asyncio
@mock.patch("airflow.providers.google.cloud.hooks.bigquery.BigQueryAsyncHook.get_sync_hook")
@mock.patch("airflow.providers.google.cloud.hooks.bigquery.BigQueryAsyncHook.get_job_status")
@@ -714,7 +731,7 @@ class TestBigQueryIntervalCheckTrigger:
assert task.done() is False
assert "Query is still running..." in caplog.text
- assert f"Sleeping for {POLLING_PERIOD_SECONDS} seconds." in caplog.text
+ assert f"Sleeping for {INTERVAL_CHECK_POLLING_PERIOD_SECONDS}
seconds." in caplog.text
# Prevents error when task is destroyed while in "pending" state
asyncio.get_event_loop().stop()
diff --git a/scripts/ci/prek/check_trigger_serialize_init.py
b/scripts/ci/prek/check_trigger_serialize_init.py
index 3866d779269..6e91056e072 100755
--- a/scripts/ci/prek/check_trigger_serialize_init.py
+++ b/scripts/ci/prek/check_trigger_serialize_init.py
@@ -64,9 +64,6 @@ KNOWN_VIOLATIONS: set[str] = {
# falls back to the class-name default on a triggerer round-trip.
"databricks/src/airflow/providers/databricks/triggers/databricks.py::DatabricksExecutionTrigger",
"databricks/src/airflow/providers/databricks/triggers/databricks.py::DatabricksSQLStatementExecutionTrigger",
- # `dataset_id`, `table_id`, `poll_interval` are forwarded to the parent
__init__ and used, but
- # the overridden serialize() omits them.
-
"google/src/airflow/providers/google/cloud/triggers/bigquery.py::BigQueryIntervalCheckTrigger",
# `poll_interval` and `impersonation_chain` are stored and used but
missing from serialize().
"google/src/airflow/providers/google/cloud/triggers/datafusion.py::DataFusionStartPipelineTrigger",
# `endpoint_prefix` is stored as self._endpoint_prefix and used in run()
but missing from serialize().