Add download callback to ClimaArtifactsHelper #76
+74
−16
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.
There are two callbacks in this PR. The first only prints the download progress, while the other also prints the download rate.
For both, total size is printed as MB as an int if it is less than 1 GB, and GB with 2 decimal places otherwise. The same applies to dowloaded size and download rate.
The second callback is created with the function
create_download_rate_callback
which returnsa function. The callback calculates the
download rate over an interval, and prints the result at the end of
the interval. It also prints download progress. This callback
uses a closure to keep track of the time and bytes downloaded
at the end of the previous interval. If this callback is good,
then we can probably remove
download_progress_callback
from this PR.I considered creating a wrapper for the download function, which would take in the file url and file name, and use the callback while downloading it, and then change the file name. This seems like it might be excessive. Thoughts?
Should I go through the existing artifacts and add the callback to the create_artifact.jl scripts?
Closes #68