Skip to content

Commit

Permalink
Make task.disable_window be default source of window int (#3081)
Browse files Browse the repository at this point in the history
* Make task.disable_window be default source of window int

* Add test on disable_window_seconds
  • Loading branch information
jamescooke committed Aug 22, 2021
1 parent cf4b6fb commit 62c12d1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions luigi/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@ def disable_window(self):
Override this positive integer to have different ``disable_window`` at task level.
Check :ref:`scheduler-config`
"""
return self.disable_window_seconds
return None

@property
def disable_window_seconds(self):
warnings.warn("Use of `disable_window_seconds` has been deprecated, use `disable_window` instead", DeprecationWarning)
return None
return self.disable_window

@property
def owner_email(self):
Expand Down
9 changes: 9 additions & 0 deletions test/task_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ class MockTimedelta:
with self.assertWarnsRegex(UserWarning, 'Parameter "timedelta_param" with value ".*" is not of type timedelta.'):
DummyTask(**params)

def test_disable_window_seconds(self):
"""
Deprecated disable_window_seconds param uses disable_window value
"""
class ATask(luigi.Task):
disable_window = 17
task = ATask()
self.assertEqual(task.disable_window_seconds, 17)


class ExternalizeTaskTest(LuigiTestCase):

Expand Down

0 comments on commit 62c12d1

Please sign in to comment.