# Constants representing the state of a pool
#
-RUN = 0
-CLOSE = 1
-TERMINATE = 2
+RUN = "RUN"
+CLOSE = "CLOSE"
+TERMINATE = "TERMINATE"
#
# Miscellaneous
exitpriority=15
)
+ def __repr__(self):
+ cls = self.__class__
+ return (f'<{cls.__module__}.{cls.__qualname__} '
+ f'state={self._state} '
+ f'pool_size={len(self._pool)}>')
+
def _join_exited_workers(self):
"""Cleanup after any worker processes which have exited due to reaching
their specified lifetime. Returns True if any workers were cleaned up.
try:
# iterating taskseq cannot fail
for task in taskseq:
- if thread._state:
+ if thread._state != RUN:
util.debug('task handler found thread._state != RUN')
break
try:
util.debug('result handler got EOFError/OSError -- exiting')
return
- if thread._state:
+ if thread._state != "RUN":
assert thread._state == TERMINATE, "Thread not in TERMINATE"
util.debug('result handler found thread._state=TERMINATE')
break