solo.py 559 B

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