[packagekit] Yum backend throttling

Robin Norwood rnorwood at redhat.com
Thu Sep 27 07:23:47 PDT 2007


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."

Also this would only set the initial throttle...if you want dynamic
throttling, you have to set it per-repo.  Patch coming soon.

-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