Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A9855200C80 for ; Thu, 11 May 2017 02:08:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A8320160BB4; Thu, 11 May 2017 00:08:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id ECE94160B9C for ; Thu, 11 May 2017 02:08:06 +0200 (CEST) Received: (qmail 89311 invoked by uid 500); 11 May 2017 00:08:06 -0000 Mailing-List: contact commits-help@airflow.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airflow.incubator.apache.org Delivered-To: mailing list commits@airflow.incubator.apache.org Received: (qmail 89299 invoked by uid 99); 11 May 2017 00:08:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 May 2017 00:08:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 99FA2CDA6B for ; Thu, 11 May 2017 00:08:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 8Q54kNkhL98w for ; Thu, 11 May 2017 00:08:05 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id C5C105F36B for ; Thu, 11 May 2017 00:08:04 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 6DFF8E01D8 for ; Thu, 11 May 2017 00:08:04 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 1CBE821E0A for ; Thu, 11 May 2017 00:08:04 +0000 (UTC) Date: Thu, 11 May 2017 00:08:04 +0000 (UTC) From: "Nicholaus E Halecky (JIRA)" To: commits@airflow.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (AIRFLOW-637) Operators in Subdags don't have their associated DagRun in the context MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 11 May 2017 00:08:07 -0000 [ 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)