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 8E1BA200C0F for ; Thu, 2 Feb 2017 08:58:28 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 8B6CD160B57; Thu, 2 Feb 2017 07:58:28 +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 448F0160B54 for ; Thu, 2 Feb 2017 08:58:26 +0100 (CET) Received: (qmail 7739 invoked by uid 500); 2 Feb 2017 07:58:20 -0000 Mailing-List: contact dev-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 dev@airflow.incubator.apache.org Received: (qmail 7727 invoked by uid 99); 2 Feb 2017 07:58:20 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Feb 2017 07:58:20 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id B47DC18285E for ; Thu, 2 Feb 2017 07:58:19 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.679 X-Spam-Level: * X-Spam-Status: No, score=1.679 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id PHIVPeqnWB50 for ; Thu, 2 Feb 2017 07:58:17 +0000 (UTC) Received: from mail-qt0-f180.google.com (mail-qt0-f180.google.com [209.85.216.180]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 713265F30D for ; Thu, 2 Feb 2017 07:58:17 +0000 (UTC) Received: by mail-qt0-f180.google.com with SMTP id v23so15884158qtb.0 for ; Wed, 01 Feb 2017 23:58:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=xNJofOOKZZCS4AesCJ2kiC0BJSF34pbT6wW/SPQ6GBE=; b=EFBNHcvq4zt0eDBR9KMKyUPFZUt9PyAAo28beU6fr8XepOE8THgvcNZUE/t4Io1Zme 30+LewXaiOljX5+wNYR1GDsSxHXJzGNJm8U3gXlZOoKb/7aAHen4cUa+bt63MZ9aIkMk QHmFwfZNAw+HkmR1RJIzOjdCZOgwB7sa9iKOs18Vx1OMVNpyGzbKtvIU+GNptI0mYMsw Wob7HLSbXhrlbksAuoi3X2uCrk5YYANgqkvrV4/kvDi31TVZM1IVnVzMSKVEfaw3VyQb y7EF0g8zmRKM3DDOIPg6d1aH+Fpu7SgB1CA++M1E5jHdMZPNF2RnssTDRadrKvlvvGhD HWkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=xNJofOOKZZCS4AesCJ2kiC0BJSF34pbT6wW/SPQ6GBE=; b=PEcA7oMd2G8otSQVSNyRkliF6zZ2H4/2lYfBlKMCsfuTkQkl7Lnf1OrLxAI9u/TA9w XViTdE6N6GmOi+RWeCVPFerKxqBFiNrgUVm2MYsPUrR3FH36iK6cMyXYfraeEERs3o/t 89Av0dyAk4v5S2Mq2xdJNTFdi15xPgcQ77SIRmM9qSJW+zOkFNwCNaN4Xl0HjNIPH9Ff Lmx7Pyq1qK1OIXXeuRreE/nuwc6E3wdMdg1+XLEJgj/Ms1GWRyArKuaI5osMsG+LoiR7 xCJM3GIKCJB9mkGHKKK+5VTaM39CVGkoY43/gfwV1GuzojCwUG/OtfRTn6R2ptJWsYFu p0mw== X-Gm-Message-State: AIkVDXJvbaAkGOcclkzkm385LdU86+CkpCyPTVHfcPm/4m5wa9DDSP2C53lIazIYawHfkNgYs6BnrrWNuhcmyQ== X-Received: by 10.55.25.153 with SMTP id 25mr7243453qkz.135.1486022296839; Wed, 01 Feb 2017 23:58:16 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.157.237 with HTTP; Wed, 1 Feb 2017 23:58:16 -0800 (PST) In-Reply-To: References: From: Maxime Beauchemin Date: Wed, 1 Feb 2017 23:58:16 -0800 Message-ID: Subject: Re: Pulling XCom from parent DAG in a sub DAG template To: dev@airflow.incubator.apache.org Content-Type: multipart/alternative; boundary=001a1147ef9021b133054787870a archived-at: Thu, 02 Feb 2017 07:58:28 -0000 --001a1147ef9021b133054787870a Content-Type: text/plain; charset=UTF-8 I think `dag.parent_dag.dag_id` should work, either in a template of through the context in a PythonOperator. Max On Wed, Feb 1, 2017 at 4:23 PM, Daniel Huang wrote: > Hey everyone, > I currently have a parent DAG that generates a filename based on the > current timestamp. That same filename needs to be used down the line in > multiple operators, including some subdag operators. So I was hoping to use > XComs to pass this filename along. It works fine for operators within the > parent DAG, but not for any operators in the sub DAGs because the dag_id > arg on xcom_pull() defaults to self.dag_id. I'm pulling this XCom value > from templates, so I don't want to have to hardcode a parent's dag id in it > because it should work for different parent dags. The sub dag template > would still have to make assumptions about what is available in xcom under > a task id, but I think that's alright? > > So my question is if there is a way to programmatically specify the parent > dag id in an xcom pull from within a template or if there's a better way of > doing what I'm trying to achieve. Note, I also have sub dags within sub > dags that require the same filename. > > If there is no way to this already, I did come across > https://issues.apache.org/jira/browse/AIRFLOW-54 and wondered if we need > something similar for the dag_id arg, like ti.xcom_pull(dag_id='@parent', > task_ids='foo'). > > Thanks, > Daniel > --001a1147ef9021b133054787870a--