Revision 89e2b4d2 lib/workerpool.py
b/lib/workerpool.py | ||
---|---|---|
153 | 153 |
guaranteed to finish in the same order. |
154 | 154 |
|
155 | 155 |
""" |
156 |
def __init__(self, num_workers, worker_class): |
|
156 |
def __init__(self, name, num_workers, worker_class):
|
|
157 | 157 |
"""Constructor for worker pool. |
158 | 158 |
|
159 | 159 |
@param num_workers: number of workers to be started |
... | ... | |
168 | 168 |
self._pool_to_worker = threading.Condition(self._lock) |
169 | 169 |
self._worker_to_pool = threading.Condition(self._lock) |
170 | 170 |
self._worker_class = worker_class |
171 |
self._name = name |
|
171 | 172 |
self._last_worker_id = 0 |
172 | 173 |
self._workers = [] |
173 | 174 |
self._quiescing = False |
... | ... | |
253 | 254 |
|
254 | 255 |
""" |
255 | 256 |
self._last_worker_id += 1 |
256 |
return self._last_worker_id |
|
257 |
|
|
258 |
return "%s%d" % (self._name, self._last_worker_id) |
|
257 | 259 |
|
258 | 260 |
def _ResizeUnlocked(self, num_workers): |
259 | 261 |
"""Changes the number of workers. |
Also available in: Unified diff