Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX: fetch covtype dataset concurrent-safe - #23113

Merged
jeremiedbb merged 3 commits into
scikit-learn:mainfrom
iasoon:covtype-concurrent-safe
Apr 19, 2022
Merged

FIX: fetch covtype dataset concurrent-safe#23113
jeremiedbb merged 3 commits into
scikit-learn:mainfrom
iasoon:covtype-concurrent-safe

Conversation

@iasoon

@iasoon iasoon commented Apr 11, 2022

Copy link
Copy Markdown
Contributor

Reference Issues/PRs

Fixes #23048.

What does this implement/fix? Explain your changes.

When fetching the dataset, write the data files to a temporary first, then atomically rename to their target location. (similar to #21833)
This approach avoids trouble with concurrent runs and partially written data.

Any other comments?

It looks like most dataset fetchers don't currently implement a mechanism like this. Would it be worthwhile to apply the same procedure to the others? If so, would separate PRs be prefered or do I tack it on to this one?

@ogrisel ogrisel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change LGTM. Could you please document the fix in doc/whats_new/v1.1.rst?

Comment thread sklearn/datasets/_covtype.py Outdated
@iasoon

iasoon commented Apr 12, 2022

Copy link
Copy Markdown
Contributor Author

Done!

@ogrisel ogrisel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

I tested it successfully with concurrent workers:

Parallel(n_jobs=4)(delayed(fetch_covtype)() for _ in range(10))

after having deleted by $HOME/scikit_learn_data folder and everything is fine.

@jeremiedbb jeremiedbb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @iasoon !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Covtype dataset raises error when fetching

3 participants