[Yum-devel] error on grabber.py documentation
Albert Lozano
buitrenca at gmail.com
Thu Mar 6 13:15:02 UTC 2008
Hello,
I am a newbie so I do not know whether this is a silly issue, but I
guess I have found a minor error on this documentation.
I think there are some mistakes using set_banwidth and set_throttle, concretly:
*) set_throttle(6250000); set_throttle(1.0) # float
I guess should be set_bandwidth(6250000); set_throttle(1.0)
*) set_throttle(6250000); set_throttle(2.0) # float
I guess should be set_bandwidth(6250000); set_throttle(2.0)
*) set_throttle(6250000); set_throttle(0) # throttle = 0
I guess means set_banwidth(6250000); set_throttle(0)
*) set_throttle(0); set_throttle(1.0) # throttle is float, bandwidth = 0
I guess means set_bandwidth(0); set_throttle(1.0)
If I am wrong could somebody explain why ? because I do not get the
point of use two times set_throttle?
thanks
BANDWIDTH THROTTLING
urlgrabber supports throttling via two values: throttle and
bandwidth Between the two, you can either specify and absolute
throttle threshold or specify a theshold as a fraction of maximum
available bandwidth.
throttle is a number - if it's an int, it's the bytes/second
throttle limit. If it's a float, it is first multiplied by
bandwidth. If throttle == 0, throttling is disabled. If None, the
module-level default (which can be set with set_throttle) is used.
bandwidth is the nominal max bandwidth in bytes/second. If throttle
is a float and bandwidth == 0, throttling is disabled. If None, the
module-level default (which can be set with set_bandwidth) is used.
THROTTLING EXAMPLES:
Lets say you have a 100 Mbps connection. This is (about) 10^8 bits
per second, or 12,500,000 Bytes per second. You have a number of
throttling options:
*) set_bandwidth(12500000); set_throttle(0.5) # throttle is a float
This will limit urlgrab to use half of your available bandwidth.
*) set_throttle(6250000) # throttle is an int
This will also limit urlgrab to use half of your available
bandwidth, regardless of what bandwidth is set to.
*) set_throttle(6250000); set_throttle(1.0) # float
Use half your bandwidth
*) set_throttle(6250000); set_throttle(2.0) # float
Use up to 12,500,000 Bytes per second (your nominal max bandwidth)
*) set_throttle(6250000); set_throttle(0) # throttle = 0
Disable throttling - this is more efficient than a very large
throttle setting.
*) set_throttle(0); set_throttle(1.0) # throttle is float, bandwidth = 0
Disable throttling - this is the default when the module is loaded.
SUGGESTED AUTHOR IMPLEMENTATION (THROTTLING)
While this is flexible, it's not extremely obvious to the user. I
suggest you implement a float throttle as a percent to make the
distinction between absolute and relative throttling very explicit.
Also, you may want to convert the units to something more convenient
than bytes/second, such as kbps or kB/s, etc.
"""
More information about the Yum-devel
mailing list