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 F008B200B52 for ; Mon, 11 Jul 2016 05:16:15 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EEBEA160A69; Mon, 11 Jul 2016 03:16:15 +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 43529160A66 for ; Mon, 11 Jul 2016 05:16:15 +0200 (CEST) Received: (qmail 75107 invoked by uid 500); 11 Jul 2016 03:16:14 -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 75095 invoked by uid 99); 11 Jul 2016 03:16:14 -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; Mon, 11 Jul 2016 03:16:14 +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 A1414180657 for ; Mon, 11 Jul 2016 03:16:13 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.198 X-Spam-Level: * X-Spam-Status: No, score=1.198 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_H2=-0.001, 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-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id EqUz0PwMZqeE for ; Mon, 11 Jul 2016 03:16:10 +0000 (UTC) Received: from mail-io0-f170.google.com (mail-io0-f170.google.com [209.85.223.170]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 2B5425F4E7 for ; Mon, 11 Jul 2016 03:16:10 +0000 (UTC) Received: by mail-io0-f170.google.com with SMTP id m101so11873409ioi.2 for ; Sun, 10 Jul 2016 20:16:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=vDx9CqOydKf92BjhoL3JnMYmSLsDBssvAT6Z/gaK7F4=; b=r5ukElHnfbCpl3G/UNyWnJ595eYE+GUBo6gZ2CLVrlgzMVywOlY8AZFQ7EDFIIs/Bi 0/zy1TIeReJsh9r6iIu4LQ1KKp48x2unaV2jTubYuy2GUmCbrUpkhfGdfVDcLZvApYuu 56AJKoYuHymvuGmmEIhcATuXqcvj6mW1Dckhhiwym3CH+3Kpl1hYf0bjyjbGqHl3Y4OU oJJ8leZ9krN0xyzVPHF6rZU6JbV9AVFRnJChvHnsSLn6AI4ZKg6yN/DyPcFV6I0rTe2D y8StAdToKDm9oNq+A7EYA9jkmlu6ukxQAjHdpl4dA8X5GqiytAJ4idhTse7KwT30GM3W keEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=vDx9CqOydKf92BjhoL3JnMYmSLsDBssvAT6Z/gaK7F4=; b=GBc+wmlROCL58D4MrWcjYZ4kLxFMkxY2pT4HQIkpkvyJokTBGrXBMYnCLs9xLXqYEv jF63kbvLimWEV/uguzmVu0LoiEX25mL2/Rxby6yNt2Wlu7SyMfGQdvKsCeujg8Ap9Pgg Og+4gxHt4qkPP0n1MjLiNwa4m2NuaxOJiwiKQ5OkYKWcCRbFAHJSctK6956giu1jKQ/Z e0VVAWfBhIlet6TucJxn8IXexAGpK+Aj0NNVaz1JVI8TL2R7ablGqvUotAO4Pa4smE8V iDc1IOCL4mWTX8DdDZcAfiZxW3ptowAA1nAQv93O+F09oEDSogqbMq1qlQb8rCLPbJ/e dsQw== X-Gm-Message-State: ALyK8tIgROayJxGddZG/On9IupJcb4zeOYS/L7WMM09jmnJkgbc7/lVxk0bXmO83G6pc87+f9N0gEvTV81cy+Q== X-Received: by 10.107.7.137 with SMTP id g9mr16067912ioi.64.1468206969024; Sun, 10 Jul 2016 20:16:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.120.132 with HTTP; Sun, 10 Jul 2016 20:16:08 -0700 (PDT) In-Reply-To: <1468000719847-f9ae8a50-980aa15e-98a6dd93@vo.yoo.ro> References: <1468000719847-f9ae8a50-980aa15e-98a6dd93@vo.yoo.ro> From: Maxime Beauchemin Date: Sun, 10 Jul 2016 23:16:08 -0400 Message-ID: Subject: Re: Help reusing filepath from previous task To: dev@airflow.incubator.apache.org Content-Type: multipart/alternative; boundary=001a113ec7fcd877c5053753920d archived-at: Mon, 11 Jul 2016 03:16:16 -0000 --001a113ec7fcd877c5053753920d Content-Type: text/plain; charset=UTF-8 You could: copy_data = BashOperator( task_id='copy_data', bash_command='do_stuff.sh', params={'s3_path': s3_path} dag=dag) then reference {{ params.s3_path }} as a templated element in do_stuff.sh Max On Fri, Jul 8, 2016 at 1:58 PM, wrote: > Hello. > > I'd like to reuse some info given by a task to feed subsequent S3KeySensor > checks, but after trying several ideas I'm not able to make this work. > > Basically my current DAG is as follow : > > copy_data = BashOperator( > task_id='copy_data', > # this script copies data to S3 > bash_command='do_stuff.sh', > dag=dag) > > s3_path = xxxx > for data_type in ("fileA", "fileB", "fileC"): > S3Sensor_task = S3KeySensor( > task_id='check_' + data_type, > poke_interval=20, > timeout=60, > retry_delay=timedelta(seconds=30), > bucket_key=s3_path + data_type, > bucket_name='xxxx', > s3_conn_id='s3_conn_id', > dag=dag) > S3Sensor_task.set_upstream(copy_data) > > This works great, but I'd rather avoid duplicating the S3 path in the DAG > and in the do_stuff.sh script. > So I tought pushing S3 path from the do_stuff.sh to xcom variables, but > then I need access to thoses items in my for loop. > I've tried SubDag but once again I did not manage to read xcom. > > Could someone give me some hints ? > > Regards > --001a113ec7fcd877c5053753920d--