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

Avoid to call deprecated system_attrs property #311

Merged
merged 1 commit into from
Dec 12, 2022

Conversation

c-bata
Copy link
Member

@c-bata c-bata commented Dec 12, 2022

Contributor License Agreement

This repository (optuna-dashboard) and Goptuna share common code.
This pull request may therefore be ported to Goptuna.
Make sure that you understand the consequences concerning licenses and check the box below if you accept the term before creating this pull request.

  • I agree this patch may be ported to Goptuna by other Goptuna contributors.

Reference Issues/PRs

Refs optuna/optuna#4188

What does this implement/fix? Explain your changes.

Avoid to use set_system_attrs method and system_attrs property since they will be deprecated.

@@ -105,7 +105,7 @@ def serialize_frozen_trial(study_id: int, trial: FrozenTrial) -> Dict[str, Any]:
"state": trial.state.name.capitalize(),
"params": [{"name": name, "value": str(value)} for name, value in trial.params.items()],
"user_attrs": serialize_attrs(trial.user_attrs),
"system_attrs": serialize_attrs(trial.system_attrs),
"system_attrs": serialize_attrs(getattr(trial, "_system_attrs", {})),
Copy link
Member Author

@c-bata c-bata Dec 12, 2022

Choose a reason for hiding this comment

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

Use getattr here since trial._system_attrs is a private attribute.

Copy link
Member

Choose a reason for hiding this comment

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

LGTM!

@c-bata c-bata merged commit 24b9413 into optuna:main Dec 12, 2022
@c-bata c-bata deleted the deprecate-system-attrs-property branch December 12, 2022 05:21
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 this pull request may close these issues.

None yet

2 participants