[ 
https://issues.apache.org/jira/browse/AIRFLOW-637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16005695#comment-16005695
 ] 

Nicholaus E Halecky commented on AIRFLOW-637:
---------------------------------------------

Hi [~davidvtaylor], I was interested to know if there has been any progress on 
this issue? If not, I'm interested in submitting a PR with a fix! Can we get a 
maintainer to comment with any pointers? Thank you!

> Operators in Subdags don't have their associated DagRun in the context
> ----------------------------------------------------------------------
>
>                 Key: AIRFLOW-637
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-637
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: DagRun, operators, subdag
>            Reporter: Taylor Murphy
>            Priority: Minor
>
> Currently in models.get_template_context we have:
> {code}
> 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()
> {code}
> 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. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to