Return-Path: X-Original-To: apmail-airflow-commits-archive@minotaur.apache.org Delivered-To: apmail-airflow-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9330F194BB for ; Thu, 28 Apr 2016 15:41:15 +0000 (UTC) Received: (qmail 6392 invoked by uid 500); 28 Apr 2016 15:41:15 -0000 Delivered-To: apmail-airflow-commits-archive@airflow.apache.org Received: (qmail 6368 invoked by uid 500); 28 Apr 2016 15:41:15 -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 6359 invoked by uid 99); 28 Apr 2016 15:41:15 -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, 28 Apr 2016 15:41:15 +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 3BD1FC77BE for ; Thu, 28 Apr 2016 15:41:14 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -5.016 X-Spam-Level: X-Spam-Status: No, score=-5.016 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.996] 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 eTAqPAojq7je for ; Thu, 28 Apr 2016 15:41:13 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 7E4B25F33E for ; Thu, 28 Apr 2016 15:41:13 +0000 (UTC) Received: (qmail 5537 invoked by uid 99); 28 Apr 2016 15:41:13 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Apr 2016 15:41:13 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id DAE1C2C0451 for ; Thu, 28 Apr 2016 15:41:12 +0000 (UTC) Date: Thu, 28 Apr 2016 15:41:12 +0000 (UTC) From: "Jeremiah Lowin (JIRA)" To: commits@airflow.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (AIRFLOW-14) DagRun Refactor (Scheduler 2.0) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AIRFLOW-14?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1526= 2357#comment-15262357 ]=20 Jeremiah Lowin commented on AIRFLOW-14: --------------------------------------- Yes, that situation could arise... I'm not sure of the best way to handle t= his in a database-agnostic way (i.e. SQLAlchemy). I'd appreciate any sugge= stions! > DagRun Refactor (Scheduler 2.0) > ------------------------------- > > Key: AIRFLOW-14 > URL: https://issues.apache.org/jira/browse/AIRFLOW-14 > Project: Apache Airflow > Issue Type: Improvement > Reporter: Jeremiah Lowin > Assignee: Jeremiah Lowin > Labels: backfill, dagrun, scheduler > > For full proposal, please see the Wiki: https://cwiki.apache.org/confluen= ce/pages/viewpage.action?pageId=3D62694286 > Borrowing from that page:=20 > *Description of New Workflow* > DagRuns represent the state of a DAG at a certain point in time (perhaps = they should be called DagInstances?). To run a DAG =E2=80=93 or to manage t= he execution of a DAG =E2=80=93 a DagRun must first be created. This can be= done manually (simply by creating a DagRun object) or automatically, using= methods like dag.schedule_dag(). Therefore, both scheduling new runs OR in= troducing ad-hoc runs can be done by any process at any time, simply by cre= ating the appropriate object. > Just creating a DagRun is not enough to actually run the DAG (just as cre= ating a TaskInstance is not the same as actually running a task). We need a= Job for that. The DagRunJob is fairly simple in structure. It maintains a = set of DagRuns that it is tasked with executing, and loops over that set un= til all the DagRuns either succeed or fail. New DagRuns can be passed to th= e job explicitly via DagRunJob.submit_dagruns() or by defining its DagRunJo= b.collect_dagruns() method, which is called during each loop. When the DagR= unJob is executing a specific DagRun, it locks it. Other DagRunJobs will no= t try to execute locked DagRuns. This way, many DagRunJobs can run simultan= eously in either a local or distributed setting, and can even be pointed at= the same DagRuns, without worrying about collisions or interference. > The basic DagRunJob loop works like this: > - refresh dags > - collect new dagruns > - process dagruns (including updating dagrun states for success/failure) > - call executor/own heartbeat > By tweaking the DagRunJob, we can easily recreate the behavior of the cur= rent SchedulerJob and BackfillJob. The Scheduler simply runs forever and pi= cks up ALL active DagRuns in collect_dagruns(); Backfill generates DagRuns = corresponding to the requested start/end dates and submits them to itself p= rior to initiating its loop. -- This message was sent by Atlassian JIRA (v6.3.4#6332)