Skip to content

Commit

Permalink
Merge pull request apache#1261 from ty707/fix_once_scheduling
Browse files Browse the repository at this point in the history
Fixed scheduling for @once interval
  • Loading branch information
bolkedebruin committed Mar 30, 2016
2 parents 79c0e06 + c7d924d commit ec2e02a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions airflow/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,9 @@ def schedule_dag(self, dag):
DagRun.run_id.like(DagRun.ID_PREFIX+'%')))
last_scheduled_run = qry.scalar()
next_run_date = None
if not last_scheduled_run:
if dag.schedule_interval == '@once' and not last_scheduled_run:
next_run_date = datetime.now()
elif not last_scheduled_run:
# First run
TI = models.TaskInstance
latest_run = (
Expand All @@ -417,8 +419,6 @@ def schedule_dag(self, dag):
next_run_date = min([t.start_date for t in dag.tasks])
elif dag.schedule_interval != '@once':
next_run_date = dag.following_schedule(last_scheduled_run)
elif dag.schedule_interval == '@once' and not last_scheduled_run:
next_run_date = datetime.now()

# this structure is necessary to avoid a TypeError from concatenating
# NoneType
Expand Down

0 comments on commit ec2e02a

Please sign in to comment.