From 171af7854ee441f4040e917ec226b4c8817c2e1e Mon Sep 17 00:00:00 2001
From: chausman <chausman@nrao.edu>
Date: Wed, 5 Jun 2024 10:08:44 -0600
Subject: [PATCH] force monitor closure to wait for final messages to clear

---
 apps/cli/utilities/wf_monitor/wf_monitor/monitor.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/apps/cli/utilities/wf_monitor/wf_monitor/monitor.py b/apps/cli/utilities/wf_monitor/wf_monitor/monitor.py
index 8bd65fd6d..ffbe8197c 100644
--- a/apps/cli/utilities/wf_monitor/wf_monitor/monitor.py
+++ b/apps/cli/utilities/wf_monitor/wf_monitor/monitor.py
@@ -550,7 +550,10 @@ class WorkflowMonitor:
         return WorkflowStatusMessages.COMPLETE.value if return_value == 0 else WorkflowStatusMessages.FAILED.value
 
     def close(self):
+        logger.info("Waiting 3 seconds for final messages to clear....")
+        time.sleep(3)
         self.message_router.close()
+        logger.info(f"Monitor closed for {self.workflow_request_id}")
 
     def __str__(self):
         return f"WorkflowMonitor, monitoring {self.logfile_path} that has events {self.events}"
-- 
GitLab