From aeb71ad50ace1566f8629f066dc25edadae6415d Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sun, 26 Mar 2023 08:30:34 -0500 Subject: [PATCH] lint lock name --- .vscode/launch.json | 3 --- api/onnx_web/worker/pool.py | 10 +++++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index e54cb280..5498f915 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -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": [ { diff --git a/api/onnx_web/worker/pool.py b/api/onnx_web/worker/pool.py index c465b1fd..97af0ae0 100644 --- a/api/onnx_web/worker/pool.py +++ b/api/onnx_web/worker/pool.py @@ -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 = []