Skip to content

[MRG+1] LFW dataset: download archive to temporary directory - #6112

Merged
amueller merged 1 commit into
scikit-learn:masterfrom
toastedcornflakes:master
Oct 11, 2016
Merged

amueller merged 1 commit into
scikit-learn:masterfrom
toastedcornflakes:master

Conversation

@toastedcornflakes

Copy link
Copy Markdown
Contributor

This PR moves the archive download of the LFW dataset to a temporary directory. When the download is interrupted you'd have to delete the file by hand to let the download complete. This is no longer necessary.

To keep things simple this PR doesn't handle cleaning when python is interrupted by a signal, since its pretty cumbersome. Thus it leaves a temporary directory with a partial file on disk.

Is this behavior OK?

Another option would be to replace the calls to urllib.urlretrieve() by a function which downloads the file to a temporary directory and moves it in place only if the download succeeded. This function would also handle the signals.

@amueller

amueller commented Feb 9, 2016

Copy link
Copy Markdown
Member

couldn't we continue the download? Also, it would be great to do this consistently for all datasets we fetch.

@toastedcornflakes

Copy link
Copy Markdown
Contributor Author

It appears to be possible using the Range HTTP header. I'll try to work on this, check if it works and how it's applicable to the other datasets.

@toastedcornflakes

Copy link
Copy Markdown
Contributor Author

The patch is now using urllib built-in capabilities: the file is downloaded again only if its size is different from the Content-Length header, or if it's out-of-date.

@toastedcornflakes

Copy link
Copy Markdown
Contributor Author

@amueller Is this patch OK? What can I improve?

@agramfort

Copy link
Copy Markdown
Member

LGTM

@toastedcornflakes

Copy link
Copy Markdown
Contributor Author

Ping 😃

@agramfort agramfort changed the title LFW dataset: download archive to temporary directory [MRG+1] LFW dataset: download archive to temporary directory Jun 13, 2016
@amueller

Copy link
Copy Markdown
Member

thanks

@amueller
amueller merged commit 2b0439c into scikit-learn:master Oct 11, 2016
amueller pushed a commit to amueller/scikit-learn that referenced this pull request Oct 14, 2016
Sundrique pushed a commit to Sundrique/scikit-learn that referenced this pull request Jun 14, 2017
paulha pushed a commit to paulha/scikit-learn that referenced this pull request Aug 19, 2017
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.

3 participants