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 DCE95200C41 for ; Fri, 24 Mar 2017 11:46:05 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id D9936160B93; Fri, 24 Mar 2017 10:46:05 +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 2A673160B82 for ; Fri, 24 Mar 2017 11:46:05 +0100 (CET) Received: (qmail 3835 invoked by uid 500); 24 Mar 2017 10:46:04 -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 3817 invoked by uid 99); 24 Mar 2017 10:46:03 -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; Fri, 24 Mar 2017 10:46:03 +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 AFE50182398 for ; Fri, 24 Mar 2017 10:46:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.396 X-Spam-Level: X-Spam-Status: No, score=-0.396 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_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-2.796, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=tinyclues.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 LvN_X1vJaqLL for ; Fri, 24 Mar 2017 10:46:01 +0000 (UTC) Received: from mail-vk0-f48.google.com (mail-vk0-f48.google.com [209.85.213.48]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 6F4EA5F297 for ; Fri, 24 Mar 2017 10:46:00 +0000 (UTC) Received: by mail-vk0-f48.google.com with SMTP id d188so10864320vka.0 for ; Fri, 24 Mar 2017 03:46:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tinyclues.com; s=tinyclues.com; h=mime-version:from:date:message-id:subject:to; bh=DQJAQEQivoJnZmFsTiTapxfMhavkoHblHUno2qcq8A8=; b=NvBhzhcu4SBJv5DG6AXbCnjuMEdFrJkezzzrjXvGwJJQxJg+IvylgDUp5/yJIUsZ7W SemIuUKNmTB8QXNCcKwMFWb74Z/qjO7N8QNR+yQVQoVlloCaDpVlhyWWvPTUGHFYQb7Q hc/k0dUHElXbHw440oS2teNm6/2KJBHd1Ocks= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=DQJAQEQivoJnZmFsTiTapxfMhavkoHblHUno2qcq8A8=; b=tkvWXnlorIJO/HC6H2+21kT0FRXkLixV8rAFJJbD490FOtb6NbasJBzsiC5HrgT6Hv 6WYVZs0EyCLJmh0ArfwDXxeIk4TtYwoZ9oavEOgCYx6HPomVt4itiewGrO3rv/jpgHLK vt4ZLL8yHXQaa+L49jRZCbOyut8yiWe2OoA1Vc43YQcC5Fies7jK08yayJGK2bITdHsc rjfA4xMZ4BesDpJKz/mviB8qQT1ECbHGvEokA2OcD5elf6uUrqBFW8IgTjrUfk+KhXf/ YI4PxZy4MpEzC9glvHw4qLv1d2Mq9VYGE9kRdm5w5g7nl5dAlKSoCebsdaaeUn5bD+iU HHPA== X-Gm-Message-State: AFeK/H29E4cv4ZYUIuoKjZ6O41VtY1ZQXj/+bmzWmGKPUgHnihrbfG3INGnldLqucpQ90AmsWOXDhAd3G9ZO1Wdn X-Received: by 10.159.41.37 with SMTP id t34mr3265731uat.104.1490352359251; Fri, 24 Mar 2017 03:45:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.3.145 with HTTP; Fri, 24 Mar 2017 03:45:38 -0700 (PDT) From: Vincent Poulain Date: Fri, 24 Mar 2017 11:45:38 +0100 Message-ID: Subject: Dag & tasks testing To: dev@airflow.incubator.apache.org Content-Type: multipart/alternative; boundary=001a114cc192f6ba83054b77b28b archived-at: Fri, 24 Mar 2017 10:46:06 -0000 --001a114cc192f6ba83054b77b28b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello, I have a quite important DAG (~20 tasks) using multiple Operators. I dynamically create DAG using a dag =3D XXXDagFactory.create(**kwargs). I would like to test this dag factory. For now I have a big method create. It is something like with Dag() as dag: t1 =3D PythonOperator(**kwargs) t2 =3D BashOperator(**kwargs) t3 =3D ECSOperator(**kwargs) ... t1 >> t2 >> t3 ... return dag With 300 lines of code :) What do you recommend to write unit tests to assess that Operators are called with right arguments and so on. I don't want to have a unique test_create() method. Should I create "business" method Operator wrapping technical Operator. For instance : class DoSomethindParticularOperator(PythonOperator): def __init__(**specific_args): Or rather write just method returning task and test them. def scoringTask(a, b, c): return ECSOperator(...) Do you have some tips ? Thanks! --=20 *Vincent Poulain* Senior Software Engineer Office +33 1 75 50 67 26 <+33%201%2075%2050%2067%2026> | Mobile +33 6 21 82 87 62 | vincent@tinyclues.com Tinyclues | 51 rue =C3=89tienne Marcel, 75001 Paris www.tinyclues.com | @tinyclues --001a114cc192f6ba83054b77b28b--