[packagekit] Yum backend throttling

Robin Norwood rnorwood at redhat.com
Thu Sep 27 08:00:49 PDT 2007


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:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: python-backend-set-throttle.patch
Type: text/x-patch
Size: 2714 bytes
Desc: Patch to set the throttle in yum backend
URL: <http://lists.freedesktop.org/archives/packagekit/attachments/20070927/0da4fcb4/attachment-0004.bin>
-------------- next part --------------

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

-- 
Robin Norwood
Red Hat, Inc.

"The Sage does nothing, yet nothing remains undone."
-Lao Tzu, Te Tao Ching


More information about the PackageKit mailing list