Use app_type to designate config_watcher

This commit is contained in:
John Davis
2025-12-10 10:08:25 -05:00
parent 0850ceaab9
commit 0058f905f4
+5 -1
View File
@@ -15,6 +15,8 @@ from galaxy.model.orm.now import now
log = logging.getLogger(__name__)
WEBAPP = "webapp" # WorkerProcess.app_type for web apps.
class DatabaseHeartbeat:
def __init__(self, application_stack, heartbeat_interval=60):
@@ -87,13 +89,15 @@ class DatabaseHeartbeat:
worker_process = session.scalars(stmt).first()
if not worker_process:
worker_process = WorkerProcess(server_name=self.server_name, hostname=self.hostname)
if self.application_stack.app.is_webapp:
worker_process.app_type = WEBAPP
worker_process.update_time = now()
worker_process.pid = self.pid
session.add(worker_process)
# We only want a single process watching the various config files on the file system.
# We just pick the max server name for simplicity
is_config_watcher = self.server_name == max(
p.server_name for p in self.get_active_processes(self.heartbeat_interval + 1)
p.server_name for p in self.get_active_processes(self.heartbeat_interval + 1) if p.app_type == WEBAPP
)
if is_config_watcher != self.is_config_watcher:
self.is_config_watcher = is_config_watcher