Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

__init__.py 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # -*- coding: utf-8 -*-
  2. """
  3. celery.task
  4. ~~~~~~~~~~~
  5. This is the old task module, it should not be used anymore,
  6. import from the main 'celery' module instead.
  7. If you're looking for the decorator implementation then that's in
  8. ``celery.app.base.Celery.task``.
  9. """
  10. from __future__ import absolute_import
  11. from celery._state import current_app, current_task as current
  12. from celery.five import LazyModule, recreate_module
  13. from celery.local import Proxy
  14. __all__ = [
  15. 'BaseTask', 'Task', 'PeriodicTask', 'task', 'periodic_task',
  16. 'group', 'chord', 'subtask', 'TaskSet',
  17. ]
  18. STATICA_HACK = True
  19. globals()['kcah_acitats'[::-1].upper()] = False
  20. if STATICA_HACK: # pragma: no cover
  21. # This is never executed, but tricks static analyzers (PyDev, PyCharm,
  22. # pylint, etc.) into knowing the types of these symbols, and what
  23. # they contain.
  24. from celery.canvas import group, chord, subtask
  25. from .base import BaseTask, Task, PeriodicTask, task, periodic_task
  26. from .sets import TaskSet
  27. class module(LazyModule):
  28. def __call__(self, *args, **kwargs):
  29. return self.task(*args, **kwargs)
  30. old_module, new_module = recreate_module( # pragma: no cover
  31. __name__,
  32. by_module={
  33. 'celery.task.base': ['BaseTask', 'Task', 'PeriodicTask',
  34. 'task', 'periodic_task'],
  35. 'celery.canvas': ['group', 'chord', 'subtask'],
  36. 'celery.task.sets': ['TaskSet'],
  37. },
  38. base=module,
  39. __package__='celery.task',
  40. __file__=__file__,
  41. __path__=__path__,
  42. __doc__=__doc__,
  43. current=current,
  44. discard_all=Proxy(lambda: current_app.control.purge),
  45. backend_cleanup=Proxy(
  46. lambda: current_app.tasks['celery.backend_cleanup']
  47. ),
  48. )