/packages/celery/celery/exceptions.py

https://github.com/mozilla/kuma-lib · Python · 100 lines · 29 code · 39 blank · 32 comment · 0 complexity · eccaf4ab51fc153bef0e59e030d4e0b9 MD5 · raw file

  1. # -*- coding: utf-8 -*-
  2. """
  3. celery.exceptions
  4. ~~~~~~~~~~~~~~~~~
  5. This module contains Celery-specific exceptions.
  6. :copyright: (c) 2009 - 2012 by Ask Solem.
  7. :license: BSD, see LICENSE for more details.
  8. """
  9. from __future__ import absolute_import
  10. UNREGISTERED_FMT = """\
  11. Task of kind %s is not registered, please make sure it's imported.\
  12. """
  13. class SecurityError(Exception):
  14. """Security related exceptions.
  15. Handle with care.
  16. """
  17. class SystemTerminate(SystemExit):
  18. """Signals that the worker should terminate."""
  19. class QueueNotFound(KeyError):
  20. """Task routed to a queue not in CELERY_QUEUES."""
  21. class TimeLimitExceeded(Exception):
  22. """The time limit has been exceeded and the job has been terminated."""
  23. class SoftTimeLimitExceeded(Exception):
  24. """The soft time limit has been exceeded. This exception is raised
  25. to give the task a chance to clean up."""
  26. class WorkerLostError(Exception):
  27. """The worker processing a job has exited prematurely."""
  28. class ImproperlyConfigured(Exception):
  29. """Celery is somehow improperly configured."""
  30. class NotRegistered(KeyError):
  31. """The task is not registered."""
  32. def __repr__(self):
  33. return UNREGISTERED_FMT % str(self)
  34. class AlreadyRegistered(Exception):
  35. """The task is already registered."""
  36. class TimeoutError(Exception):
  37. """The operation timed out."""
  38. class MaxRetriesExceededError(Exception):
  39. """The tasks max restart limit has been exceeded."""
  40. class RetryTaskError(Exception):
  41. """The task is to be retried later."""
  42. def __init__(self, message, exc, *args, **kwargs):
  43. self.exc = exc
  44. Exception.__init__(self, message, exc, *args, **kwargs)
  45. class TaskRevokedError(Exception):
  46. """The task has been revoked, so no result available."""
  47. class NotConfigured(UserWarning):
  48. """Celery has not been configured, as no config module has been found."""
  49. class AlwaysEagerIgnored(UserWarning):
  50. """send_task ignores CELERY_ALWAYS_EAGER option"""
  51. class InvalidTaskError(Exception):
  52. """The task has invalid data or is not properly constructed."""
  53. class CPendingDeprecationWarning(PendingDeprecationWarning):
  54. pass
  55. class CDeprecationWarning(DeprecationWarning):
  56. pass