Zeroconf offline-handling improvements (#77)

* Add benchmark.py

* Add cpu / disk benchmark APIs

* Add cpu_benchmark method to distributed_job_manager.py

* Do a better job of storing hostnames =

* Remove hostname from Zeroconf cache if server goes offline

* Add cpu / disk benchmark APIs

* Add cpu_benchmark method to distributed_job_manager.py

* Do a better job of storing hostnames =

* Remove hostname from Zeroconf cache if server goes offline

* Wrap main code in try finally block to always stop zeroconf

* Add missing import
This commit is contained in:
2024-02-12 14:57:00 -06:00
committed by GitHub
parent a31fe98964
commit ecf836c235
4 changed files with 50 additions and 36 deletions

View File

@@ -24,32 +24,38 @@ def run() -> int:
int: The exit status code.
"""
# Load Config YAML
Config.setup_config_dir()
Config.load_config(system_safe_path(os.path.join(Config.config_dir(), 'config.yaml')))
logging.basicConfig(format='%(asctime)s: %(levelname)s: %(module)s: %(message)s', datefmt='%d-%b-%y %H:%M:%S',
level=Config.server_log_level.upper())
try:
# Load Config YAML
Config.setup_config_dir()
Config.load_config(system_safe_path(os.path.join(Config.config_dir(), 'config.yaml')))
logging.basicConfig(format='%(asctime)s: %(levelname)s: %(module)s: %(message)s', datefmt='%d-%b-%y %H:%M:%S',
level=Config.server_log_level.upper())
app: QApplication = QApplication(sys.argv)
app: QApplication = QApplication(sys.argv)
# Start server in background
background_server = threading.Thread(target=start_server)
background_server.daemon = True
background_server.start()
# Start server in background
background_server = threading.Thread(target=start_server)
background_server.daemon = True
background_server.start()
# Setup logging for console ui
buffer_handler = BufferingHandler()
buffer_handler.setFormatter(logging.getLogger().handlers[0].formatter)
logger = logging.getLogger()
logger.addHandler(buffer_handler)
# Setup logging for console ui
buffer_handler = BufferingHandler()
buffer_handler.setFormatter(logging.getLogger().handlers[0].formatter)
logger = logging.getLogger()
logger.addHandler(buffer_handler)
window: MainWindow = MainWindow()
window.buffer_handler = buffer_handler
window.show()
window: MainWindow = MainWindow()
window.buffer_handler = buffer_handler
window.show()
return_code = app.exec()
RenderQueue.prepare_for_shutdown()
return sys.exit(return_code)
return_code = app.exec()
except Exception as e:
logging.error(f"Unhandled exception: {e}")
return_code = 1
finally:
RenderQueue.prepare_for_shutdown()
return sys.exit(return_code)
class BufferingHandler(logging.Handler, QObject):