From patchwork Tue Mar 8 14:32:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 4942 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 F0E01C433FE for ; Tue, 8 Mar 2022 14:32:42 +0000 (UTC) Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by mx.groups.io with SMTP id smtpd.web08.8420.1646749960887976627 for ; Tue, 08 Mar 2022 06:32:41 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@axis.com header.s=axis-central1 header.b=Q7bK9IxQ; 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=1646749961; x=1678285961; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=z5RiCvVrMRHSdwo6Qry9yV1UyHuIAbhQzCsupyYd8Uo=; b=Q7bK9IxQUiCt8fJg8DEVGVbf219cXXX6FKuqttDenFoZl4fj6V2t77IG 9oF/7a38kNlY0F5BwLq5tDAbl2CXRg94oR5O16dyxBzP3rukPDry6Lzpl DXjfc9/nGZDyn5ghywKHESbLXrNCwGmy/w9TCp83t4rXDq783yBXnjPXP whix2oxe1scI1Iss9KbmWRjxqeAk2gb17/LU3FPPTwZOUpsqKS4MPc+jC 63CZGea9IWZy4QKKRhtCgpfukmxj7gdEvU6yuYOw6AlY1mCOryo3UUPwi Fmcl8UFtpBt91d6wBLUXqqG2fPEpeb+mplEAuD0Q39Za5KTP73hNOfQ2h w==; From: Peter Kjellerstedt To: Subject: [PATCHv3 1/4] knotty.py: Improve the message while waiting for running tasks to finish Date: Tue, 8 Mar 2022 15:32:30 +0100 Message-ID: <20220308143233.19972-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 ; Tue, 08 Mar 2022 14:32:42 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/13446 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 --- PATCHv2: No changes. PATCHv3: No changes. 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 Tue Mar 8 14:32:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 4943 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 F0DD9C433EF for ; Tue, 8 Mar 2022 14:32:42 +0000 (UTC) Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by mx.groups.io with SMTP id smtpd.web08.8419.1646749960625333848 for ; Tue, 08 Mar 2022 06:32:41 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@axis.com header.s=axis-central1 header.b=fW+a25An; spf=pass (domain: axis.com, ip: 195.60.68.17, 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=1646749961; x=1678285961; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=2xHyDblHchN+kgMolHNPDvNUkpBvoVGgxVqxKdDDt0I=; b=fW+a25AnRsN3yQp3YJyB754CIUdJBFK7OdNguuUBmO7VfPotPXpnxWFS AP6X+guJD7WvPp+Rea/nzWq2MaFXvh13u5AgyRQyiS5+7tQmxi3xBI0GK 2vF4RtoOXQQ64t5G9nmuOugx67Ze7gTeuzl4HonUHNsWwYUpyfWvld1C7 beT0LjsgLlYIArcMgA+9IDfwTXrd8+D8w/vK6E37LULFkinbjOwqI7L5J o1g2xBdXnUM432r5Sz3c23yTEgh79BsUdPvLX/0ajS8ekAJdz2E4AuP/K K1dLIxwGMiWLaebD6eX1+58eFHQd74/OiSXRPGs+3Tp3uaYp0/m2OLdZ/ Q==; From: Peter Kjellerstedt To: Subject: [PATCHv3 2/4] knotty.py: Correct the width of the progress bar for the real tasks Date: Tue, 8 Mar 2022 15:32:31 +0100 Message-ID: <20220308143233.19972-2-pkj@axis.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20220308143233.19972-1-pkj@axis.com> References: <20220308143233.19972-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 ; Tue, 08 Mar 2022 14:32:42 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/13447 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, separate the output of the setscene tasks from the progress bar for the real tasks. Signed-off-by: Peter Kjellerstedt --- PATCHv2: Corrected so that there are no changes to the output except that the progress bar now fills the width of the terminal as expected. PATCHv3: Extracted two minor code clean ups to a separate patch. bitbake/lib/bb/ui/knotty.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index a520895da2..52e6eb96fe 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py @@ -278,22 +278,31 @@ class TerminalFilter(object): content += ':' print(content) else: + scene_tasks = "%s of %s" % (self.helper.setscene_current, self.helper.setscene_total) + cur_tasks = "%s of %s" % (self.helper.tasknumber_current, self.helper.tasknumber_total) + + content = '' + if not self.quiet: + msg = "Setscene tasks: %s" % scene_tasks + content += msg + "\n" + print(msg) + 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) + msg = "Running tasks (%s, %s)" % (scene_tasks, cur_tasks) 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) + msg = "No currently running tasks (%s)" % cur_tasks 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) + msg = "Currently %2s running tasks (%s)" % (len(activetasks), cur_tasks) maxtask = self.helper.tasknumber_total 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) + self.main_progress.setmessage(msg) progress = self.helper.tasknumber_current - 1 if progress < 0: progress = 0 - content = self.main_progress.update(progress) + content += self.main_progress.update(progress) print('') lines = self.getlines(content) if self.quiet == 0: From patchwork Tue Mar 8 14:32:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 4944 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 DA103C4332F for ; Tue, 8 Mar 2022 14:32:43 +0000 (UTC) Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by mx.groups.io with SMTP id smtpd.web08.8420.1646749960887976627 for ; Tue, 08 Mar 2022 06:32:42 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@axis.com header.s=axis-central1 header.b=fM9DLcpE; 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=1646749962; x=1678285962; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=rOTl9gDGxfLHFpfBII7O3cy8acgTO0XfBJ5GEJnggOM=; b=fM9DLcpEmXTKcHu1yS+c1E6+zXcdn8+dcSIkl9NozghhtfJwJikF7K6N W8I3I5BiA2PGIW1vVf6z5tTJHlQ2LMpszb0IIObGebrgqh0AJTldEniGT yfEqjuWvRXjsmxI84p7w6ZVCMs5P4tPHGcrYkTu4uQYf4qfJ8yPbKo//I jnQrWEst1A5DcM9+rk2yJVBcrV3Eqyw+egT+RO+KO21190fy0OWScLIgh 0YJjIwiNBJsYdrMtMtGibqAg/defrnLzZTocqgOONwwxeGORpKY1mYcfY NhwcICT7gsyxK0oueWiBV+1ppDL4pXAsFTynxibGzA16/898XJiMNoe1m g==; From: Peter Kjellerstedt To: Subject: [PATCHv3 3/4] knotty.py: A little clean up of TerminalFilter::updateFooter() Date: Tue, 8 Mar 2022 15:32:32 +0100 Message-ID: <20220308143233.19972-3-pkj@axis.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20220308143233.19972-1-pkj@axis.com> References: <20220308143233.19972-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 ; Tue, 08 Mar 2022 14:32:43 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/13448 * Use max() to clamp progress to >= 0. * Be consistent when evaluating self.quiet (treat it as a boolean). Signed-off-by: Peter Kjellerstedt --- PATCHv3: New. This was previously part of the preceding patch. bitbake/lib/bb/ui/knotty.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 52e6eb96fe..78888f8bdd 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py @@ -299,13 +299,11 @@ class TerminalFilter(object): self.main_progress = BBProgress("Running tasks", maxtask, widgets=widgets, resize_handler=self.sigwinch_handle) self.main_progress.start(False) self.main_progress.setmessage(msg) - progress = self.helper.tasknumber_current - 1 - if progress < 0: - progress = 0 + progress = max(0, self.helper.tasknumber_current - 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 Tue Mar 8 14:32:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 4945 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 DAF2BC433EF for ; Tue, 8 Mar 2022 14:32:48 +0000 (UTC) Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by mx.groups.io with SMTP id smtpd.web08.8421.1646749965576838932 for ; Tue, 08 Mar 2022 06:32:48 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@axis.com header.s=axis-central1 header.b=j6BhzwrE; 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=1646749966; x=1678285966; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=HlJ+seLdWeitkNWMojl47dxqeuPUd65X13f6tw7tBks=; b=j6BhzwrEPirjXx2fHfp3kb0RMLuZUQtYpp1HuPCuzs+BsJCyoLKijFOA eTVxNjEiL0hz5+YcIFjGsdfS/4eqUPLYZCjKoYEMbBSPFIEM2dVvZ/Lib Qghd+Nsaa9FYkP9x3gTRglWjtpSvEud36MB7OWczXR6+Jh4geJCpusuF/ z6PbvZzkqzhr10MBGQ0InodfK4sI3hDaZRGB6KVvyIgqmFiSBvRdRKAsu tNGC+dsBHjOZNBoyEwPMdFBH7ZhyGlGbvQKgl6j0Yk7idlUZj3pjNfMjT G8SiIbvNja43w9IdgkvmRb0CH8TKbTIISEquInsdKMeFJxvJ4jmO7weVY w==; From: Peter Kjellerstedt To: Subject: [PATCHv3 4/4] knotty.py: Unify quiet and non-quiet output for the running tasks Date: Tue, 8 Mar 2022 15:32:33 +0100 Message-ID: <20220308143233.19972-4-pkj@axis.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20220308143233.19972-1-pkj@axis.com> References: <20220308143233.19972-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 ; Tue, 08 Mar 2022 14:32:48 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/13449 From: Peter Kjellerstedt This adds the number of currently running tasks to the output in quiet mode, and removes the word "currently" from the output for the non-quiet output. Removing "currently" avoids having the text "jump around" depending on whether any tasks are running or not, and it also gives a little bit more space to the progress bar. Signed-off-by: Peter Kjellerstedt --- PATCHv2: New. PATCHv3: No changes. bitbake/lib/bb/ui/knotty.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 78888f8bdd..704e688f48 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py @@ -287,12 +287,11 @@ class TerminalFilter(object): content += msg + "\n" print(msg) + msg = "%2s running tasks" % (len(activetasks) or "No") if self.quiet: - msg = "Running tasks (%s, %s)" % (scene_tasks, cur_tasks) - elif not len(activetasks): - msg = "No currently running tasks (%s)" % cur_tasks + msg += " (%s, %s)" % (scene_tasks, cur_tasks) else: - msg = "Currently %2s running tasks (%s)" % (len(activetasks), cur_tasks) + msg += " (%s)" % cur_tasks maxtask = self.helper.tasknumber_total if not self.main_progress or self.main_progress.maxval != maxtask: widgets = [' ', progressbar.Percentage(), ' ', progressbar.Bar()]