Skip to content

Commit

Permalink
style: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tazlin committed Feb 4, 2024
1 parent 369dee9 commit 148d98b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Helper class to access dictionaries
class DotDict(dict):
def __getattr__(self, attr):
return self[attr] if attr in self else None
return self.get(attr, None)

def __setattr__(self, attr, value):
self[attr] = value
Expand Down Expand Up @@ -367,7 +367,7 @@ def load_models(self):
model_config_dict: dict = model_info.get("config", None)
if not model_config_dict:
continue
model_file_config_list: list = model_config_dict.get("files", None)
model_file_config_list: list = model_config_dict.get("files")
if not model_file_config_list:
continue
if len(model_file_config_list) == 0:
Expand Down
2 changes: 1 addition & 1 deletion worker/jobs/poppers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def horde_pop(self):
timeout=40,
)
# logger.debug(self.pop_payload)
node = pop_req.headers["horde-node"] if "horde-node" in pop_req.headers else "unknown"
node = pop_req.headers.get("horde-node", "unknown")
logger.debug(f"Job pop took {pop_req.elapsed.total_seconds()} (node: {node})")
bridge_stats.update_pop_stats(node, pop_req.elapsed.total_seconds())
except requests.exceptions.ConnectionError:
Expand Down
4 changes: 2 additions & 2 deletions worker/utils/gpuinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get(self, data, key, default=""):

if len(path) == 1:
# Simple case
return data[key] if key in data else default
return data.get(key, default)
# Nested case
walkdata = data
for element in path:
Expand All @@ -38,7 +38,7 @@ def get_num_gpus(self):
"""How many GPUs in this system?"""
if self.forced_gpu or self.ui_show_one_gpu:
return 1

with contextlib.suppress(Exception):
nvsmi = nvidia_smi.getInstance()
data = nvsmi.DeviceQuery()
Expand Down

0 comments on commit 148d98b

Please sign in to comment.