[packagekit] Yum backend throttling

Tim Lauridsen tla at rasmil.dk
Thu Sep 27 08:52:29 PDT 2007


Robin Norwood wrote:
> Robin Norwood <rnorwood at redhat.com> writes:
>
>   
>> Tim Lauridsen <tla at rasmil.dk> writes:
>>
>>     
>>> Richard Hughes wrote:
>>>       
>>>> skvidal mentions we can throttle the download:
>>>> http://hughsient.livejournal.com/38322.html?thread=303794
>>>>         
>>> I have can be done very easy in the yum backend.
>>> See attached patch.
>>>       
>> Have you tested this?  I don't think it's quite right.  According to the
>> urlgrabber docs: "if it's an int, it's the bytes/second throttle limit.
>> If it's a float, it is first multiplied by bandwidth."
>>     
>
> Sorry, I meant to include the url:
>
> http://linux.duke.edu/projects/urlgrabber/help/urlgrabber.grabber.html
>
> And, it looks to me like the value in yumbase.conf.throttle is inherited
> by the repos and passed directly to UrlGrabber.
>
>   
>> Also this would only set the initial throttle...if you want dynamic
>> throttling, you have to set it per-repo.  Patch coming soon.
>>     
>
> This is my attempt:
>
>   
> ------------------------------------------------------------------------
>
>
> This just sets the throttle in the yum backend.  I haven't yet gotten
> the set_throttle_percent call up into the rest of PK, assuming we want
> it, and assuming we want to call it 'set_throttle_percent'.
>
> Thoughts?
>
> -RN
>
>>> >From 1f9875c2f4426362dd9d60928742575f525d76cb Mon Sep 17 00:00:00 2001
>>> From: Tim Lauridsen <tla at rasmil.dk>
>>> Date: Thu, 27 Sep 2007 09:26:40 +0200
>>> Subject: [PATCH] Add bandwith throttling to yum backend
>>>
>>> ---
>>>  backends/yum/helpers/yumBackend.py |    1 +
>>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
>>> index ea670fa..b65468d 100644
>>> --- a/backends/yum/helpers/yumBackend.py
>>> +++ b/backends/yum/helpers/yumBackend.py
>>> @@ -409,6 +409,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
>>>                                                                                                 
>>>      def _setup_yum(self):
>>>          self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0) # Setup Yum Config
>>> +        self.yumbase.conf.throttle = "40%"    # Set bandwidth throttle to 40%
>>>          self.dnlCallback = DownloadCallback(self,showNames=True)      # Download callback
>>>          self.yumbase.repos.setProgressBar( self.dnlCallback )         # Setup the download callback class
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> PackageKit mailing list
> PackageKit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/packagekit
No conversion is needed, the self.yumbase.conf is a special class with 
getter & setter to set differnt kind of option of different speciel type
The class does the convertion.
self.yumbase.conf.throttle is a special throttle option there take a lot 
of differnt values and parse them into something urlgrabber understands.
See details here (trottle option).
http://devel.linux.duke.edu/gitweb/?p=yum.git;a=blob;f=yum/config.py

So the

self.yumbase.conf.throttle = "40%" 

should work right.

the repos inherit the throttle from self.yumbase.conf.throttle, so there 
should be no need to specify it on each repo object, if we just set the 
base throttle before the repos is initialized.

Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/packagekit/attachments/20070927/629a41d8/attachment-0003.htm>


More information about the PackageKit mailing list