Skip to contentSkip to conversation

knotty: display active tasks when printing keepAlive() message

PATCH In review Ross Burton 4 participants 5 messages Mar 21, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 knotty: display active tasks when printing keepAlive() message

In interactive bitbake sessions it is obvious what tasks are running when one of them hangs or otherwise takes a long time. However, in non-interactive sessions (such as automated builds) bitbake just prints a message saying that it is "still alive" with no clues as to what tasks are active still.

By simply listing the active tasks when printing the keep alive message, we don't need to parse the bitbake log to identify which of the tasks is still active and has presumably hung.

---
 bitbake/lib/bb/ui/knotty.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
bitbake/lib/bb/ui/knotty.py +3 -1
index 78888f8bdd3..50dd4229da4 100644
@@ -228,7 +228,9 @@ class TerminalFilter(object):
 
     def keepAlive(self, t):
         if not self.cuu:
-            print("Bitbake still alive (%ds)" % t)
+            print("Bitbake still alive (no events for %ds). Active tasks:" % t)
+            for t in self.helper.running_tasks:
+                print(t)
             sys.stdout.flush()
 
     def updateFooter(self):
Signature · 1 line
2.25.1
#1 lore raw

Hi Ross,

Ross Burton <[email protected]> escreveu no dia segunda, 21/03/2022 à(s) 17:01:

Quoted 20 lines

In interactive bitbake sessions it is obvious what tasks are running when one of them hangs or otherwise takes a long time. However, in non-interactive sessions (such as automated builds) bitbake just prints a message saying that it is "still alive" with no clues as to what tasks are active still.

By simply listing the active tasks when printing the keep alive message, we don't need to parse the bitbake log to identify which of the tasks is still active and has presumably hung.

---
 bitbake/lib/bb/ui/knotty.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
bitbake/lib/bb/ui/knotty.py +0 -0
index 78888f8bdd3..50dd4229da4 100644

bitbake/lib/bb/ui/knotty.py class TerminalFilter(object): · line 235

Quoted 9 lines
bitbake/lib/bb/ui/knotty.py +3 -1
@@ -228,7 +228,9 @@ class TerminalFilter(object):
 
     def keepAlive(self, t):
         if not self.cuu:
-            print("Bitbake still alive (%ds)" % t)
+            print("Bitbake still alive (no events for %ds). Active
 tasks:" % t)
+            for t in self.helper.running_tasks:
+                print(t)
 

I think that building a new string with all tasks and call print at the end is more efficient.

Jose

sys.stdout.flush()

Quoted 17 lines
bitbake/lib/bb/ui/knotty.py +0 -1
     def updateFooter(self):
--

2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#13490):
https://lists.openembedded.org/g/bitbake-devel/message/13490
Mute This Topic: https://lists.openembedded.org/mt/89932958/5052612
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Best regards,

José Quaresma
#2 lore raw
Quoted 1 line · Jose Quaresma

I think that building a new string with all tasks and call print at the end is more efficient.

This only happens if bitbake has been idle for quite some time (5000 seconds) so efficiency isn't key, and I'm not convinced that constructing a long string and then calling print() once will be measurable faster than not doing lots of string manipulation.

Ross

#3 lore raw
In reply to Ross Burton

I like this idea and with this implemented, it might be useful to lower printinterval 5000s to something a bit shorter as well (or make it configurable)

No output at all for 10+ minutes always looks strange and if I have a shell on the builder I would check top/htop to see what's still running (if it's something expected like chromium do_compile or something less expected like linux-yocto do_fetch when the premirror should already be populated). Printing this directly in knotty log file would very convenient for people who cannot just run htop or similar on builder and tens extra lines in the log file doesn't seem too bad.

Regards,

Quoted 46 lines · Ross Burton

In interactive bitbake sessions it is obvious what tasks are running when one of them hangs or otherwise takes a long time. However, in non-interactive sessions (such as automated builds) bitbake just prints a message saying that it is "still alive" with no clues as to what tasks are active still.

By simply listing the active tasks when printing the keep alive message, we don't need to parse the bitbake log to identify which of the tasks is still active and has presumably hung.

---
 bitbake/lib/bb/ui/knotty.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
bitbake/lib/bb/ui/knotty.py +3 -1
index 78888f8bdd3..50dd4229da4 100644
@@ -228,7 +228,9 @@ class TerminalFilter(object):
 
     def keepAlive(self, t):
         if not self.cuu:
-            print("Bitbake still alive (%ds)" % t)
+            print("Bitbake still alive (no events for %ds). Active
 tasks:" % t)
+            for t in self.helper.running_tasks:
+                print(t)
             sys.stdout.flush()
 

def updateFooter(self):
--
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#13490):
https://lists.openembedded.org/g/bitbake-devel/message/13490
Mute This Topic: https://lists.openembedded.org/mt/89932958/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw
Quoted 3 lines · Martin Jansa

I like this idea and with this implemented, it might be useful to lower printinterval 5000s to something a bit shorter as well (or make it configurable)

No output at all for 10+ minutes always looks strange and if I have a shell on the builder I would check top/htop to see what's still running (if it's something expected like chromium do_compile or something less expected like linux-yocto do_fetch when the premirror should already be populated). Printing this directly in knotty log file would very convenient for people who cannot just run htop or similar on builder and tens extra lines in the log file doesn't seem too bad.

I actually agree. How about five or ten minutes? This only happens for non-interactive builds so most interactive users won't even notice.

Ross