Browse Source

[WIP] import from asynchronous instead of async and fix python 3.7 compat issues (#4679)

* imported from renamed asynchronous module of kombu

* imported from renamed asynchronous module of kombu

* imported from renamed asynchronous module of kombu in utils timer2

* update minimum kombu version
Asif Saifuddin Auvi 6 years ago
parent
commit
ed0130cad1

+ 4 - 0
celery/concurrency/asynpool.py

@@ -35,7 +35,11 @@ from billiard.pool import RUN, TERMINATE, ACK, NACK, WorkersJoined
 from billiard import pool as _pool
 from billiard.compat import buf_t, setblocking, isblocking
 from billiard.queues import _SimpleQueue
+<<<<<<< HEAD
 from kombu.async import WRITE, ERR
+=======
+from kombu.asynchronous import ERR, WRITE
+>>>>>>> 1a941f97a... [WIP] import from asynchronous instead of async and fix python 3.7 compat issues (#4679)
 from kombu.serialization import pickle as _pickle
 from kombu.utils.eventio import SELECT_BAD_FD
 from kombu.utils.functional import fxrange

+ 6 - 8
celery/concurrency/eventlet.py

@@ -2,8 +2,14 @@
 """Eventlet execution pool."""
 from __future__ import absolute_import, unicode_literals
 import sys
+
+from kombu.asynchronous import timer as _timer  # noqa
 from kombu.five import monotonic
 
+from celery import signals  # noqa
+
+from . import base  # noqa
+
 __all__ = ['TaskPool']
 
 W_RACE = """\
@@ -20,14 +26,6 @@ for mod in (mod for mod in sys.modules if mod.startswith(RACE_MODS)):
             import warnings
             warnings.warn(RuntimeWarning(W_RACE % side))
 
-# idiotic pep8.py does not allow expressions before imports
-# so have to silence errors here
-from kombu.async import timer as _timer  # noqa
-
-from celery import signals  # noqa
-
-from . import base  # noqa
-
 
 def apply_target(target, args=(), kwargs={}, callback=None,
                  accept_callback=None, getpid=None):

+ 2 - 1
celery/concurrency/gevent.py

@@ -1,7 +1,8 @@
 # -*- coding: utf-8 -*-
 """Gevent execution pool."""
 from __future__ import absolute_import, unicode_literals
-from kombu.async import timer as _timer
+
+from kombu.asynchronous import timer as _timer
 from kombu.five import monotonic
 from . import base
 try:

+ 2 - 4
celery/utils/timer2.py

@@ -3,7 +3,7 @@
 
 .. note::
     This is used for the thread-based worker only,
-    not for amqp/redis/sqs/qpid where :mod:`kombu.async.timer` is used.
+    not for amqp/redis/sqs/qpid where :mod:`kombu.asynchronous.timer` is used.
 """
 from __future__ import absolute_import, print_function, unicode_literals
 
@@ -14,9 +14,7 @@ import threading
 from itertools import count
 from time import sleep
 
-from celery.five import THREAD_TIMEOUT_MAX
-
-from kombu.async.timer import Entry, Timer as Schedule, to_timestamp, logger
+from kombu.asynchronous.timer import Entry, Timer as Schedule, logger, to_timestamp
 
 TIMER_DEBUG = os.environ.get('TIMER_DEBUG')
 

+ 1 - 1
celery/worker/autoscale.py

@@ -15,7 +15,7 @@ import threading
 
 from time import sleep
 
-from kombu.async.semaphore import DummyLock
+from kombu.asynchronous.semaphore import DummyLock
 
 from celery import bootsteps
 from celery.five import monotonic

+ 4 - 3
celery/worker/components.py

@@ -5,9 +5,10 @@ from __future__ import absolute_import, unicode_literals
 import atexit
 import warnings
 
-from kombu.async import Hub as _Hub, get_event_loop, set_event_loop
-from kombu.async.semaphore import DummyLock, LaxBoundedSemaphore
-from kombu.async.timer import Timer as _Timer
+from kombu.asynchronous import Hub as _Hub
+from kombu.asynchronous import get_event_loop, set_event_loop
+from kombu.asynchronous.semaphore import DummyLock, LaxBoundedSemaphore
+from kombu.asynchronous.timer import Timer as _Timer
 
 from celery import bootsteps
 from celery._state import _set_task_join_will_block

+ 1 - 1
celery/worker/consumer/consumer.py

@@ -16,7 +16,7 @@ from time import sleep
 
 from billiard.common import restart_state
 from billiard.exceptions import RestartFreqExceeded
-from kombu.async.semaphore import DummyLock
+from kombu.asynchronous.semaphore import DummyLock
 from kombu.utils.compat import _detect_environment
 from kombu.utils.encoding import safe_repr, bytes_t
 from kombu.utils.limits import TokenBucket

+ 1 - 1
celery/worker/consumer/gossip.py

@@ -7,7 +7,7 @@ from heapq import heappush
 from operator import itemgetter
 
 from kombu import Consumer
-from kombu.async.semaphore import DummyLock
+from kombu.asynchronous.semaphore import DummyLock
 
 from celery import bootsteps
 from celery.five import values

+ 1 - 1
celery/worker/heartbeat.py

@@ -16,7 +16,7 @@ class Heart(object):
     """Timer sending heartbeats at regular intervals.
 
     Arguments:
-        timer (kombu.async.timer.Timer): Timer to use.
+        timer (kombu.asynchronous.timer.Timer): Timer to use.
         eventer (celery.events.EventDispatcher): Event dispatcher
             to use.
         interval (float): Time in seconds between sending

+ 1 - 1
celery/worker/strategy.py

@@ -4,7 +4,7 @@ from __future__ import absolute_import, unicode_literals
 
 import logging
 
-from kombu.async.timer import to_timestamp
+from kombu.asynchronous.timer import to_timestamp
 from kombu.five import buffer_t
 
 from celery.exceptions import InvalidTaskError

+ 1 - 1
requirements/default.txt

@@ -1,3 +1,3 @@
 pytz>dev
 billiard>=3.5.0.2,<3.6.0
-kombu>=4.0.2,<5.0
+kombu>=4.2.0,<5.0