From da50ab5e7fd5e31d04ac239685421d9d9225c6f6 Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Thu, 7 May 2026 20:36:45 +0200 Subject: [PATCH] feat(ogagent): report busy state and os type in heartbeat ping Add 'busy' and 'st' fields to the periodic webhook ping so ogCore can track whether a client is executing a job without waiting for a command response. - oglive_worker: busy derived from thread_list running state, st='OGL' - OpenGnSys module: busy derived from jobmgr active processes, st mapped from operations.os_type (LNX/WIN/OSX) Co-Authored-By: Claude Sonnet 4.6 --- src/opengnsys/modules/server/OpenGnSys/__init__.py | 3 +++ src/opengnsys/workers/oglive_worker.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/opengnsys/modules/server/OpenGnSys/__init__.py b/src/opengnsys/modules/server/OpenGnSys/__init__.py index c1ae66b..467c773 100644 --- a/src/opengnsys/modules/server/OpenGnSys/__init__.py +++ b/src/opengnsys/modules/server/OpenGnSys/__init__.py @@ -125,9 +125,12 @@ class OpenGnSysWorker(ServerWorker): time.sleep(1) n += 1 if not n % 10: + _st_map = {'linux': 'LNX', 'macos': 'OSX', 'windows': 'WIN'} body = { "iph": self.interface.ip, "timestamp": int(time.time()), + "busy": any(j['p'].poll() is None for j in self.jobmgr.jobs.values()), + "st": _st_map.get(operations.os_type.lower(), 'UNK'), } result = self.REST.sendMessage('clients/status/webhook', body) if result is None: diff --git a/src/opengnsys/workers/oglive_worker.py b/src/opengnsys/workers/oglive_worker.py index bc146c9..2caeade 100644 --- a/src/opengnsys/workers/oglive_worker.py +++ b/src/opengnsys/workers/oglive_worker.py @@ -260,6 +260,8 @@ class ogLiveWorker(ServerWorker): body = { 'iph': self.IPlocal, 'timestamp': int (time.time()), + 'busy': any(elem['running'] for elem in self.thread_list.values()), + 'st': 'OGL', } #logger.debug (f'about to send ping ({body})') self.REST.sendMessage ('clients/status/webhook', body)