[Python-modules-commits] [celery] 02/05: Pick upstream patch to fix solar based scheduler.

Michael Fladischer fladi at moszumanska.debian.org
Thu Nov 16 10:35:42 UTC 2017


This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to branch debian/master
in repository celery.

commit 772f2841e27568db2a073924f3538ce733199387
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Mon Nov 13 22:21:18 2017 +0100

    Pick upstream patch to fix solar based scheduler.
---
 debian/changelog                                   |  1 +
 ...tion-caused-by-next_transit-receiving-an-.patch | 73 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 75 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 445f1c3..dca9903 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 celery (4.1.0-2) UNRELEASED; urgency=medium
 
   * Add python(3)-ephem to Depends to allow for solar based schedules.
+  * Pick upstream patch to fix solar based scheduler.
 
  -- Michael Fladischer <fladi at debian.org>  Mon, 13 Nov 2017 22:18:00 +0100
 
diff --git a/debian/patches/0005-Fixed-exception-caused-by-next_transit-receiving-an-.patch b/debian/patches/0005-Fixed-exception-caused-by-next_transit-receiving-an-.patch
new file mode 100644
index 0000000..b841259
--- /dev/null
+++ b/debian/patches/0005-Fixed-exception-caused-by-next_transit-receiving-an-.patch
@@ -0,0 +1,73 @@
+From: DDevine <devine at ddevnet.net>
+Date: Wed, 26 Jul 2017 18:19:03 +1000
+Subject: Fixed exception caused by next_transit receiving an unexpected
+ argument. (#4103)
+
+* Fixed exception caused by next_transit receiving an unexpected argument.
+
+* Fixing inconsistent style.
+
+* Adding tests for solar methods to determine if they accept the use_center argument or not.
+
+* Fixing flake8 errors.
+---
+ celery/schedules.py          | 16 +++++++++++-----
+ t/unit/app/test_schedules.py | 11 +++++++++++
+ 2 files changed, 22 insertions(+), 5 deletions(-)
+
+diff --git a/celery/schedules.py b/celery/schedules.py
+index eefe111..8624d39 100644
+--- a/celery/schedules.py
++++ b/celery/schedules.py
+@@ -728,7 +728,7 @@ class solar(BaseSchedule):
+         'dawn_nautical': True,
+         'dawn_civil': True,
+         'sunrise': False,
+-        'solar_noon': True,
++        'solar_noon': False,
+         'sunset': False,
+         'dusk_civil': True,
+         'dusk_nautical': True,
+@@ -783,10 +783,16 @@ class solar(BaseSchedule):
+         last_run_at_utc = localize(last_run_at, timezone.utc)
+         self.cal.date = last_run_at_utc
+         try:
+-            next_utc = getattr(self.cal, self.method)(
+-                self.ephem.Sun(),
+-                start=last_run_at_utc, use_center=self.use_center,
+-            )
++            if self.use_center:
++                next_utc = getattr(self.cal, self.method)(
++                    self.ephem.Sun(),
++                    start=last_run_at_utc, use_center=self.use_center
++                )
++            else:
++                next_utc = getattr(self.cal, self.method)(
++                    self.ephem.Sun(), start=last_run_at_utc
++                )
++
+         except self.ephem.CircumpolarError:  # pragma: no cover
+             # Sun won't rise/set today.  Check again tomorrow
+             # (specifically, after the next anti-transit).
+diff --git a/t/unit/app/test_schedules.py b/t/unit/app/test_schedules.py
+index 6732047..f3a55fe 100644
+--- a/t/unit/app/test_schedules.py
++++ b/t/unit/app/test_schedules.py
+@@ -74,6 +74,17 @@ class test_solar:
+         with pytest.raises(ValueError):
+             solar('asdqwewqew', 60, 60, app=self.app)
+ 
++    def test_event_uses_center(self):
++        s = solar('solar_noon', 60, 60, app=self.app)
++        for ev, is_center in s._use_center_l.items():
++            s.method = s._methods[ev]
++            s.is_center = s._use_center_l[ev]
++            try:
++                s.remaining_estimate(datetime.utcnow())
++            except TypeError:
++                pytest.fail("{0} was called with 'use_center' which is not a \
++                    valid keyword for the function.".format(s.method))
++
+ 
+ class test_schedule:
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 648792c..baf9c4d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ lsb-init.patch
 privacy.patch
 0007-Set-shell-in-su-invocation.patch
 0004-Disable-intershpinx-mapping-for-now.patch
+0005-Fixed-exception-caused-by-next_transit-receiving-an-.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/celery.git



More information about the Python-modules-commits mailing list