Skip to content

Commit

Permalink
Chore: Add endpoint for fetching url link (#728)
Browse files Browse the repository at this point in the history
  • Loading branch information
Elliott authored Jul 28, 2023
1 parent b78fc3d commit 6e303bc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
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

0 comments on commit 6e303bc

Please sign in to comment.