enriqueayala opened a new issue #18559:
URL: https://github.com/apache/airflow/issues/18559


   ### Apache Airflow version
   
   2.1.4 (latest released)
   
   ### Operating System
   
   Ubuntu 20.04
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Virtualenv installation
   
   ### Deployment details
   
   _No response_
   
   ### What happened
   
   Access to dag_run.start_date attribute from subdag returns `None`. 
   
   ### What you expected to happen
   
   Return DagRun.start_date of parent_dag (working on 2.1.0)
   
   ### How to reproduce
   
   Modify example_dags\subdags\subdag.py to : 
   ```
   from airflow import DAG
   from airflow.operators.bash import BashOperator
   from airflow.utils.dates import days_ago
   
   
   def subdag(parent_dag_name, child_dag_name, args):
       with DAG(
           dag_id=f'{parent_dag_name}.{child_dag_name}',
           default_args=args,
           start_date=days_ago(2),
           schedule_interval="@daily",
       ) as dag_subdag:
           
           t1 = BashOperator(
               task_id='echo_execution_date',
               bash_command='echo "{{dag_run.execution_date}}"',
           )
           t2 = BashOperator(
               task_id='echo_start_date',
               bash_command='echo "{{dag_run.start_date}}"',
           )
   
           t1 >> t2
   
       return dag_subdag
   ```
   
![dag_run_start_date](https://user-images.githubusercontent.com/10963531/134992336-fa6035d4-8504-44f0-b5d2-890690b9ab5d.PNG)
   
   
![dag_run_exec_date](https://user-images.githubusercontent.com/10963531/134992299-4bd00a10-0b22-44aa-b9e0-8f903133eb04.PNG)
   
   
   
   ### Anything else
   
   It also occurs within a task through context. 
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to