This commit is contained in:
Ask Solem 2016-06-28 19:25:23 -07:00
Родитель 0858ff7d16
Коммит 4b7af113fa
20 изменённых файлов: 40 добавлений и 49 удалений

Просмотреть файл

@ -11,6 +11,7 @@ from __future__ import absolute_import, unicode_literals
import sys
from billiard.einfo import ExceptionInfo
from kombu.utils import uuid
from celery import current_app, group
from celery import states
@ -20,9 +21,9 @@ from celery.exceptions import Ignore, MaxRetriesExceededError, Reject, Retry
from celery.five import class_property, items, python_2_unicode_compatible
from celery.result import EagerResult
from celery.utils import abstract
from celery.utils import uuid, maybe_reraise
from celery.utils.functional import mattrgetter, maybe_list
from celery.utils.imports import instantiate
from celery.utils.serialization import maybe_reraise
from .annotations import resolve_all as resolve_all_annotations
from .registry import _unpickle_task_v2

Просмотреть файл

@ -10,9 +10,9 @@ from __future__ import absolute_import, unicode_literals
from kombu.utils.encoding import ensure_bytes
from celery import uuid
from celery.exceptions import ImproperlyConfigured
from celery.backends.base import KeyValueStoreBackend
from celery.utils import uuid
import os
import locale

Просмотреть файл

@ -6,9 +6,9 @@ from datetime import datetime, timedelta
from pickle import dumps, loads
from celery import beat
from celery import uuid
from celery.five import keys, string_t
from celery.schedules import schedule
from celery.utils import uuid
from celery.utils.objects import Bunch
from celery.tests.case import AppCase, Mock, call, patch, skip

Просмотреть файл

@ -3,9 +3,9 @@ from __future__ import absolute_import, unicode_literals
from kombu.pidbox import Mailbox
from vine.utils import wraps
from celery import uuid
from celery.app import control
from celery.exceptions import DuplicateNodenameWarning
from celery.utils import uuid
from celery.tests.case import AppCase

Просмотреть файл

