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

Add upload study artifact api #674

Merged
merged 10 commits into from
Nov 23, 2023

Conversation

gen740
Copy link
Member

@gen740 gen740 commented Oct 27, 2023

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

None.

What does this implement/fix? Explain your changes.

  • Add the upload_study_artifact api.
  • Add the study artifact cards in the StudyHistory page.
スクリーンショット 2023-10-27 17 36 02 スクリーンショット 2023-10-27 17 36 07

@HideakiImamura HideakiImamura self-assigned this Oct 27, 2023
@HideakiImamura
Copy link
Member

Let me read this PR for my study. I will not merge the PR with my approval.

@keisuke-umezawa keisuke-umezawa self-assigned this Nov 1, 2023
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 have some early comments. PTAL.

optuna_dashboard/artifact/_backend.py Show resolved Hide resolved
optuna_dashboard/artifact/_backend.py Show resolved Hide resolved
Copy link

codecov bot commented Nov 2, 2023

Codecov Report

Attention: 24 lines in your changes are missing coverage. Please review.

Comparison is base (0755902) 62.88% compared to head (68e181e) 63.42%.
Report is 11 commits behind head on main.

Files Patch % Lines
optuna_dashboard/artifact/_backend.py 29.41% 24 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #674      +/-   ##
==========================================
+ Coverage   62.88%   63.42%   +0.53%     
==========================================
  Files          35       35              
  Lines        2250     2280      +30     
==========================================
+ Hits         1415     1446      +31     
+ Misses        835      834       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@keisuke-umezawa keisuke-umezawa left a comment

Choose a reason for hiding this comment

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

Sorry for being late. I just checked python API part, and left comments. Regarding python API parts, it looks almost good to me other than my comments.
If you divide this PR into python API change and adding new UI, I can merge the PR for python API change immediately.

return {"reason": "Cannot access to the artifacts."}
artifact_store.remove(artifact_id)

# The artifact's metadata is stored in one of the following two locations:
Copy link
Member

Choose a reason for hiding this comment

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

[question] As study artifact is introduced in this PR, the metadata is always stored in ARTIFACTS_ATTR_PREFIX + artifact_id?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this behavior is the same as optuna/artifacts/_upload.py

Copy link
Member

Choose a reason for hiding this comment

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

In that case, can we remove those lines?

storage.set_study_system_attr(
            study_id, _dashboard_artifact_prefix(study_id) + artifact_id, json.dumps(None)
        )

Copy link
Member Author

Choose a reason for hiding this comment

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

It sounds good. I think I can remove that line from delete_study_artifact. However, I would not remove it from delete_trial_artifact due to backward compatibility.

optuna_dashboard/artifact/_backend.py Show resolved Hide resolved
@keisuke-umezawa
Copy link
Member

It is not relevant to this PR, but should we also need to delete meta data in delete_all_artifacts?

@keisuke-umezawa
Copy link
Member

Also, it is not relevant to this PR or optunda-dashboard, but should we prepare API for deleting data and meta together like delete_artifact similar to upload_artifact in optuna itself?

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 update. I added some additional comments. PTAL

@keisuke-umezawa
Copy link
Member

I checked ui side and as a code, looks almost good to me. However, in my environment, I can only see blank study artifact without uploader. What should I do to show uploader?
スクリーンショット 2023-11-12 16 24 52

@gen740
Copy link
Member Author

gen740 commented Nov 17, 2023

However, in my environment, I can only see a blank study artifact without an uploader.

Good catch, that's because you did not pass the artifact_store instance to run_server (e.g., run_server(storage, artifact_store=artifact_store)).
Anyway, this is a bug because it should not appear when artifact_store isn't passed. Thanks!

Copy link
Member

@keisuke-umezawa keisuke-umezawa left a comment

Choose a reason for hiding this comment

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

LGTM!
Thank you for working on it.

@keisuke-umezawa keisuke-umezawa merged commit f3fda8f into optuna:main Nov 23, 2023
17 checks passed
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.

3 participants