Skip to content

Conversation

@mfeurer
Copy link
Collaborator

@mfeurer mfeurer commented Oct 30, 2020

Closes #883 #884 #906 #972

What does this PR implement/fix? Explain your changes.

How should this PR be tested?

Unit tests.

Any other comments?

@mitar does this resolve the issues you had with the package?

@PhMueller does this help you using OpenML inside HPOlib?

openml/config.py Outdated
try:
os.mkdir(expanded_openml_dir)
except PermissionError:
warnings.warn(
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer using logging module here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I updated the code to use logging instead of warnings.

openml/utils.py Outdated
os.makedirs(cache_dir, exist_ok=True)
except Exception as e:
raise openml.exceptions.OpenMLCacheException(
f"Cannot create cache directory {cache_dir} due to exception {e}"
Copy link
Member

Choose a reason for hiding this comment

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

You do not need to have due to exception {e} because you have from e later on.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, makes sense.

@mitar
Copy link
Member

mitar commented Oct 30, 2020

Not fully. My main issue is that OpenML initializes stuff at package import and not on first use. So people who would not even use OpenML codepath in our package (which depends on openml) get an exception (or with this PR a warning).

I do not think you should be calling in config.py:

_setup()
_create_log_handlers()

You should call those at first call which requires any of those. See:

log_path = os.path.join(cache_directory, "openml_python.log")

If cache directory is not writable, this will fail, no? And it is called from _create_log_handlers(), always, for everyone.

@mitar
Copy link
Member

mitar commented Oct 30, 2020

For reference, current patch we are using: https://gitlab.com/datadrivendiscovery/images/-/blob/master/libs/patches/openml.patch

@PhMueller
Copy link

@mfeurer: Thanks for the notification. Looks fine by me.

@joaquinvanschoren
Copy link
Contributor

@mfeurer Would you have time to look at this or should we ask someone else?

@mfeurer
Copy link
Collaborator Author

mfeurer commented Dec 15, 2020

Alright, thanks for your suggestions @mitar. I tried to incorporate them as much as possible, but I'm afraid I didn't do all you asked for.

Not fully. My main issue is that OpenML initializes stuff at package import and not on first use. So people who would not even use OpenML codepath in our package (which depends on openml) get an exception (or with this PR a warning).

I agree that this might be nicer. On the other hand, I think the current solution is more in the spirit of 'fail fast' and gives a warning as quickly as possible. In any case, I currently don't have the time to work on this, wouldn't know how to achieves this and think the changes in this PR cover most use cases and issues and will for now leave it is at is (unless there's an issue with my recent changes).

If cache directory is not writable, this will fail, no? And it is called from _create_log_handlers(), always, for everyone.

I made this conditional on the cache directory being writable, so there shouldn't be any failure from this.

Tests might fail because the server is very flaky at the moment, so we probably have to rebase this on #1000 and rerun.

@mfeurer mfeurer force-pushed the fix_883_884_906_972 branch from 783a756 to d58bfa5 Compare January 28, 2021 19:44
@mfeurer
Copy link
Collaborator Author

mfeurer commented Jan 29, 2021

@PGijsbers do you think you could have a look at the Windows failures? I believe it'll be much easier to debug for you on a Windows machine than for me by pushing to github

Copy link
Member

@mitar mitar left a comment

Choose a reason for hiding this comment

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

Thanks. This looks great now.

@PGijsbers PGijsbers merged commit 47cda65 into develop Feb 10, 2021
@PGijsbers PGijsbers deleted the fix_883_884_906_972 branch February 10, 2021 14:33
@PGijsbers PGijsbers mentioned this pull request Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

6 participants