Skip to content
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

Package crashes if there is no permission to create the cache directory. #906

Closed
mfeurer opened this issue Apr 9, 2020 · 3 comments · Fixed by #987
Closed

Package crashes if there is no permission to create the cache directory. #906

mfeurer opened this issue Apr 9, 2020 · 3 comments · Fixed by #987
Assignees

Comments

@mfeurer
Copy link
Collaborator

mfeurer commented Apr 9, 2020

When trying to set the cache directory to a directory which exists, but where the directory it resides in does not allow the creation of a new directory, the package erroneously crashes:

Traceback (most recent call last):
  File "01_create_commands.py", line 6, in <module>
    from update_metadata_util import classification_tasks, regression_tasks
  File "/tmp/auto-sklearn/scripts/update_metadata_util.py", line 2, in <module>
    import openml
  File "/home/feurerm/miniconda/3-4.5.4/envs/autosklearnmetadata/lib/python3.7/site-packages/openml/__init__.py", line 20, in <module>
    from . import _api_calls
  File "/home/feurerm/miniconda/3-4.5.4/envs/autosklearnmetadata/lib/python3.7/site-packages/openml/_api_calls.py", line 10, in <module>
    from . import config
  File "/home/feurerm/miniconda/3-4.5.4/envs/autosklearnmetadata/lib/python3.7/site-packages/openml/config.py", line 244, in <module>
    _setup()
  File "/home/feurerm/miniconda/3-4.5.4/envs/autosklearnmetadata/lib/python3.7/site-packages/openml/config.py", line 150, in _setup
    os.mkdir(cache_directory)
PermissionError: [Errno 13] Permission denied: '/data/aad/openml/'

The directory is:

ls -al /data/aad
total 50127952
drwxr-sr-x  27 other     other        4096 Mär 10 10:58 .
drwxr-xr-x   3 root    root               0 Apr  9 09:42 ..
drwxr-xr-x   8 feurerm other        4096 Apr  8 13:24 openml
@PGijsbers
Copy link
Collaborator

Is this something we want to support? Or do you just want the user to have a better prompt that tells them to set write access to the cache directory?

@mfeurer
Copy link
Collaborator Author

mfeurer commented Apr 20, 2020

I would prefer supporting this. This happened on our local cluster, where I can't get write access to the directory the cache directory is in (opposed to your comment, this is about the directory the cache directory is in, not about the cache directory).

@PGijsbers
Copy link
Collaborator

I couldn't find a reason that the PermissionError is raised over the FileExistsError, but it probably has to do with the OS checking in that order, which would make sense (so as not to leak information). I think checking before had (if not file exists) instead of asking for forgiveness (try:... except FileNotExists:...) should be enough to circumvent this. As long as we can write in the cache directory I don't foresee any issues.

@mfeurer mfeurer self-assigned this Oct 26, 2020
mfeurer added a commit that referenced this issue Oct 30, 2020
mfeurer added a commit that referenced this issue Jan 28, 2021
PGijsbers pushed a commit that referenced this issue Feb 10, 2021
* Fix #883 #884 #906 #972

* Address Mitar's comments

* rework for Windows/OSX, some mypy pleasing due to pre-commit

* type fixes and removing unused code
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 a pull request may close this issue.

2 participants