[
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)
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}
Furthermore, it would make sense for the DAG to set the task start_date as the
later of the task's start date and its own start date; or the earlier for
end_date.
> 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)
> 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)