You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Jeremiah Lowin (JIRA)" <ji...@apache.org> on 2017/03/16 03:14:41 UTC

[jira] [Updated] (AIRFLOW-993) Dags should modify the start date and end date of tasks when they are added

     [ https://issues.apache.org/jira/browse/AIRFLOW-993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeremiah Lowin updated AIRFLOW-993:
-----------------------------------
    Description: 
When tasks are added to DAGs, the DAG checks if the task has a start_date. If it doesn't, the DAG sets it to its own start date. This isn't done for end_date, but it should be.

Otherwise, this simple code leads to a surprising failure as the backfill tries to run the task every day, even though the DAG clearly has an end date set.

{code}

from airflow.models import DAG
from airflow.operators.dummy_operator import DummyOperator
import datetime

dt = datetime.datetime(2017, 1, 1)

Furthermore, it may make sense for the task start date to always be the later of the task start date and the dag start date; similarly for the end date (but using the earlier date)
with DAG('test', start_date=dt, end_date=dt) as dag:
    op = DummyOperator(task_id='dummy')

op.run()
{code}


  was:
When tasks are added to DAGs, the DAG checks if the task has a start_date. If it doesn't, the DAG sets it to its own start date. This isn't done for end_date, but it should be.

Otherwise, this simple code leads to a surprising failure as the backfill tries to run the task every day, even though the DAG clearly has an end date set.

{code}

from airflow.models import DAG
from airflow.operators.dummy_operator import DummyOperator
import datetime

dt = datetime.datetime(2017, 1, 1)

with DAG('test', start_date=dt, end_date=dt) as dag:
    op = DummyOperator(task_id='dummy')

op.run()
{code}



> Dags should modify the start date and end date of tasks when they are added
> ---------------------------------------------------------------------------
>
>                 Key: AIRFLOW-993
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-993
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: DAG
>    Affects Versions: 1.8.0
>            Reporter: Jeremiah Lowin
>            Assignee: Jeremiah Lowin
>            Priority: Minor
>             Fix For: 1.8.1
>
>
> When tasks are added to DAGs, the DAG checks if the task has a start_date. If it doesn't, the DAG sets it to its own start date. This isn't done for end_date, but it should be.
> Otherwise, this simple code leads to a surprising failure as the backfill tries to run the task every day, even though the DAG clearly has an end date set.
> {code}
> from airflow.models import DAG
> from airflow.operators.dummy_operator import DummyOperator
> import datetime
> dt = datetime.datetime(2017, 1, 1)
> Furthermore, it may make sense for the task start date to always be the later of the task start date and the dag start date; similarly for the end date (but using the earlier date)
> with DAG('test', start_date=dt, end_date=dt) as dag:
>     op = DummyOperator(task_id='dummy')
> op.run()
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)