forked from celery/celery
/
exceptions.py
76 lines (47 loc) · 1.66 KB
/
exceptions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
"""
Common Exceptions
"""
UNREGISTERED_FMT = """
Task of kind %s is not registered, please make sure it's imported.
""".strip()
class QueueNotFound(KeyError):
"""Task routed to a queue not in CELERY_QUEUES."""
pass
class TimeLimitExceeded(Exception):
"""The time limit has been exceeded and the job has been terminated."""
pass
class SoftTimeLimitExceeded(Exception):
"""The soft time limit has been exceeded. This exception is raised
to give the task a chance to clean up."""
pass
class WorkerLostError(Exception):
"""The worker processing a job has exited prematurely."""
pass
class ImproperlyConfigured(Exception):
"""Celery is somehow improperly configured."""
pass
class NotRegistered(KeyError):
"""The task is not registered."""
def __init__(self, message, *args, **kwargs):
message = UNREGISTERED_FMT % str(message)
KeyError.__init__(self, message, *args, **kwargs)
class AlreadyRegistered(Exception):
"""The task is already registered."""
pass
class TimeoutError(Exception):
"""The operation timed out."""
pass
class MaxRetriesExceededError(Exception):
"""The tasks max restart limit has been exceeded."""
pass
class RetryTaskError(Exception):
"""The task is to be retried later."""
def __init__(self, message, exc, *args, **kwargs):
self.exc = exc
Exception.__init__(self, message, exc, *args,
**kwargs)
class TaskRevokedError(Exception):
"""The task has been revoked, so no result available."""
pass
class NotConfigured(UserWarning):
"""Celery has not been configured, as no config module has been found."""