This repository was archived by the owner on Mar 15, 2025. It is now read-only.
Primarily updates to add parameters which improve performance.#68
Open
slootsky wants to merge 1 commit into
Open
Primarily updates to add parameters which improve performance.#68slootsky wants to merge 1 commit into
slootsky wants to merge 1 commit into
Conversation
I have been using the following parameters: --chunk_size 16k --write-buffer 1G --timeout 30
sparr
reviewed
Jul 27, 2024
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]) |
Contributor
There was a problem hiding this comment.
https://pypi.org/project/humanfriendly/ is a library option for this functionality
sparr
reviewed
Jul 27, 2024
| ) | ||
| parser.add_argument( | ||
| '-b', '--write-buffer', | ||
| type=str, default=1024*1024, |
Contributor
There was a problem hiding this comment.
Why is this the only argument with a default set here while all the others are set in the download_library.py init?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have been using the following parameters:
--chunk_size 16k
--write-buffer 1G
--timeout 30