From c774dcdac8d01ba3165395726edac45c0ee6429a Mon Sep 17 00:00:00 2001
From: Christian Berendt <berendt@osism.tech>
Date: Sun, 3 Dec 2023 14:41:26 +0100
Subject: [PATCH] Print a note when a task output timed out

Related to osism/issues#785

Signed-off-by: Christian Berendt <berendt@osism.tech>
---
 osism/tasks/__init__.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/osism/tasks/__init__.py b/osism/tasks/__init__.py
index 37d6f6d8..bb997f98 100644
--- a/osism/tasks/__init__.py
+++ b/osism/tasks/__init__.py
@@ -266,6 +266,16 @@ def handle_task(t, wait, format, timeout):
                     elif message_type == "action" and message_content == "quit":
                         redis.close()
                         return rc
+        else:
+            logger.info(
+                f"There has been no output from the task {t.task_id} for {timeout} seconds. "
+                "This timeout can be adjusted using the --timeout parameter."
+            )
+            logger.info(
+                f"Task {t.task_id} is still running in background. No more output here. Check ARA for logs. "
+                f"Use this command to continue waiting for this task: osism wait --output --delay 2 {t.task_id}"
+            )
+            return 1
 
     else:
         if format == "log":