uranusjr commented on code in PR #68517:
URL: https://github.com/apache/airflow/pull/68517#discussion_r3457052535
##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -2572,27 +2572,34 @@ def _create_dag_runs_asset_triggered(
)
)
- dag_run = dag.create_dagrun(
- run_id=DagRun.generate_run_id(
- run_type=DagRunType.ASSET_TRIGGERED, logical_date=None,
run_after=triggered_date
- ),
- logical_date=None,
- data_interval=None,
- run_after=triggered_date,
- run_type=DagRunType.ASSET_TRIGGERED,
- triggered_by=DagRunTriggeredByType.ASSET,
- state=DagRunState.QUEUED,
- creating_job_id=self.job.id,
- session=session,
- )
- stats.incr("asset.triggered_dagruns")
- dag_run.consumed_asset_events.extend(asset_events)
- self.log.info(
- "Created asset-triggered DagRun for '%s': run_id=%s, consumed
%d asset events",
- dag.dag_id,
- dag_run.run_id,
- len(asset_events),
- )
+ # Build the list of (run_after, events) to process: one entry per
DagRun to create.
+ if dag.timetable.batch_asset_events:
+ event_runs = [(triggered_date, asset_events)]
+ else:
+ event_runs = [(timezone.coerce_datetime(ev.timestamp), [ev])
for ev in asset_events]
Review Comment:
```suggestion
event_runs = ((timezone.coerce_datetime(ev.timestamp), [ev])
for ev in asset_events)
```
This does not need to be a list since it’s simply consumed directly.
(Typing tweaks may be needed to satisfy the type checker.)
--
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]