From patchwork Mon Mar 7 13:36:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 4807 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85596C433EF for ; Mon, 7 Mar 2022 13:36:33 +0000 (UTC) Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by mx.groups.io with SMTP id smtpd.web12.26226.1646660188410132596 for ; Mon, 07 Mar 2022 05:36:32 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@axis.com header.s=axis-central1 header.b=IFPTB3gd; spf=pass (domain: axis.com, ip: 195.60.68.18, mailfrom: peter.kjellerstedt@axis.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1646660188; x=1678196188; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=cxKOkc7Rlw8indzK/uW7BzcZZCWEsA4+5AMbh+hZSLc=; b=IFPTB3gdol2Y13n2XnlS/b81+OII5UGNZKykyFNKaNkupb/60Vuahion rjB2xv4FzOgCXon8kwfgi/VvKrGNMAjqCDPLPyHgHE2w3pYyunsZwWPfh 33o7CnOmN4CzFWeaai2TImN36trPsf0ThIsM4IKCsfFPUlZcmdeeKJCqZ shrKFX1HhPt7HOx2e/rne9vidtq5B5+J3n21/pfz2oNTQbWko2FaSFkFD 7091kcmeA2utJibL//gBu9h4gdaiYoL3UtdUHL765shagPNa1wZKycYMb D6f5o4y/RUbjEqT4OhHSruig/W2jSIq2xQnIvPji6V1sgszIY3zxq0wHb A==; From: Peter Kjellerstedt To: Subject: [PATCH 1/3] knotty.py: Improve the message while waiting for running tasks to finish Date: Mon, 7 Mar 2022 14:36:18 +0100 Message-ID: <20220307133620.12404-1-pkj@axis.com> X-Mailer: git-send-email 2.21.3 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 07 Mar 2022 13:36:33 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/13428 From: Peter Kjellerstedt Use pluralise() to correct the grammar, and drop the colon at the end if runnning in quiet mode. Signed-off-by: Peter Kjellerstedt --- bitbake/lib/bb/ui/knotty.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index b02e59c1fe..a520895da2 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py @@ -272,7 +272,10 @@ class TerminalFilter(object): tasks.append("%s (pid %s)" % (activetasks[t]["title"], activetasks[t]["pid"])) if self.main.shutdown: - content = "Waiting for %s running tasks to finish:" % len(activetasks) + content = pluralise("Waiting for %s running task to finish", + "Waiting for %s running tasks to finish", len(activetasks)) + if not self.quiet: + content += ':' print(content) else: if self.quiet: From patchwork Mon Mar 7 13:36:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 4809 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77AC5C433EF for ; Mon, 7 Mar 2022 13:36:38 +0000 (UTC) Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by mx.groups.io with SMTP id smtpd.web09.26325.1646660195768683597 for ; Mon, 07 Mar 2022 05:36:38 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@axis.com header.s=axis-central1 header.b=TgVNMTxc; spf=pass (domain: axis.com, ip: 195.60.68.18, mailfrom: peter.kjellerstedt@axis.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1646660196; x=1678196196; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=+b4suqMsAQ5cvD+EWNHlKRVOvDWs0Iol8+IPYr377Yw=; b=TgVNMTxc6q+k95k/O0nShLQLYKUMaJ/xF5u7r+UBU5TF2q0QqfRdBznE JjBmgfHZ1e5io3ZpAraTEKV4CKz0dye3TMkJLQX7wccrGihzJ79U/TAVz /FDHMp8NpzJgwk0pCp+/ydkDDH7apHMugC/9jvZmEtZaSMDUu2t7OJ2eY Geq7dRT+gdUvNyQCHKuxKGoUNhdOj/5YUdnbj+/JJO1/pF+2syn1YXkYe hh458vNoLIkdE76buzQI2EO0t1Z8KnH3uYzFg3O7BxRADnWZHH+5ET+R4 GphY+G6fVcJHeH5TWJTx9hyYCuhpm5hrGRFyvk1WTutTG4b3StCpO6DzV Q==; From: Peter Kjellerstedt To: Subject: [PATCH 2/3] knotty.py: Give the setscene tasks their own progress bar Date: Mon, 7 Mar 2022 14:36:19 +0100 Message-ID: <20220307133620.12404-2-pkj@axis.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20220307133620.12404-1-pkj@axis.com> References: <20220307133620.12404-1-pkj@axis.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 07 Mar 2022 13:36:38 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/13430 From: Peter Kjellerstedt In commit 8055ec36 (knotty: Improve setscene task display) the setscene tasks got their own line in the task output. However, the progress bar code does not handle newlines in its widgets, so the length of the setscene line was included when calculating how much space is available for the progress bar of the running tasks, making it much too short. Instead of trying to teach the progress bar code to handle newlines, give the setscene tasks their own progress bar. Signed-off-by: Peter Kjellerstedt --- bitbake/lib/bb/ui/knotty.py | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index a520895da2..179cea43fa 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py @@ -204,6 +204,7 @@ class TerminalFilter(object): for h in handlers: h.addFilter(InteractConsoleLogFilter(self)) + self.setscene_progress = None self.main_progress = None def clearFooter(self): @@ -278,25 +279,34 @@ class TerminalFilter(object): content += ':' print(content) else: - if self.quiet: - content = "Running tasks (%s of %s, %s of %s)" % (self.helper.setscene_current, self.helper.setscene_total, self.helper.tasknumber_current, self.helper.tasknumber_total) - elif not len(activetasks): - content = "Setscene tasks: %s of %s\nNo currently running tasks (%s of %s)" % (self.helper.setscene_current, self.helper.setscene_total, self.helper.tasknumber_current, self.helper.tasknumber_total) - else: - content = "Setscene tasks: %s of %s\nCurrently %2s running tasks (%s of %s)" % (self.helper.setscene_current, self.helper.setscene_total, len(activetasks), self.helper.tasknumber_current, self.helper.tasknumber_total) + content = '' + curtask = self.helper.setscene_current + maxtask = self.helper.setscene_total + msg = "Setscene tasks (%s of %s)" % (curtask, maxtask) + if not self.setscene_progress or self.setscene_progress.maxval != maxtask: + widgets = [' ', progressbar.Percentage(), ' ', progressbar.Bar()] + self.setscene_progress = BBProgress("Setscene tasks", maxtask, widgets=widgets, resize_handler=self.sigwinch_handle) + self.setscene_progress.start(False) + self.setscene_progress.setmessage(msg) + content += self.setscene_progress.update(curtask) + "\n" + print('') + + curtask = self.helper.tasknumber_current maxtask = self.helper.tasknumber_total + if not len(activetasks): + msg = "No running tasks (%s of %s)" % (curtask, maxtask) + else: + msg = "%2s running tasks (%s of %s)" % (len(activetasks), curtask, maxtask) if not self.main_progress or self.main_progress.maxval != maxtask: widgets = [' ', progressbar.Percentage(), ' ', progressbar.Bar()] self.main_progress = BBProgress("Running tasks", maxtask, widgets=widgets, resize_handler=self.sigwinch_handle) self.main_progress.start(False) - self.main_progress.setmessage(content) - progress = self.helper.tasknumber_current - 1 - if progress < 0: - progress = 0 - content = self.main_progress.update(progress) + self.main_progress.setmessage(msg) + progress = max(0, curtask - 1) + content += self.main_progress.update(progress) print('') lines = self.getlines(content) - if self.quiet == 0: + if not self.quiet: for tasknum, task in enumerate(tasks[:(self.rows - 1 - lines)]): if isinstance(task, tuple): pbar, progress, rate, start_time = task From patchwork Mon Mar 7 13:36:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 4808 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62EEDC433F5 for ; Mon, 7 Mar 2022 13:36:34 +0000 (UTC) Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by mx.groups.io with SMTP id smtpd.web12.26226.1646660188410132596 for ; Mon, 07 Mar 2022 05:36:33 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@axis.com header.s=axis-central1 header.b=nARxPqF3; spf=pass (domain: axis.com, ip: 195.60.68.18, mailfrom: peter.kjellerstedt@axis.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1646660193; x=1678196193; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=nrmvtvaNGfENeUret17gsR9AbA4sQ7H3dqQFGVeqAzU=; b=nARxPqF3gBojSNfsX4tkJyWHBZ4kOvQD02Ldk5vGWxLnylq9Mh4Lo9q9 UBmoXNYfBCQ/dObhrc21xSX57o+xJmIp/sKvh5W0g5qDONxgis1jwrLWg liuv3NXgad36Yxqj9FizKfWc1Dc/UQxKmbGsDY52TH5h+u0X2QNk+bxxO HKelkzQ3ZJoLcfLwklVnSMQJHzaSPX5MIUuUKmyqUQw7+cZptL99N5Xpu CmzZorPtDpo437sH41SA6n3iLCNqqvkKO3nG50nj5unNuAxXKJelGaXkz BT+eZCXkHh96nuECpic7WZGOJKRkDcndqNKRKCk0siDEyJ8T+IzkOCmMa g==; From: Peter Kjellerstedt To: Subject: [PATCH 3/3] knotty.py: Separate the display of main tasks from running tasks Date: Mon, 7 Mar 2022 14:36:20 +0100 Message-ID: <20220307133620.12404-3-pkj@axis.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20220307133620.12404-1-pkj@axis.com> References: <20220307133620.12404-1-pkj@axis.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 07 Mar 2022 13:36:34 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/13429 From: Peter Kjellerstedt It can be confusing that the count of running tasks shown together with the progress bar for the main tasks also includes any running setscene tasks. Separate the display so that the message for the main tasks' progress bar only includes information on the main tasks, and the display of the count of currently running tasks gets it own line. Signed-off-by: Peter Kjellerstedt --- This should be considered an RFC. With this change, the progress lines for the setscene tasks and the main tasks (is that a good name for those tasks?) look the same. The drawback is that it adds a line to the display. bitbake/lib/bb/ui/knotty.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 179cea43fa..947fa73a13 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py @@ -293,10 +293,7 @@ class TerminalFilter(object): curtask = self.helper.tasknumber_current maxtask = self.helper.tasknumber_total - if not len(activetasks): - msg = "No running tasks (%s of %s)" % (curtask, maxtask) - else: - msg = "%2s running tasks (%s of %s)" % (len(activetasks), curtask, maxtask) + msg = "Main tasks (%s of %s)" % (curtask, maxtask) if not self.main_progress or self.main_progress.maxval != maxtask: widgets = [' ', progressbar.Percentage(), ' ', progressbar.Bar()] self.main_progress = BBProgress("Running tasks", maxtask, widgets=widgets, resize_handler=self.sigwinch_handle) @@ -307,6 +304,12 @@ class TerminalFilter(object): print('') lines = self.getlines(content) if not self.quiet: + if not len(activetasks): + content = "No running tasks" + else: + content = "%2s running tasks:" % len(activetasks) + print(content) + lines += self.getlines(content) for tasknum, task in enumerate(tasks[:(self.rows - 1 - lines)]): if isinstance(task, tuple): pbar, progress, rate, start_time = task