question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

download_files_in_parallel with cache=False doesn't work on Windows

See original GitHub issue

In #6658 I had problems locally with cache=False. For example:

from astropy.utils.data import download_files_in_parallel
import os
dwn = download_files_in_parallel(['http://www.google.de', 'http://www.wikipedia.org'])
assert all([os.path.isfile(f) for f in dwn]), dwn

This fails locally - while it works if one just adds cache=True:

from astropy.utils.data import download_files_in_parallel
import os
dwn = download_files_in_parallel(['http://www.google.de', 'http://www.wikipedia.org'], cache=True)
assert all([os.path.isfile(f) for f in dwn]), dwn

Could be a Windows-thing with subprocesses that remove temp-files created upon exit. But I don’t have the experience to make more than guesses. Would be interesting to know if that’s a fundamental problem with that function or just a Windows thing.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:22 (22 by maintainers)

github_iconTop GitHub Comments

3reactions
pllimcommented, Oct 5, 2017

could you check if the exit handler is called when the sub-processes terminate ?

Yes. On Windows, with cache=False, when I insert a print statement right before os.remove there, I see both downloaded files deleted (even before the progress bar reports that download is finished).

When cache=True, it is still called but nothing is done because _tempfilestodel is an empty list.

Maybe this is beyond our control and we should just document this behavior in the API?

1reaction
MSeifert04commented, Oct 5, 2017

Well it uses multiprocessing to download the files. Probably uses separate processes that clean up the files on Windows and ones that share the temp-files with the main process on *NIX systems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Internet Explorer file downloads over SSL do not work with the ...
This issue occurs if the server sends a "Cache-control:no-store" header or sends a "Cache-control:no-cache" header. Resolution. Important This section, method, ...
Read more >
Caching in GitLab CI/CD
A cache is one or more files a job downloads and saves. Subsequent jobs that use the same cache don't have to download...
Read more >
Caching dependencies to speed up workflows - GitHub Docs
Use caching when you want to reuse files that don't change often between jobs or workflow runs, such as build dependencies from a...
Read more >
Download multiple files with a single action - Stack Overflow
I am working with many file types, including pictures, and this worked best for me. However, link.setAttribute('download', null); renamed all my files to...
Read more >
Build Cache - Gradle User Manual
The Gradle build cache is a cache mechanism that aims to save time by reusing outputs produced by other builds. The build cache...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found