-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ms/check_batch-backoff
- Loading branch information
Showing
21 changed files
with
398 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,15 +11,15 @@ pattern = "default-unprefixed" | |
[tool.poetry.dependencies] | ||
python = "^3.9" | ||
|
||
neptune-api = "^0.9.0" | ||
neptune-api = "^0.10.0" | ||
more-itertools = "^10.0.0" | ||
psutil = "^5.0.0" | ||
backoff = "^2.0.0" | ||
|
||
[tool.poetry] | ||
name = "neptune-scale" | ||
version = "0.1.0" | ||
description = "A minimal client library" | ||
description = "Python logging API for Neptune Scale" | ||
authors = ["neptune.ai <[email protected]>"] | ||
repository = "https://github.com/neptune-ai/neptune-client-scale" | ||
readme = "README.md" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ | |
"NeptuneAsyncLagThresholdExceeded", | ||
"NeptuneProjectNotProvided", | ||
"NeptuneApiTokenNotProvided", | ||
"NeptuneTooManyRequestsResponseError", | ||
) | ||
|
||
from typing import Any | ||
|
@@ -191,6 +192,15 @@ class NeptuneUnexpectedResponseError(NeptuneRetryableError): | |
""" | ||
|
||
|
||
class NeptuneTooManyRequestsResponseError(NeptuneRetryableError): | ||
message = """ | ||
{h1} | ||
NeptuneTooManyRequestsResponseError: The Neptune server reported receiving too many requests. | ||
{end} | ||
This is a temporary problem. If the problem persists, please contact us at [email protected]. | ||
""" | ||
|
||
|
||
class NeptuneInternalServerError(NeptuneRetryableError): | ||
message = """ | ||
{h1} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from typing import Optional | ||
|
||
from neptune_retrieval_api.models import SearchLeaderboardEntriesParamsDTO | ||
|
||
from neptune_scale.exceptions import NeptuneScaleError | ||
from neptune_scale.net.api_client import HostedApiClient | ||
from neptune_scale.net.util import escape_nql_criterion | ||
from neptune_scale.sync.util import ensure_api_token | ||
|
||
|
||
def run_exists(project: str, run_id: str, api_token: Optional[str] = None) -> bool: | ||
"""Query the backend for the existence of a Run with the given ID. | ||
Returns True if the Run exists, False otherwise. | ||
""" | ||
|
||
client = HostedApiClient(api_token=ensure_api_token(api_token)) | ||
body = SearchLeaderboardEntriesParamsDTO.from_dict( | ||
{ | ||
"query": {"query": f'`sys/custom_run_id`:string = "{escape_nql_criterion(run_id)}"'}, | ||
} | ||
) | ||
|
||
try: | ||
result = client.search_entries(project, body) | ||
except Exception as e: | ||
raise NeptuneScaleError(reason=e) | ||
|
||
return bool(result.entries) |
Oops, something went wrong.