Misc logging cleanup

This commit is contained in:
Brett Williams
2024-08-05 10:57:56 -05:00
parent 4df41a2079
commit 90d5e9b7af
4 changed files with 31 additions and 18 deletions

View File

@@ -498,6 +498,13 @@ def start_server():
time.sleep(delay_sec) time.sleep(delay_sec)
try: try:
Config.setup_config_dir()
Config.load_config(system_safe_path(os.path.join(Config.config_dir(), 'config.yaml')))
# suppress requests logging
logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)
# get hostname # get hostname
local_hostname = socket.gethostname() local_hostname = socket.gethostname()
local_hostname = local_hostname + (".local" if not local_hostname.endswith(".local") else "") local_hostname = local_hostname + (".local" if not local_hostname.endswith(".local") else "")

View File

@@ -222,14 +222,14 @@ class DistributedJobManager:
for subjob_filename in subjob_files: for subjob_filename in subjob_files:
if subjob_filename not in local_files: if subjob_filename not in local_files:
logger.info(f"Missing file '{subjob_filename}' from {subjob_hostname}")
try: try:
logger.debug(f"Downloading new file '{subjob_filename}' from {subjob_hostname}")
local_save_path = os.path.join(os.path.dirname(local_job.output_path), subjob_filename) local_save_path = os.path.join(os.path.dirname(local_job.output_path), subjob_filename)
subjob_proxy.download_job_file(job_id=subjob_id, job_filename=subjob_filename, subjob_proxy.download_job_file(job_id=subjob_id, job_filename=subjob_filename,
save_path=local_save_path) save_path=local_save_path)
logger.debug(f'Downloaded successfully - {local_save_path}') logger.debug(f'Downloaded successfully - {local_save_path}')
except Exception as e: except Exception as e:
logger.error(f"Error downloading file '{subjob_filename}': {e}") logger.error(f"Error downloading file '{subjob_filename}' from {subjob_hostname}: {e}")
except Exception as e: except Exception as e:
logger.exception(f'Uncaught exception while trying to download from subjob: {e}') logger.exception(f'Uncaught exception while trying to download from subjob: {e}')

View File

@@ -110,7 +110,7 @@ class EngineManager:
return filtered[0] return filtered[0]
except IndexError: except IndexError:
logger.error(f"Cannot find newest engine version for {engine}-{system_os}-{cpu}") logger.error(f"Cannot find newest engine version for {engine}-{system_os}-{cpu}")
return None return None
@classmethod @classmethod
def is_version_downloaded(cls, engine, version, system_os=None, cpu=None): def is_version_downloaded(cls, engine, version, system_os=None, cpu=None):
@@ -172,12 +172,12 @@ class EngineManager:
if background: if background:
return thread return thread
else:
thread.join() thread.join()
found_engine = cls.is_version_downloaded(engine, version, system_os, cpu) # Check that engine downloaded found_engine = cls.is_version_downloaded(engine, version, system_os, cpu) # Check that engine downloaded
if not found_engine: if not found_engine:
logger.error(f"Error downloading {engine}") logger.error(f"Error downloading {engine}")
return found_engine return found_engine
@classmethod @classmethod
def delete_engine_download(cls, engine, version, system_os=None, cpu=None): def delete_engine_download(cls, engine, version, system_os=None, cpu=None):
@@ -204,13 +204,19 @@ class EngineManager:
def engine_update_task(engine_class): def engine_update_task(engine_class):
logger.debug(f"Checking for updates to {engine_class.name()}") logger.debug(f"Checking for updates to {engine_class.name()}")
latest_version = engine_class.downloader().find_most_recent_version() latest_version = engine_class.downloader().find_most_recent_version()
if latest_version:
logger.debug(f"Latest version of {engine_class.name()} available: {latest_version.get('version')}") if not latest_version:
if not cls.is_version_downloaded(engine_class.name(), latest_version.get('version')): logger.warning(f"Could not find most recent version of {engine.name()} to download")
logger.info(f"Downloading latest version of {engine_class.name()}...") return
cls.download_engine(engine=engine_class.name(), version=latest_version['version'], background=True)
else: version_num = latest_version.get('version')
logger.warning(f"Unable to get check for updates for {engine.name()}") if cls.is_version_downloaded(engine_class.name(), version_num):
logger.debug(f"Latest version of {engine_class.name()} ({version_num}) already downloaded")
return
# download the engine
logger.info(f"Downloading latest version of {engine_class.name()} ({version_num})...")
cls.download_engine(engine=engine_class.name(), version=version_num, background=True)
logger.info(f"Checking for updates for render engines...") logger.info(f"Checking for updates for render engines...")
threads = [] threads = []

View File

@@ -132,8 +132,8 @@ class FFMPEGDownloader(EngineDownloader):
system_os = system_os or current_system_os() system_os = system_os or current_system_os()
cpu = cpu or current_system_cpu() cpu = cpu or current_system_cpu()
return cls.all_versions(system_os, cpu)[0] return cls.all_versions(system_os, cpu)[0]
except (IndexError, requests.exceptions.RequestException): except (IndexError, requests.exceptions.RequestException) as e:
logger.error(f"Cannot get most recent version of ffmpeg") logger.error(f"Cannot get most recent version of ffmpeg: {e}")
return {} return {}
@classmethod @classmethod