Bug 328298

Summary: kiwi: performs very slowly, while kiwi in shell is fast
Product: [openSUSE] openSUSE 10.3 Reporter: Francis Giannaros <francis>
Component: YaST2Assignee: Marcus Schaefer <ms>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P5 - None CC: jsuchome, ms
Version: RC 1   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: patch for /usr/share/YaST2/modules/Kiwi.ycp
screenshot
patch
alternative version of the patch

Description Francis Giannaros 2007-09-25 19:15:37 UTC
As mentioned in Bug 327839:

I'm also wondering if this is related to the fact that the second stage of
outputting all depends, i.e. 

  yast2-users-2.15.36-22@i586
    Requires:
      yast2-2.15.58-6@i586 (installed)
      perl-Digest-SHA1-2.11-59@i586 (installed)
      libgcc42-4.2.1_20070724-13@i586 (installed)
      yast2-security-2.15.1-17@noarch (installed)
      yast2-core-2.15.12-2@i586 (installed)
      yast2-country-2.15.19-8@i586 (installed)
      libstdc++42-4.2.1_20070724-13@i586 (installed)
      yast2-pam-2.14.0-122@noarch (installed)
      yast2-perl-bindings-2.15.3-21@i586 (installed)
      yast2-ldap-client-2.15.12-29@noarch (installed)
      perl-X500-DN-0.29-13@i586 (installed)
    Required By:
      yast2-samba-server-2.15.7-49@noarch (installed)
      yast2-inetd-2.15.1-33@noarch (installed)
      yast2-mail-2.15.22-2@noarch (installed)
      yast2-sudo-2.15.3-78@noarch (installed)
      yast2-profile-manager-2.15.0-44@i586 (installed)

etc etc.. happens incredibly slowly. Like 2 lines a second. In the terminal it
outputs _all_ the lines straight away. Is there something in YaST that slows
down the output of the text? Because that stage alone seems to take 10 minutes
or so, in comparison to 1 second in the shell. And, in the shell I _do_ have
--logfile terminal on.
Comment 1 Jiří Suchomel 2007-09-25 19:31:56 UTC
The problem might be in reading the kiwi output or in placing the text which is too big to the YaST widget.

Possible solution might be to show only last n (100?) lines of the output in that window, but I'm not sure if users wouldn't complain that some information is lost. Maybe some better solution could be found.
Comment 2 Francis Giannaros 2007-09-25 19:35:26 UTC
From IRC: 

12:21:54 < benJIman> ^ that'll be string concatenations and rich-text being slow probably

*shrug*
Comment 3 Jiří Suchomel 2007-09-25 19:42:29 UTC
Yes, that's possible.
Comment 4 Jiří Suchomel 2007-09-25 19:56:51 UTC
Created attachment 174707 [details]
patch for /usr/share/YaST2/modules/Kiwi.ycp

If you have time for experiments, you can test this patch for /usr/share/YaST2/modules/Kiwi.ycp (you need to run 'ycpc -c usr/share/YaST2/modules/Kiwi.ycp' after applying the patch).

But it's just a quick try, I have no idea if it helps (it could even make it even slower). Tommorow I'll look into it deeper.
Comment 5 Francis Giannaros 2007-09-27 23:35:14 UTC
I think I've got a solution for this. What's slow is when the text starts getting a lot longer so, why not just show the normal KIWI output (without --logfile terminal) and have a button at the end saying "Save/View Full Logfile" (which would have all the gory details). Furthermore, if there is an error from the longer log, display it in the bottom pane.

This way the user doesn't lose out on anything, still gets an idea of progress, and things are fast because only a little amount of text is displayed in yast2 kiwi. 

What do you think?
Comment 6 Jiří Suchomel 2007-10-01 12:17:12 UTC
Created attachment 175710 [details]
screenshot

unfortunatelly, it looks pretty ugly
Comment 7 Jiří Suchomel 2007-10-02 08:46:35 UTC
The problem is, that without --logfile terminal, it prints all the color "done/failed" strings that mangle the output when it is read by YaST and shown in the window.
Comment 8 Jiří Suchomel 2007-10-03 10:47:56 UTC
Marcus, would it be possible to run kiwi without --logfile terminal option, but also without writing those special characters that mangle the output? See comment 6.
Comment 9 Francis Giannaros 2007-10-03 10:53:22 UTC
We could always pipe it without a cut, at worst, no?
Comment 10 Jiří Suchomel 2007-10-04 08:22:18 UTC
Huh - do you mean without or with? Cut the last chunk of the line?
Comment 11 Marcus Schaefer 2007-10-04 12:22:54 UTC
In reply to comment #8: No :)

next versions of kiwi will provide a log socket you can access and
query.
Comment 12 Jiří Suchomel 2007-10-04 12:57:15 UTC
Well, I appreciate that next versions will provide new way of logging, but for now it would be sufficient to have an option that would make the output look like the "fileLog" tag is set. Which means, make the log output brief (just like when kiwi is called from command line, not like when it is redirected to file) with the possibility to show a full log later (which would be YaST task, reading the log file that is created anyway). 

It doesn't look impossible.
Comment 13 Jiří Suchomel 2007-10-04 13:15:05 UTC
I thought about something like this:

(patch for /usr/sbin/kiwi)

106a107
> our $nocolor;         # do not used colored output (done/failed messages)
147c148,150
<
---
>       if (defined $nocolor) {
>               $kiwi -> setLogFile (undef);
>       }
741a745
>               "nocolor"               => \$nocolor,



(patch for KiwiLog.pm)

495a496,500
>       if (!defined $file) {
>               $this->{fileLog} = 1;
>               return $this;
>       }
Comment 14 Marcus Schaefer 2007-10-04 13:21:23 UTC
could you make that as a unified diff attachment ? I will include it
to svn then

Thanks
Comment 15 Jiří Suchomel 2007-10-04 13:52:08 UTC
Created attachment 176338 [details]
patch

Well, it's more a hack -  I rely on the fact that "fileLog" tag is used only for that debugging in functions like done etc. Maybe it would be better to introduce another key.
Comment 16 Jiří Suchomel 2007-10-04 13:52:58 UTC
Created attachment 176339 [details]
alternative version of the patch

Not using "fileLog" but own "nocolor" key.
Comment 17 Marcus Schaefer 2007-10-04 14:10:47 UTC
fixed in v1.65
Comment 18 Jiří Suchomel 2007-10-04 14:13:38 UTC
Thanks!