Lee-W commented on code in PR #39912:
URL: https://github.com/apache/airflow/pull/39912#discussion_r1650729272
##########
airflow/models/dagrun.py:
##########
@@ -1538,11 +1538,21 @@ def schedule_tis(
and not ti.task.outlets
):
dummy_ti_ids.append((ti.task_id, ti.map_index))
- elif ti.task.start_from_trigger is True and
ti.task.start_trigger_args is not None:
- ti.start_date = timezone.utcnow()
- if ti.state != TaskInstanceState.UP_FOR_RESCHEDULE:
- ti.try_number += 1
- ti.defer_task(exception=None, session=session)
+ # check whether the operator supports start execution from
triggerer
+ elif ti.task.start_trigger_args is not None:
+ from airflow.models.mappedoperator import MappedOperator
+
+ if isinstance(ti.task, MappedOperator):
+ context = ti.get_template_context()
+ ti.task._expand_start_trigger(context=context,
session=session)
Review Comment:
I just split `_expand_start_trigger` into `_expand_start_from_trigger` and
`_expand_start_trigger_args`. Both of them does not do anything in place and
now look a bit better.
##########
airflow/models/dagrun.py:
##########
@@ -1538,11 +1538,21 @@ def schedule_tis(
and not ti.task.outlets
):
dummy_ti_ids.append((ti.task_id, ti.map_index))
- elif ti.task.start_from_trigger is True and
ti.task.start_trigger_args is not None:
- ti.start_date = timezone.utcnow()
- if ti.state != TaskInstanceState.UP_FOR_RESCHEDULE:
- ti.try_number += 1
- ti.defer_task(exception=None, session=session)
+ # check whether the operator supports start execution from
triggerer
+ elif ti.task.start_trigger_args is not None:
+ from airflow.models.mappedoperator import MappedOperator
+
+ if isinstance(ti.task, MappedOperator):
+ context = ti.get_template_context()
+ ti.task._expand_start_trigger(context=context,
session=session)
Review Comment:
I just split `_expand_start_trigger` into `_expand_start_from_trigger` and
`_expand_start_trigger_args`. Both of them do not do anything in place and now
look a bit better.
--
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]