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 endpoint for fetching url link #728

Merged
merged 1 commit into from
Jul 28, 2023
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
4 changes: 3 additions & 1 deletion dataquality/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"""


__version__ = "0.10.0"
__version__ = "0.10.1"

import sys
from typing import Any, List, Optional
Expand Down Expand Up @@ -62,6 +62,7 @@
get_current_run_labels,
get_data_logger,
get_model_logger,
get_run_link,
log_data_sample,
log_data_samples,
log_dataset,
Expand Down Expand Up @@ -108,6 +109,7 @@
"get_current_run_labels",
"get_data_logger",
"get_model_logger",
"get_run_link",
"set_tasks_for_run",
"set_tagging_schema",
"docs",
Expand Down
10 changes: 10 additions & 0 deletions dataquality/clients/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,16 @@ def get_run_status(
job = self.make_request(RequestType.GET, job_url)
return job or {}

def get_run_link(
self, project_name: Optional[str] = None, run_name: Optional[str] = None
) -> str:
pid, rid = self._get_project_run_id(
project_name=project_name, run_name=run_name
)
link_url = f"{config.api_url}/{Route.content_path(pid, rid)}/{Route.link}"
link_data = self.make_request(RequestType.GET, link_url)
return link_data["link"]

def wait_for_run(
self, project_name: Optional[str] = None, run_name: Optional[str] = None
) -> None:
Expand Down
8 changes: 8 additions & 0 deletions dataquality/core/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,3 +635,11 @@ def set_tokenizer(tokenizer: PreTrainedTokenizerFast) -> None:
seq2seq_logger_config.tokenizer = tokenizer
# Seq2Seq doesn't have labels but we need to set this to avoid validation errors
seq2seq_logger_config.labels = []


@check_noop
def get_run_link(
project_name: Optional[str] = None, run_name: Optional[str] = None
) -> str:
"""Gets the link to the run in the UI"""
return ApiClient().get_run_link(project_name=project_name, run_name=run_name)
1 change: 1 addition & 0 deletions dataquality/schemas/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Route(str, Enum):
notify = "notify/email"
token = "get-token"
upload_file = "upload_file"
link = "link"

@staticmethod
def content_path(
Expand Down