Skip to content

Commit

Permalink
[AIRFLOW-586] test_dag_v1 fails from 0 to 3 a.m.
Browse files Browse the repository at this point in the history
dags/test_dag.py tries to set START_DATE to 3
hours before using
datetime.replace, but it doesn't support minus
value as argument.
So we have to use timedelta instead of simple
numeric subtraction.

Closes #1852 from sekikn/AIRFLOW-586
  • Loading branch information
sekikn authored and r39132 committed Oct 27, 2016
1 parent 2bbcdc3 commit 46236fa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dags/test_dag.py
Expand Up @@ -14,10 +14,10 @@

from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from datetime import datetime
from datetime import datetime, timedelta

now = datetime.now()
now_to_the_hour = now.replace(hour=now.time().hour-3 , minute=0, second=0, microsecond=0)
now_to_the_hour = (now - timedelta(0, 0, 0, 0, 0, 3)).replace(minute=0, second=0, microsecond=0)
START_DATE = now_to_the_hour
DAG_NAME = 'test_dag_v1'

Expand Down

0 comments on commit 46236fa

Please sign in to comment.