From patchwork Tue Mar 8 11:00:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 4906 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 DBDCBC433EF for ; Tue, 8 Mar 2022 11:00:50 +0000 (UTC) Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by mx.groups.io with SMTP id smtpd.web12.6926.1646737247990140564 for ; Tue, 08 Mar 2022 03:00:50 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@axis.com header.s=axis-central1 header.b=C2Ba4hMM; 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=1646737248; x=1678273248; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=R3NawtZGi691Dck7rpZFPafTiJ2NUzr8L+x5z2MAg2M=; b=C2Ba4hMMmKEfurN9Ib+oEWf+ghWiwNGkiwTPU3uNVlCTn/WwbzEeU3lK j9mtjEWbZs/z1Fz5SZzZMXBiL0cTTPauL/3N18RYneAfS8bAmDwYMqMic GRprV7SfWEtmnr/SxzkjWqRbft5tiLyuf/dpFYuUP+mlGGNoC2bnZDHEH rqCnuNzJW5DGrgXqbupNOK6xi7WTnyerh561uKWvzSRMKIhOTFKjIhPcS ADce+BX2yBmENe7HEXogx7z1boHaW2++JLPhyYZ9WBZQuVmO+IPKJOaTw /mfgCXUZlM17l5ePuHTFlq8TApOA+bkh49N5UIOukty6Pq3l1fcZp1EwA A==; From: Peter Kjellerstedt To: Subject: [PATCHv2 1/3] knotty.py: Improve the message while waiting for running tasks to finish Date: Tue, 8 Mar 2022 12:00:42 +0100 Message-ID: <20220308110044.2825-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 11:00:50 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/13443 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. 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 11:00:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 4908 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 CA145C433EF for ; Tue, 8 Mar 2022 11:00:55 +0000 (UTC) Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by mx.groups.io with SMTP id smtpd.web10.6959.1646737252645540735 for ; Tue, 08 Mar 2022 03:00:55 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@axis.com header.s=axis-central1 header.b=Q/nu7Upp; 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=1646737253; x=1678273253; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=cXPy+/5/zeLHg59ZyeQJZxOmocpPE4UnEW0A6O05AHE=; b=Q/nu7UppBNaOc5yfyRTCHqKuPtqhEJQ1JgmFFWyVFdN5r4P70gi1uW9O lrKgJVP6B13Mx+3RM8HnazRtGSAo6KIsB4Nr7m+ZyZNTDtyxRF/23fnSe LLDhr+qEKBcZhI7a/xZQZZLBJfBMtZrE+jFWkoIdzov7MqcTtG1jvUpwv ZcjThXXDr2gNknqfC20ltFoD3u9m1MqK4RWM8BSiglE8P0QOaLV08Zt2L VULq3NnOQqx1L4PlFPaWFijZplmSa+ywJHDk/wE84MX3ohkE43mo0HkRE slWI9K8L0u+ltI6EpU+Xc5tl1EIqGEHjqjPt1LWhBuXnIfC0KWlhKAzv1 Q==; From: Peter Kjellerstedt To: Subject: [PATCHv2 2/3] knotty.py: Correct the width of the progress bar for the real tasks Date: Tue, 8 Mar 2022 12:00:43 +0100 Message-ID: <20220308110044.2825-2-pkj@axis.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20220308110044.2825-1-pkj@axis.com> References: <20220308110044.2825-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 11:00:55 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/13445 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. bitbake/lib/bb/ui/knotty.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index a520895da2..78888f8bdd 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py @@ -278,25 +278,32 @@ 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) - 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, 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 11:00:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 4907 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 C490DC433EF for ; Tue, 8 Mar 2022 11:00:53 +0000 (UTC) Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by mx.groups.io with SMTP id smtpd.web12.6926.1646737247990140564 for ; Tue, 08 Mar 2022 03:00:52 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@axis.com header.s=axis-central1 header.b=EXMskZCa; 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=1646737251; x=1678273251; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=S7yFPh52gLni6aLQQKycrDb43VUqrf/u9QxJIdMsKBg=; b=EXMskZCaNfJRBcyu6Ff0ZyVKp74n+hN26ZqIgWIf7snk8FfKEuD8c9Ch gDCbgZh3uryHqP2/aVnL6cxSxWr+f+np4GSR1wldWVpklM7pxXdzEpCM3 XCveC476WJvjYIlO5ENpmuxVDTDIdL2hKz3DR7kZ1i6GYArnNn5winOo9 p9vEb6nH9/K4IR8Ka9TgKpovRLgAG2fyOelOf1GyoXtZHcXKp6yi1xWRf luG6/rNxJwM17a6tjT9PhoN0du0Nlo9KML0kBtJhWQYJ4xl+b/yqRma5V GqNHty0jliSSauSqsK3NcmR8eSl/e34DyR5yI0jw/xbXrwcrMfVGbeCcE g==; From: Peter Kjellerstedt To: Subject: [PATCHv2 3/3] knotty.py: Unify quiet and non-quiet output for the running tasks Date: Tue, 8 Mar 2022 12:00:44 +0100 Message-ID: <20220308110044.2825-3-pkj@axis.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20220308110044.2825-1-pkj@axis.com> References: <20220308110044.2825-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 11:00:53 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/13444 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. 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()]