-
Notifications
You must be signed in to change notification settings - Fork 44
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
Use urllib2 rather than curl to download #1
Comments
We now validate the archives, so there should be no more problems. It'd be nice to use |
I disagree on several counts. First, I think this is a real problem:
"not a valid archive" is not a very helpful message when the file doesn't exist in the first place. Using urllib2 will be much better for creating helpful error messages (404 vs. access denied vs. got a file but it is not an archive). And, most of the complexity in what you posted is already there in It's really just the progress meter that's additional (and if that goes wrong it's not that bad). Finally, we definitely want to do this for Windows, so we may as well start to iron out the bugs. |
conda has (better) code for this in conda/remote.py as well (though the progress meter itself is some other place) |
(I meant better than the stackoverflow link.) |
Ok, good points. I can work on this. |
Here is a minimal example of a progress bar:
So we just need to adapt this to make it work with our logging system and we are good. |
Yes. I think you simply have
Oh, and 10% of the job is pretty-printing number of bytes downloaded so far and total as 'KB', 'MB', and so on. (Or, I guess always using 'MB' isn't too bad) |
Ok, most of this is fixed, the rest of this is in #81. |
In 02b8ed8, changed from urllib2 to shelling out to curl for downloading in order to get nice statistics, progress etc. This should be switched back:
The relevant code is in
SourceCache._download_and_hash
When an error happens (404 or similar) one should first log the error, then re-raise the exception (see #29),
Just switching it over to urllib2 is easy, the problem is that when downloading a huge file one should probably update a progress meter (something like "34% (4 MB of 100 MB)"). To integrate a progress meter:
In hashdist/hashdist_logging.py, add a "start_progress(msg)", "update_progress(percentage)", "stop_progress" methods. The former sets "self.progress_msg", while update_progress prints "\r{self.progress_msg}{percentage-message}", and the latter just emits "done\n" instead of {percentage-message}.
BUT, the progress meter should not be dumped to backing log files ("raw streams"), then only the start/end messages and no "\r" characters should be emitted.
The text was updated successfully, but these errors were encountered: