Skip to content

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

Closed

Description

@mfeurer

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

Activity

  1. PGijsbers commented on Apr 20, 2020

    @PGijsbers
    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?

  2. mfeurer commented on Apr 20, 2020

    @mfeurer
    CollaboratorAuthor

    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).

  3. PGijsbers commented on Apr 20, 2020

    @PGijsbers
    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.

  4. self-assigned this
    on Oct 26, 2020
  5. added a commit that references this issue on Oct 30, 2020
  6. added a commit that references this issue on Jan 28, 2021
  7. added a commit that references this issue on Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions