diff --git a/.coveragerc b/.coveragerc index 12323f0b012..4d3146384b7 100644 --- a/.coveragerc +++ b/.coveragerc @@ -12,7 +12,6 @@ omit = */celery/bin/graph.py *celery/bin/logtool.py *celery/task/base.py - *celery/five.py *celery/contrib/sphinx.py *celery/concurrency/asynpool.py *celery/utils/debug.py diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index a941d2348a9..9814b9c7ee4 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -1067,7 +1067,6 @@ is following the conventions. from Queue import Queue, Empty from .platforms import Pidfile - from .five import zip_longest, items, range from .utils.time import maybe_timedelta * Wild-card imports must not be used (`from xxx import *`). diff --git a/celery/five.py b/celery/five.py deleted file mode 100644 index f89738aa14b..00000000000 --- a/celery/five.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Python 2/3 compatibility utilities.""" - -import sys - -import vine.five - -sys.modules[__name__] = vine.five diff --git a/celery/utils/log.py b/celery/utils/log.py index 95941284043..6acff167fcf 100644 --- a/celery/utils/log.py +++ b/celery/utils/log.py @@ -11,8 +11,6 @@ from kombu.log import get_logger as _get_logger from kombu.utils.encoding import safe_str -from celery.five import values - from .term import colored __all__ = ( @@ -45,7 +43,7 @@ def set_in_sighandler(value): def iter_open_logger_fds(): seen = set() - loggers = (list(values(logging.Logger.manager.loggerDict)) + + loggers = (list(logging.Logger.manager.loggerDict.values()) + [logging.getLogger(None)]) for l in loggers: try: diff --git a/docs/conf.py b/docs/conf.py index 4b6750ae83a..6c7dbc6aaad 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -25,7 +25,6 @@ 'cyanide': ('https://cyanide.readthedocs.io/en/latest', None), }, apicheck_ignore_modules=[ - 'celery.five', 'celery.__main__', 'celery.task', 'celery.contrib.testing', diff --git a/docs/tutorials/task-cookbook.rst b/docs/tutorials/task-cookbook.rst index 4ed3c267b36..41e2db734bb 100644 --- a/docs/tutorials/task-cookbook.rst +++ b/docs/tutorials/task-cookbook.rst @@ -37,8 +37,8 @@ For this reason your tasks run-time shouldn't exceed the timeout. .. code-block:: python + import time from celery import task - from celery.five import monotonic from celery.utils.log import get_task_logger from contextlib import contextmanager from django.core.cache import cache @@ -51,7 +51,7 @@ For this reason your tasks run-time shouldn't exceed the timeout. @contextmanager def memcache_lock(lock_id, oid): - timeout_at = monotonic() + LOCK_EXPIRE - 3 + timeout_at = time.monotonic() + LOCK_EXPIRE - 3 # cache.add fails if the key already exists status = cache.add(lock_id, oid, LOCK_EXPIRE) try: @@ -59,7 +59,7 @@ For this reason your tasks run-time shouldn't exceed the timeout. finally: # memcache delete is very slow, but we have to use it to take # advantage of using add() for atomic locking - if monotonic() < timeout_at and status: + if time.monotonic() < timeout_at and status: # don't release the lock if we exceeded the timeout # to lessen the chance of releasing an expired lock # owned by someone else diff --git a/requirements/default.txt b/requirements/default.txt index de7bc9c14b0..124c56679da 100644 --- a/requirements/default.txt +++ b/requirements/default.txt @@ -1,7 +1,7 @@ pytz>dev billiard>=3.6.3.0,<4.0 kombu>=5.0.0,<6.0 -vine==1.3.0 +vine>=5.0.0,<6.0 click>=7.0 click-didyoumean>=0.0.3 click-repl>=0.1.6 diff --git a/t/benchmarks/bench_worker.py b/t/benchmarks/bench_worker.py index c538e4e3286..716094a5ed8 100644 --- a/t/benchmarks/bench_worker.py +++ b/t/benchmarks/bench_worker.py @@ -1,8 +1,6 @@ import os import sys -from kombu.five import monotonic # noqa - from celery import Celery # noqa os.environ.update( @@ -41,7 +39,7 @@ def tdiff(then): - return monotonic() - then + return time.monotonic() - then @app.task(cur=0, time_start=None, queue='bench.worker', bare=True) @@ -51,9 +49,9 @@ def it(_, n): i = it.cur if i and not i % 5000: print('({} so far: {}s)'.format(i, tdiff(it.subt)), file=sys.stderr) - it.subt = monotonic() + it.subt = time.monotonic() if not i: - it.subt = it.time_start = monotonic() + it.subt = it.time_start = time.monotonic() elif i > n - 2: total = tdiff(it.time_start) print('({} so far: {}s)'.format(i, tdiff(it.subt)), file=sys.stderr) @@ -66,11 +64,11 @@ def it(_, n): def bench_apply(n=DEFAULT_ITS): - time_start = monotonic() + time_start = time.monotonic() task = it._get_current_object() with app.producer_or_acquire() as producer: [task.apply_async((i, n), producer=producer) for i in range(n)] - print('-- apply {} tasks: {}s'.format(n, monotonic() - time_start)) + print('-- apply {} tasks: {}s'.format(n, time.monotonic() - time_start)) def bench_work(n=DEFAULT_ITS, loglevel='CRITICAL'):