aaron-y-chen commented on code in PR #58543:
URL: https://github.com/apache/airflow/pull/58543#discussion_r4147213755
##########
airflow-core/src/airflow/timetables/assets.py:
##########
@@ -18,18 +18,25 @@
from __future__ import annotations
import typing
+from collections.abc import Collection
from airflow.exceptions import AirflowTimetableInvalid
-from airflow.serialization.definitions.assets import SerializedAsset,
SerializedAssetBase
+from airflow.serialization.definitions.assets import SerializedAsset,
SerializedAssetAll, SerializedAssetBase
+from airflow.timetables.base import Timetable
from airflow.timetables.simple import AssetTriggeredTimetable
from airflow.utils.types import DagRunType
if typing.TYPE_CHECKING:
- from collections.abc import Collection
-
import pendulum
- from airflow.timetables.base import DagRunInfo, DataInterval,
TimeRestriction, Timetable
+ from airflow.timetables.base import DagRunInfo, DataInterval,
TimeRestriction
+
+
+def _validate_asset_time_schedule(*, timetable: Timetable, asset_condition:
SerializedAssetBase) -> None:
+ if timetable.asset_triggered or timetable.asset_gated:
+ raise AirflowTimetableInvalid("cannot nest asset-aware timetables")
+ if not isinstance(asset_condition, SerializedAssetBase):
+ raise AirflowTimetableInvalid("all elements in 'assets' must be
assets")
Review Comment:
Thanks!
--
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]