Lee-W commented on code in PR #69849:
URL: https://github.com/apache/airflow/pull/69849#discussion_r3577882568
##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -2341,13 +2362,15 @@ def _create_dagruns_for_partitioned_asset_dags(self,
session: Session) -> set[st
creating_job_id=self.job.id,
session=session,
)
- asset_events = session.scalars(
- select(AssetEvent).where(
- PartitionedAssetKeyLog.asset_partition_dag_run_id ==
apdr.id,
- PartitionedAssetKeyLog.asset_event_id == AssetEvent.id,
- )
+ asset_event_ids = select(AssetEvent.id.label("event_id")).where(
Review Comment:
This naming is inaccurate. This is a SQL clause insetad of id itself
##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -2619,27 +2642,21 @@ def _create_dag_runs_asset_triggered(
)
event_window_floor.append(date.min)
- asset_events = list(
- session.scalars(
- select(AssetEvent)
- .where(
- or_(
- AssetEvent.asset_id.in_(
-
select(DagScheduleAssetReference.asset_id).where(
- DagScheduleAssetReference.dag_id ==
dag.dag_id
- )
- ),
- AssetEvent.source_aliases.any(
- AssetAliasModel.scheduled_dags.any(
- DagScheduleAssetAliasReference.dag_id ==
dag.dag_id
- )
- ),
+ asset_event_ids = select(AssetEvent.id.label("event_id")).where(
+ or_(
+ AssetEvent.asset_id.in_(
+ select(DagScheduleAssetReference.asset_id).where(
+ DagScheduleAssetReference.dag_id == dag.dag_id
),
- AssetEvent.timestamp <= triggered_date,
- AssetEvent.timestamp >
func.coalesce(*event_window_floor),
- )
- .order_by(AssetEvent.timestamp.asc(), AssetEvent.id.asc())
- )
+ ),
+ AssetEvent.source_aliases.any(
+ AssetAliasModel.scheduled_dags.any(
+ DagScheduleAssetAliasReference.dag_id == dag.dag_id
+ )
+ ),
+ ),
+ AssetEvent.timestamp <= triggered_date,
+ AssetEvent.timestamp > func.coalesce(*event_window_floor),
Review Comment:
why do we remove the `order_by` here?
--
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]