@ -8,10 +8,10 @@ from io import StringIO
from tempfile import mktemp
from celery import signals
from celery import uuid
from celery.app.log import TaskFormatter
from celery.five import python_2_unicode_compatible
from celery.utils.log import LoggingProxy
from celery.utils import uuid
from celery.utils.log import (
get_logger,
ColorFormatter,

Просмотреть файл

@ -9,10 +9,10 @@ from pickle import dumps, loads
from billiard.einfo import ExceptionInfo
from celery import states
from celery import uuid
from celery.backends.amqp import AMQPBackend
from celery.five import Empty, Queue, range
from celery.result import AsyncResult
from celery.utils import uuid
from celery.tests.case import AppCase, Mock, depends_on_current_app, mock

Просмотреть файл

@ -14,7 +14,7 @@ from celery.utils.serialization import UnpickleableExceptionWrapper
from celery.utils.serialization import get_pickleable_exception as gpe
from celery import states
from celery import group
from celery import group, uuid
from celery.backends.base import (
BaseBackend,
KeyValueStoreBackend,
@ -22,7 +22,6 @@ from celery.backends.base import (
_nulldict,
)
from celery.result import result_from_tuple
from celery.utils import uuid
from celery.utils.functional import pass1
from celery.tests.case import ANY, AppCase, Case, Mock, call, patch, skip

Просмотреть файл

@ -7,13 +7,11 @@ from contextlib import contextmanager
from kombu.utils.encoding import str_to_bytes, ensure_bytes
from celery import signature
from celery import states
from celery import group
from celery import group, signature, uuid
from celery.backends.cache import CacheBackend, DummyClient, backends
from celery.exceptions import ImproperlyConfigured
from celery.five import items, bytes_if_py2, string, text_t
from celery.utils import uuid
from celery.tests.case import AppCase, Mock, mock, patch, skip

Просмотреть файл

@ -5,8 +5,8 @@ from datetime import datetime
from pickle import loads, dumps
from celery import states
from celery import uuid
from celery.exceptions import ImproperlyConfigured
from celery.utils import uuid
from celery.tests.case import (
AppCase, Mock, depends_on_current_app, patch, skip,

Просмотреть файл

@ -5,10 +5,10 @@ import os
import shutil
import tempfile
from celery import uuid
from celery import states
from celery.backends.filesystem import FilesystemBackend
from celery.exceptions import ImproperlyConfigured
from celery.utils import uuid
from celery.tests.case import AppCase, skip

Просмотреть файл

@ -8,6 +8,7 @@ from time import time
from itertools import count
from celery import states
from celery import uuid
from celery.events import Event
from celery.events.state import (
HEARTBEAT_EXPIRE_WINDOW,
@ -18,7 +19,6 @@ from celery.events.state import (
heartbeat_expires,
)
from celery.five import range
from celery.utils import uuid
from celery.tests.case import AppCase, Mock, patch, skip
try:

Просмотреть файл

@ -3,6 +3,7 @@ from __future__ import absolute_import, unicode_literals
import traceback
from contextlib import contextmanager
from celery import uuid
from celery import states
from celery.backends.base import SyncBackendMixin
from celery.exceptions import (
@ -16,7 +17,6 @@ from celery.result import (
result_from_tuple,
assert_will_not_block,
)
from celery.utils import uuid
from celery.utils.serialization import pickle
from celery.tests.case import (

Просмотреть файл

@ -6,12 +6,11 @@ from kombu import Queue
from celery import Task
from celery import group
from celery import group, uuid
from celery.app.task import _reprtask
from celery.exceptions import Ignore, Retry
from celery.five import items, range, string_t
from celery.result import EagerResult
from celery.utils import uuid
from celery.utils.timeutils import parse_iso8601
from celery.tests.case import (

Просмотреть файл

@ -2,9 +2,7 @@ from __future__ import absolute_import, unicode_literals
from kombu import Queue
from celery.utils import (
worker_direct,
)
from celery.utils.nodenames import worker_direct
from celery.tests.case import Case

Просмотреть файл

@ -1,9 +1,7 @@
from __future__ import absolute_import, unicode_literals
from celery.utils import (
chunks,
cached_property,
)
from celery.utils import chunks, cached_property
from celery.tests.case import Case

Просмотреть файл

@ -7,9 +7,9 @@ from collections import defaultdict
from datetime import datetime, timedelta
from kombu import pidbox
from kombu.utils import uuid
from celery.five import Queue as FastQueue
from celery.utils import uuid
from celery.utils.timer2 import Timer
from celery.worker import WorkController as _WC
from celery.worker import consumer

Просмотреть файл

@ -10,9 +10,8 @@ import sys
from datetime import datetime, timedelta
from billiard.einfo import ExceptionInfo
from kombu.utils.encoding import (
default_encode, from_utf8, safe_str, safe_repr,
)
from kombu.utils import uuid
from kombu.utils.encoding import default_encode, from_utf8, safe_str, safe_repr
from celery import states
from celery.app.trace import (
@ -36,7 +35,6 @@ from celery.exceptions import (
)
from celery.five import monotonic
from celery.signals import task_revoked
from celery.utils import uuid
from celery.worker import request as module
from celery.worker.request import (
Request, create_request_cls, logger as req_logger,

Просмотреть файл

@ -14,6 +14,7 @@ from kombu import Connection
from kombu.common import QoS, ignore_errors
from kombu.transport.base import Message
from kombu.transport.memory import Transport
from kombu.utils import uuid
from celery.bootsteps import RUN, CLOSE, TERMINATE, StartStopStep
from celery.concurrency.base import BasePool
@ -23,7 +24,6 @@ from celery.exceptions import (
)
from celery.five import Empty, range, Queue as FastQueue
from celery.platforms import EX_FAILURE
from celery.utils import uuid
from celery import worker as worker_module
from celery.worker import components
from celery.worker import consumer

Просмотреть файл

@ -5,37 +5,24 @@
Utility functions.
Do not import from here directly anymore, these are only
here for backwards compatibility.
"""
from __future__ import absolute_import, print_function, unicode_literals
import sys
from celery.five import reraise
from .functional import memoize # noqa
from .nodenames import worker_direct, nodename, nodesplit
__all__ = ['worker_direct',
'maybe_reraise',
'gen_task_name', 'nodename', 'nodesplit',
'cached_property']
__all__ = ['worker_direct', 'gen_task_name', 'nodename', 'nodesplit',
'cached_property', 'uuid']
PY3 = sys.version_info[0] == 3
def maybe_reraise():
"""Re-raise if an exception is currently being handled, or return
otherwise."""
exc_info = sys.exc_info()
try:
if exc_info[2]:
reraise(exc_info[0], exc_info[1], exc_info[2])
finally:
# see http://docs.python.org/library/sys.html#sys.exc_info
del(exc_info)
# ------------------------------------------------------------------------ #
# > XXX Compat
from .log import LOG_LEVELS # noqa

Просмотреть файл

@ -10,6 +10,7 @@ from __future__ import absolute_import, unicode_literals
import datetime
import numbers
import sys
from base64 import b64encode as base64encode, b64decode as base64decode
from functools import partial
@ -19,7 +20,7 @@ from itertools import takewhile
from kombu.utils.encoding import bytes_to_str, str_to_bytes
from celery.five import (
bytes_if_py2, python_2_unicode_compatible, items, string_t,
bytes_if_py2, python_2_unicode_compatible, items, reraise, string_t,
)
from .encoding import safe_repr
@ -244,3 +245,15 @@ def jsonify(obj,
'Unsupported type: {0!r} {1!r} (parent: {2})'.format(
type(obj), obj, key))
return unknown_type_filter(obj)
def maybe_reraise():
"""Re-raise if an exception is currently being handled, or return
otherwise."""
exc_info = sys.exc_info()
try:
if exc_info[2]:
reraise(exc_info[0], exc_info[1], exc_info[2])
finally:
# see http://docs.python.org/library/sys.html#sys.exc_info
del(exc_info)