From dcf97a01f069f76441e9fd21d1f72ebc2e9e5e25 Mon Sep 17 00:00:00 2001 From: Michael Woods Date: Sat, 15 Feb 2025 15:43:50 -0500 Subject: [PATCH] Minor fixes. --- src/packetserver/client/__init__.py | 4 +++- src/packetserver/server/__init__.py | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/packetserver/client/__init__.py b/src/packetserver/client/__init__.py index 698145f..98c2e36 100644 --- a/src/packetserver/client/__init__.py +++ b/src/packetserver/client/__init__.py @@ -88,4 +88,6 @@ class Client: logging.debug("Connection attempt timed out.") conn.close() return None - return self.send_and_receive(req, conn, timeout=int(remaining_time)) + response = self.send_and_receive(req, conn, timeout=int(remaining_time)) + conn.close() + return response diff --git a/src/packetserver/server/__init__.py b/src/packetserver/server/__init__.py index a913510..32e597e 100644 --- a/src/packetserver/server/__init__.py +++ b/src/packetserver/server/__init__.py @@ -91,11 +91,13 @@ class Server: if 'user_jobs' not in conn.root(): conn.root.user_jobs = PersistentMapping() init_bulletins(conn.root()) - - if 'jobs_enabled' in conn.root.config: + if ('jobs_enabled' in conn.root.config) and conn.root.config['jobs_enabled']: + logging.debug(conn.root.config['jobs_enabled']) + logging.debug(conn.root.config['jobs_config']) if 'runner' in conn.root.config['jobs_config']: val = str(conn.root.config['jobs_config']['runner']).lower().strip() if val in ['podman']: + logging.debug("Enabling podman orchestrator") self.orchestrator = get_orchestrator_from_config(conn.root.config['jobs_config']) self.app = pe.app.Application() @@ -198,7 +200,7 @@ class Server: return # Add things to do here: - if self.orchestrator.started: + if (self.orchestrator is not None) and self.orchestrator.started: with self.db.transaction() as storage: # queue as many jobs as possible while self.orchestrator.runners_available(): @@ -219,7 +221,6 @@ class Server: else: break - if self.orchestrator.started: finished_runners = [] for runner in self.orchestrator.runners: if runner.is_finished():