Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Primarily updates to add parameters which improve performance. #68

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

slootsky
Copy link

I have been using the following parameters:
--chunk_size 16k
--write-buffer 1G
--timeout 30

I have been using the following parameters:
--chunk_size 16k
--write-buffer 1G
--timeout 30
Comment on lines +17 to +49
# convert a string representing size to an integer
def parse_size(size):
# Base10 unit definitions
# K=x1000 M=x10000000 G=x1000000000
# units = {"K": 10**3, "M": 10**6, "G": 10**9, "T": 10**12}
# Binary unit definitions:
# K=x1024 M=x1024x1024 etc
units = {"K": 2**10, "M": 2**20, "G": 2**30, "T": 2**40}
try:
return int(size) # if it's an int already just return it
except ValueError: # it wasn't an int
size=size.upper()
if size.endswith('B'):
return parse_size(size[:-1])
unit=size[-1:]
number=size[:-1]
if unit not in units.keys():
raise ValueError(f'Invalid Unit: {unit}')
return int(float(number)*units[unit])

# convert a string represting time to an integer number of seconds
def parse_seconds(size):
# convert parameter to number of seconds
units = {"S": 1, "M": 60, "H": 60*60, "D": 60*60*24, 'W': 60*60*24*7}
try:
return int(size) # if it's an int already just return it
except ValueError: # it wasn't an int
size=size.upper()
unit=size[-1:]
number=size[:-1]
if unit not in units.keys():
raise ValueError(f'Invalid Unit: {unit}')
return int(float(number)*units[unit])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://pypi.org/project/humanfriendly/ is a library option for this functionality

@@ -73,6 +108,32 @@ def parse_args(args):
help=("The purchase download key. Find in the url on the "
"products/bundle download page. Can set multiple"),
)
parser.add_argument(
'-b', '--write-buffer',
type=str, default=1024*1024,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this the only argument with a default set here while all the others are set in the download_library.py init?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants