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 documentation for get_artifact_path #768

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Artifact
:nosignatures:

optuna_dashboard.artifact.upload_artifact
optuna_dashboard.artifact.get_artifact_path
optuna_dashboard.artifact.file_system.FileSystemBackend
optuna_dashboard.artifact.boto3.Boto3Backend
optuna_dashboard.artifact.backoff.Backoff
Expand Down
13 changes: 12 additions & 1 deletion optuna_dashboard/artifact/_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,18 @@ def get_artifact_path(
study_or_trial: optuna.Trial | optuna.Study,
artifact_id: str,
) -> str:
"""Get the URL path for a given artifact ID."""
"""Get the URL path for a given artifact ID.

Args:
study_or_trial:
A Trial object, or a Study object.

artifact_id:
An artifact ID.

Returns:
A URL path to the artifact.
"""
if isinstance(study_or_trial, optuna.Study):
study_id = study_or_trial._study_id
return f"/artifacts/{study_id}/{artifact_id}"
Expand Down
Loading