public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] rootfs: Report progress for postprocessing steps
@ 2020-07-01 14:38 Harald Seiler
  2020-07-01 16:33 ` Claudius Heine
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Harald Seiler @ 2020-07-01 14:38 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine, Harald Seiler

Use a ProgressHandler to report how far postprocessing has progressed.
Because we can't know the exact timing of all postprocessing tasks, the
percentages are split evenly for all steps.

Signed-off-by: Harald Seiler <hws@denx.de>
---
 meta/classes/rootfs.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 806e824c825a..889272e7bee4 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -248,12 +248,16 @@ python do_rootfs_postprocess() {
     # removed on a previous execution of this task:
     bb.build.exec_func('rootfs_do_qemu', d)
 
+    progress_reporter = bb.progress.ProgressHandler(d)
+    progress_reporter.update(0)
+
     cmds = d.getVar("ROOTFS_POSTPROCESS_COMMAND")
     if cmds is None or not cmds.strip():
         return
     cmds = cmds.split()
-    for cmd in cmds:
+    for i, cmd in enumerate(cmds):
         bb.build.exec_func(cmd, d)
+        progress_reporter.update(int(i / len(cmds) * 100))
 }
 addtask rootfs_postprocess before do_rootfs
 
-- 
2.25.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rootfs: Report progress for postprocessing steps
  2020-07-01 14:38 [PATCH] rootfs: Report progress for postprocessing steps Harald Seiler
@ 2020-07-01 16:33 ` Claudius Heine
  2020-10-13 10:26 ` Jan Kiszka
  2020-11-18 19:10 ` Baurzhan Ismagulov
  2 siblings, 0 replies; 4+ messages in thread
From: Claudius Heine @ 2020-07-01 16:33 UTC (permalink / raw)
  To: Harald Seiler, isar-users


[-- Attachment #1.1: Type: text/plain, Size: 2081 bytes --]

Hi Harald,

On 2020-07-01 16:38, Harald Seiler wrote:
> Use a ProgressHandler to report how far postprocessing has progressed.
> Because we can't know the exact timing of all postprocessing tasks, the
> percentages are split evenly for all steps.

I think I wanted to do this myself at some point. So great that I don't
have to ;)

I think I would probably have used the MultiStageProgressReporter here
as well, like with it is done in `do_rootfs_install` and just entered
some measured values for the tasks I got locally as weights. The idea is
that the weights are just a rough indicator. Since `do_rootfs_install`
has some tasks that take much longer than others, it sort of makes
sense. If the postprocessing tasks are mostly equal, then the
ProgressHandler is ok.

Maybe you can just try measuring it with the MultiStageProgressReporter
and then decide.

IIRC, I though at that time that the post-process tasks are finished
pretty fast and so decided not to invest the time to add a progress bar.
But its long ago, so I might be mistaken.

regards,
Claudius

> 
> Signed-off-by: Harald Seiler <hws@denx.de>
> ---
>  meta/classes/rootfs.bbclass | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
> index 806e824c825a..889272e7bee4 100644
> --- a/meta/classes/rootfs.bbclass
> +++ b/meta/classes/rootfs.bbclass
> @@ -248,12 +248,16 @@ python do_rootfs_postprocess() {
>      # removed on a previous execution of this task:
>      bb.build.exec_func('rootfs_do_qemu', d)
>  
> +    progress_reporter = bb.progress.ProgressHandler(d)
> +    progress_reporter.update(0)
> +
>      cmds = d.getVar("ROOTFS_POSTPROCESS_COMMAND")
>      if cmds is None or not cmds.strip():
>          return
>      cmds = cmds.split()
> -    for cmd in cmds:
> +    for i, cmd in enumerate(cmds):
>          bb.build.exec_func(cmd, d)
> +        progress_reporter.update(int(i / len(cmds) * 100))
>  }
>  addtask rootfs_postprocess before do_rootfs
>  
>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rootfs: Report progress for postprocessing steps
  2020-07-01 14:38 [PATCH] rootfs: Report progress for postprocessing steps Harald Seiler
  2020-07-01 16:33 ` Claudius Heine
@ 2020-10-13 10:26 ` Jan Kiszka
  2020-11-18 19:10 ` Baurzhan Ismagulov
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Kiszka @ 2020-10-13 10:26 UTC (permalink / raw)
  To: Baurzhan Ismagulov; +Cc: Harald Seiler, isar-users, Claudius Heine

On 01.07.20 16:38, Harald Seiler wrote:
> Use a ProgressHandler to report how far postprocessing has progressed.
> Because we can't know the exact timing of all postprocessing tasks, the
> percentages are split evenly for all steps.
> 
> Signed-off-by: Harald Seiler <hws@denx.de>
> ---
>  meta/classes/rootfs.bbclass | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
> index 806e824c825a..889272e7bee4 100644
> --- a/meta/classes/rootfs.bbclass
> +++ b/meta/classes/rootfs.bbclass
> @@ -248,12 +248,16 @@ python do_rootfs_postprocess() {
>      # removed on a previous execution of this task:
>      bb.build.exec_func('rootfs_do_qemu', d)
>  
> +    progress_reporter = bb.progress.ProgressHandler(d)
> +    progress_reporter.update(0)
> +
>      cmds = d.getVar("ROOTFS_POSTPROCESS_COMMAND")
>      if cmds is None or not cmds.strip():
>          return
>      cmds = cmds.split()
> -    for cmd in cmds:
> +    for i, cmd in enumerate(cmds):
>          bb.build.exec_func(cmd, d)
> +        progress_reporter.update(int(i / len(cmds) * 100))
>  }
>  addtask rootfs_postprocess before do_rootfs
>  
> 

Looks good to me, should be merged finally.

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rootfs: Report progress for postprocessing steps
  2020-07-01 14:38 [PATCH] rootfs: Report progress for postprocessing steps Harald Seiler
  2020-07-01 16:33 ` Claudius Heine
  2020-10-13 10:26 ` Jan Kiszka
@ 2020-11-18 19:10 ` Baurzhan Ismagulov
  2 siblings, 0 replies; 4+ messages in thread
From: Baurzhan Ismagulov @ 2020-11-18 19:10 UTC (permalink / raw)
  To: isar-users

On Wed, Jul 01, 2020 at 04:38:32PM +0200, Harald Seiler wrote:
> Use a ProgressHandler to report how far postprocessing has progressed.
> Because we can't know the exact timing of all postprocessing tasks, the
> percentages are split evenly for all steps.

Applied to next, thanks.

With kind regards,
Baurzhan.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-18 19:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-01 14:38 [PATCH] rootfs: Report progress for postprocessing steps Harald Seiler
2020-07-01 16:33 ` Claudius Heine
2020-10-13 10:26 ` Jan Kiszka
2020-11-18 19:10 ` Baurzhan Ismagulov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox