Taragolis commented on code in PR #28398:
URL: https://github.com/apache/airflow/pull/28398#discussion_r1051297557
##########
airflow/api/common/trigger_dag.py:
##########
@@ -51,7 +51,11 @@ def _trigger_dag(
if dag is None or dag_id not in dag_bag.dags:
raise DagNotFound(f"Dag id {dag_id} not found")
- execution_date = execution_date if execution_date else timezone.utcnow()
+ if execution_date is None:
+ if conf and "logical_date" in conf:
+ execution_date = conf["logical_date"]
Review Comment:
And this also incorrect assumption.
`default_args` designed for reuse same parameters across Tasks within the
single DAG, and it user-defined on code level. This arguments do not changed by
their nature in runtime, except selected arguments:
1. `params` -
[Params](https://airflow.apache.org/docs/apache-airflow/stable/concepts/params.html#params)
could defined on DAG and Task level, so it resolved during DAG initialisation
2. `start_date` and `end_date` -
https://airflow.apache.org/docs/apache-airflow/stable/faq.html#what-s-the-deal-with-start-date
That is all exceptions.
`default_args` doesn't not contain `logical_date` / `execution_date` unless
user define it, and this might happen if required propagate this arguments to
[TriggerDagRunOperator](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/operators/trigger_dagrun/index.html#airflow.operators.trigger_dagrun.TriggerDagRunOperator)
or
[ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor)
without explicit define it during initialisation. But even in this case most
probably it would be something like:
```python
with DAG(
...,
default_args={
"execution_date": "{{ logical_date }}"
},
) as dag:
...
```
--
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]