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.

solo.py 696B

123456789101112131415161718192021222324252627282930
  1. # -*- coding: utf-8 -*-
  2. """
  3. celery.concurrency.solo
  4. ~~~~~~~~~~~~~~~~~~~~~~~
  5. Single-threaded pool implementation.
  6. """
  7. from __future__ import absolute_import
  8. import os
  9. from .base import BasePool, apply_target
  10. __all__ = ['TaskPool']
  11. class TaskPool(BasePool):
  12. """Solo task pool (blocking, inline, fast)."""
  13. def __init__(self, *args, **kwargs):
  14. super(TaskPool, self).__init__(*args, **kwargs)
  15. self.on_apply = apply_target
  16. def _get_info(self):
  17. return {'max-concurrency': 1,
  18. 'processes': [os.getpid()],
  19. 'max-tasks-per-child': None,
  20. 'put-guarded-by-semaphore': True,
  21. 'timeouts': ()}