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

Added support of active projects exception #1348

Merged
merged 4 commits into from
Jun 2, 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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
### Features
- Added automatic tracking of dependencies ([#1345](https://github.com/neptune-ai/neptune-client/pull/1345))

### Fixes
- Added support of project visibility exception ([#1343](https://github.com/neptune-ai/neptune-client/pull/1343))

### Changes
- Added support of active projects limit exception ([#1348](https://github.com/neptune-ai/neptune-client/pull/1348))

## neptune 1.2.0

### Changes
Expand Down
4 changes: 4 additions & 0 deletions src/neptune/internal/backends/swagger_client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(self, api_method):
@staticmethod
def handle_neptune_http_errors(response, exception: Optional[HTTPError] = None):
from neptune.management.exceptions import (
ActiveProjectsLimitReachedException,
IncorrectIdentifierException,
ObjectNotFound,
ProjectKeyCollision,
Expand Down Expand Up @@ -82,6 +83,9 @@ def handle_neptune_http_errors(response, exception: Optional[HTTPError] = None):
"WORKSPACE_IN_READ_ONLY_MODE": lambda response_body: NeptuneLimitExceedException(
reason=response_body.get("title", "Unknown reason")
),
"LIMIT_OF_ACTIVE_PROJECTS_REACHED": lambda response_body: ActiveProjectsLimitReachedException(
currentQuota=response_body.get("currentQuota", "<unknown quota>")
),
}

error_type: Optional[str] = body.get("errorType")
Expand Down
9 changes: 9 additions & 0 deletions src/neptune/management/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,12 @@ def __init__(self, **kwargs):
else:
modified_kwargs["requested"] = '"' + requested + '"'
super().__init__(**modified_kwargs)


class ActiveProjectsLimitReachedException(ManagementOperationFailure):
code = 26
description = (
"Limit of active projects reached. You can have up to {currentQuota} active projects simultaneously. "
"To create a new project, you need to either archive an active project or increase the quota of active "
"projects in the workspace."
)