1
0
Fork 0

lint lock name

This commit is contained in:
Sean Sube 2023-03-26 08:30:34 -05:00
parent a1c3b28bee
commit aeb71ad50a
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
2 changed files with 5 additions and 8 deletions

3
.vscode/launch.json vendored
View File

@ -1,7 +1,4 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{

View File

@ -1,7 +1,7 @@
from collections import Counter
from logging import getLogger
from queue import Empty
from threading import Thread, Lock
from threading import Lock, Thread
from typing import Callable, Dict, List, Optional, Tuple
from torch.multiprocessing import Process, Queue, Value
@ -37,7 +37,7 @@ class DevicePoolExecutor:
logs: "Queue[str]"
progress: "Queue[ProgressCommand]"
rlock: Lock
recycle: Lock
def __init__(
self,
@ -67,7 +67,7 @@ class DevicePoolExecutor:
self.logs = Queue(self.max_pending_per_worker)
self.progress = Queue(self.max_pending_per_worker)
self.rlock = Lock()
self.recycle = Lock()
# TODO: these should be part of a start method
self.create_logger_worker()
@ -225,7 +225,7 @@ class DevicePoolExecutor:
def join(self):
logger.info("stopping worker pool")
with self.rlock:
with self.recycle:
logger.debug("closing queues")
self.logs.close()
self.progress.close()
@ -276,7 +276,7 @@ class DevicePoolExecutor:
def recycle(self):
logger.debug("recycling worker pool")
with self.rlock:
with self.recycle:
self.join_leaking()
needs_restart = []