uranusjr commented on code in PR #68517:
URL: https://github.com/apache/airflow/pull/68517#discussion_r4204069269


##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -2931,41 +2958,54 @@ def _create_dag_runs_asset_triggered(
                     len(queued_adrqs),
                     triggered_date,
                 )
-                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,
-                )
+                if dag.timetable.batch_asset_events:
+                    event_runs = iter([(triggered_date, asset_events)])
+                else:
+                    event_runs = ((timezone.coerce_datetime(ev.timestamp), 
[ev]) for ev in asset_events)

Review Comment:
   The scheduler now branches on `timetable.batch_asset_events` in several 
places. Grouping events into runs should be the timetable's decision. Maybe we 
should have a method on the timetable
   
   ```python
   def group_asset_events(
       self,
       events,
       triggered_date,
   ) -> Iterable[tuple[datetime, list[AssetEvent]]]
   ```
   
   for the scheduler to use?



-- 
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]

Reply via email to