mirror of
https://github.com/blw1138/Zordon.git
synced 2026-06-09 13:39:24 -05:00
refactor: log silent AttributeError catches, add _sync_class to remaining services, drop dead ctx slot
This commit is contained in:
@@ -60,11 +60,13 @@ class ZordonServer:
|
||||
self.ctx.render_queue = RenderQueue()
|
||||
self.ctx.render_queue.load_state(database_directory=Path(Config.upload_folder).expanduser())
|
||||
RenderQueue._default_instance = self.ctx.render_queue
|
||||
RenderQueue._sync_class()
|
||||
|
||||
# ---- Distributed Job Manager ----
|
||||
self.ctx.distributed_job_manager = DistributedJobManager()
|
||||
self.ctx.distributed_job_manager.subscribe_to_listener()
|
||||
DistributedJobManager._default_instance = self.ctx.distributed_job_manager
|
||||
DistributedJobManager._sync_class()
|
||||
|
||||
self.api_server = None
|
||||
self.server_hostname = None
|
||||
|
||||
@@ -4,7 +4,6 @@ from typing import TYPE_CHECKING, Optional
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from src.api.preview_manager import PreviewManager
|
||||
from src.api.serverproxy_manager import ServerProxyManager
|
||||
from src.distributed_job_manager import DistributedJobManager
|
||||
from src.engines.engine_manager import EngineManager
|
||||
from src.render_queue import RenderQueue
|
||||
@@ -22,4 +21,3 @@ class ApplicationContext:
|
||||
self.zeroconf_server: Optional[ZeroconfServer] = None
|
||||
self.render_queue: Optional[RenderQueue] = None
|
||||
self.distributed_job_manager: Optional[DistributedJobManager] = None
|
||||
self.server_proxy_manager: Optional[ServerProxyManager] = None
|
||||
|
||||
@@ -24,6 +24,11 @@ logger = logging.getLogger()
|
||||
class DistributedJobManager:
|
||||
_default_instance: Optional['DistributedJobManager'] = None
|
||||
|
||||
@classmethod
|
||||
def _sync_class(cls) -> None:
|
||||
if cls._default_instance is not None:
|
||||
pass # no class-level attributes to sync
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.background_worker: Optional[threading.Thread] = None
|
||||
|
||||
|
||||
@@ -28,6 +28,11 @@ class JobNotFoundError(Exception):
|
||||
class RenderQueue:
|
||||
_default_instance: Optional['RenderQueue'] = None
|
||||
|
||||
@classmethod
|
||||
def _sync_class(cls) -> None:
|
||||
if cls._default_instance is not None:
|
||||
pass # no class-level attributes to sync
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.engine: Optional[create_engine] = None
|
||||
self.session: Optional[Session] = None
|
||||
|
||||
@@ -247,9 +247,8 @@ class MainWindow(QMainWindow):
|
||||
# Update server information display
|
||||
self.update_server_info_display(new_hostname)
|
||||
|
||||
except AttributeError:
|
||||
# Handle cases where the server list view might not be properly initialized
|
||||
pass
|
||||
except AttributeError as e:
|
||||
logger.error(f"AttributeError in server_picked: {e}")
|
||||
|
||||
def update_server_info_display(self, hostname):
|
||||
"""Updates the server information section of the UI."""
|
||||
@@ -405,7 +404,8 @@ class MainWindow(QMainWindow):
|
||||
id_item = self.job_list_view.item(selected_row.row(), 0)
|
||||
job_ids.append(id_item.text())
|
||||
return job_ids
|
||||
except AttributeError:
|
||||
except AttributeError as e:
|
||||
logger.error(f"AttributeError in selected_job_ids: {e}")
|
||||
return []
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user