mirror of
https://github.com/blw1138/Zordon.git
synced 2026-02-05 05:36:09 +00:00
Windows path fixes (#129)
* Change uses of os.path to use Pathlib * Add return types and type hints * Add more docstrings * Add missing import to api_server
This commit is contained in:
17
server.py
17
server.py
@@ -3,6 +3,7 @@ import multiprocessing
|
||||
import os
|
||||
import socket
|
||||
import threading
|
||||
from pathlib import Path
|
||||
|
||||
import psutil
|
||||
|
||||
@@ -14,7 +15,7 @@ from src.distributed_job_manager import DistributedJobManager
|
||||
from src.engines.engine_manager import EngineManager
|
||||
from src.render_queue import RenderQueue
|
||||
from src.utilities.config import Config
|
||||
from src.utilities.misc_helper import (get_gpu_info, system_safe_path, current_system_cpu, current_system_os,
|
||||
from src.utilities.misc_helper import (get_gpu_info, current_system_cpu, current_system_os,
|
||||
current_system_os_version, current_system_cpu_brand, check_for_updates)
|
||||
from src.utilities.zeroconf_server import ZeroconfServer
|
||||
from src.version import APP_NAME, APP_VERSION
|
||||
@@ -33,15 +34,13 @@ class ZordonServer:
|
||||
|
||||
# Load Config YAML
|
||||
Config.setup_config_dir()
|
||||
Config.load_config(system_safe_path(os.path.join(Config.config_dir(), 'config.yaml')))
|
||||
config_path = Path(Config.config_dir()) / "config.yaml"
|
||||
Config.load_config(config_path)
|
||||
|
||||
# configure default paths
|
||||
EngineManager.engines_path = system_safe_path(
|
||||
os.path.join(os.path.join(os.path.expanduser(Config.upload_folder),
|
||||
'engines')))
|
||||
EngineManager.engines_path = Path(Config.upload_folder).expanduser()/ "engines"
|
||||
os.makedirs(EngineManager.engines_path, exist_ok=True)
|
||||
PreviewManager.storage_path = system_safe_path(
|
||||
os.path.join(os.path.expanduser(Config.upload_folder), 'previews'))
|
||||
PreviewManager.storage_path = Path(Config.upload_folder).expanduser() / "previews"
|
||||
|
||||
self.api_server = None
|
||||
self.server_hostname = None
|
||||
@@ -72,11 +71,11 @@ class ZordonServer:
|
||||
|
||||
# main start
|
||||
logger.info(f"Starting {APP_NAME} Render Server ({APP_VERSION})")
|
||||
logger.debug(f"Upload directory: {os.path.expanduser(Config.upload_folder)}")
|
||||
logger.debug(f"Upload directory: {Path(Config.upload_folder).expanduser()}")
|
||||
logger.debug(f"Thumbs directory: {PreviewManager.storage_path}")
|
||||
logger.debug(f"Engines directory: {EngineManager.engines_path}")
|
||||
# Set up the RenderQueue object
|
||||
RenderQueue.load_state(database_directory=system_safe_path(os.path.expanduser(Config.upload_folder)))
|
||||
RenderQueue.load_state(database_directory=Path(Config.upload_folder).expanduser())
|
||||
ServerProxyManager.subscribe_to_listener()
|
||||
DistributedJobManager.subscribe_to_listener()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user