You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/03/29 15:33:46 UTC

[GitHub] [airflow] dimberman opened a new issue #7966: Operators in Subdags don't have their associated DagRun in the context

dimberman opened a new issue #7966: Operators in Subdags don't have their associated DagRun in the context
URL: https://github.com/apache/airflow/issues/7966
 
 
   
   
   **Apache Airflow version**: None
   
   Ticket was created 17/Nov/16 21:19
   
   **Kubernetes version (if you are using kubernetes)** (use `kubectl version`):
   
   **Environment**:
   
   - **Cloud provider or hardware configuration**:
   - **OS** (e.g. from /etc/os-release):
   - **Kernel** (e.g. `uname -a`):
   - **Install tools**:
   - **Others**:
   **What happened**:
   
   Currently in models.get_template_context we have:
   
   run_id = ''
           dag_run = None
           if hasattr(task, 'dag'):
               if task.dag.params:
                   params.update(task.dag.params)
               dag_run = (
                   session.query(DagRun)
                   .filter_by(
                       dag_id=task.dag.dag_id,
                       execution_date=self.execution_date)
                   .first()
               )
               run_id = dag_run.run_id if dag_run else None
               session.expunge_all()
   session.commit()
   
   
   
   Since subdags do not have associated DagRuns for their dag_id, the context will not contain the dagrun or run_id associated with the subdag, even though it exists associated with the parent dag.
   
   If we change this code to up the DagRun based on the dag_id of the parent dag, we can set these values.
   
   **What you expected to happen**:
   
   
   **How to reproduce it**:
   
   
   **Anything else we need to know**:
   
   Moved here from https://issues.apache.org/jira/browse/AIRFLOW-637
       

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services