Skip to content

Commit

Permalink
Issue 2644: Tasks can be run several times
Browse files Browse the repository at this point in the history
- updated parameter name
- changed exit to the common approach of calling "return"
  • Loading branch information
Konstantin Gudkov committed Apr 16, 2019
1 parent 29c2dc1 commit 292bf9a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions luigi/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class scheduler(Config):

metrics_collector = parameter.EnumParameter(enum=MetricsCollectors, default=MetricsCollectors.default)

rerun_task_blocking_period = parameter.IntParameter(default=10)
stable_done_cooldown_secs = parameter.IntParameter(default=10)

def _get_retry_policy(self):
return RetryPolicy(self.retry_count, self.disable_hard_timeout, self.disable_window)
Expand Down Expand Up @@ -843,8 +843,8 @@ def add_task(self, task_id=None, status=PENDING, runnable=True,
return

# if the task was completed only recently, do not run the same task again
if status == PENDING and task.status == DONE and (time.time() - task.updated) < self._config.rerun_task_blocking_period:
status = DONE
if status == PENDING and task.status == DONE and (time.time() - task.updated) < self._config.stable_done_cooldown_secs:
return

# for setting priority, we'll sometimes create tasks with unset family and params
if not task.family:
Expand Down
2 changes: 1 addition & 1 deletion test/scheduler_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def get_scheduler_config(self):
'disable_window': 10,
'retry_count': 3,
'disable_hard_timeout': 60 * 60,
'rerun_task_blocking_period': 0
'stable_done_cooldown_secs': 0
}

def tearDown(self):
Expand Down

0 comments on commit 292bf9a

Please sign in to comment.