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

Fix CachedStorage skipping trial param row insertion on cache miss. #1498

Merged
merged 2 commits into from Jul 13, 2020

Conversation

hvy
Copy link
Member

@hvy hvy commented Jul 9, 2020

Motivation

Fixes #1488 (comment).

Description of the changes

Makes sure parameters are flushed/committed even for the first trial that is a "cache miss".

Note

This is only an issue for the first trial in a distributed environment/continuing optimization on an already started/finished study.

@hvy hvy added the bug Issue/PR about behavior that is broken. Not for typos/examples/CI/test but for Optuna itself. label Jul 9, 2020
@ytsmiling
Copy link
Member

Thank you for creating this PR.
I think the addition in the check_or_set_param_distribution. Otherwise, when many workers try to add a new parameter with conflicting distributions, they can pass the check_param_distribution.

@hvy
Copy link
Member Author

hvy commented Jul 9, 2020

Ah, right. You mean that we must insert after checking for compatibility to let the other workers know. Thanks.

@hvy
Copy link
Member Author

hvy commented Jul 9, 2020

PTAL.

Copy link
Member

@ytsmiling ytsmiling left a comment

Choose a reason for hiding this comment

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

Thank you for the quick fix. LGTM!

Copy link
Member

@HideakiImamura HideakiImamura left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I confirmed that non recorded trials do not emerge on my local MySQL server. The validation script is that given by @nandnor93 in #1488 (comment). (Thanks @nandnor93!) LGTM!

Copy link
Member

@toshihikoyanase toshihikoyanase left a comment

Choose a reason for hiding this comment

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

I also confirmed that this implementation correctly works with PostgreSQL. LGTM!

@toshihikoyanase toshihikoyanase added this to the v2.0.0 milestone Jul 13, 2020
@toshihikoyanase toshihikoyanase merged commit 6c74908 into optuna:master Jul 13, 2020
@hvy hvy deleted the fix-cached-storage-param-insertion branch July 13, 2020 01:35
@toshihikoyanase toshihikoyanase added the optuna.storages Related to the `optuna.storages` submodule. This is automatically labeled by github-actions. label Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue/PR about behavior that is broken. Not for typos/examples/CI/test but for Optuna itself. optuna.storages Related to the `optuna.storages` submodule. This is automatically labeled by github-actions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate trial numbers on distributed optimization
4 participants