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

Validate Cluster Access Mode #1551

Merged
merged 15 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
12 changes: 12 additions & 0 deletions llmfoundry/command_utils/data_prep/convert_delta_to_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

from llmfoundry.utils.exceptions import (
ClusterDoesNotExistError,
ClusterInvalidAccessMode,
FailedToConnectToDatabricksError,
FailedToCreateSQLConnectionError,
InsufficientPermissionsError,
Expand Down Expand Up @@ -546,6 +547,17 @@ def validate_and_get_cluster_info(
if res is None:
raise ClusterDoesNotExistError(cluster_id)

data_security_mode = str(
res.data_security_mode,
).upper()[len('DATASECURITYMODE.'):]

# NONE stands for No Isolation Shared
if data_security_mode in ('NONE'):
KuuCi marked this conversation as resolved.
Show resolved Hide resolved
raise ClusterInvalidAccessMode(
cluster_id=cluster_id,
access_mode=data_security_mode,
)

assert res.spark_version is not None
stripped_runtime = re.sub(
r'[a-zA-Z]',
Expand Down
13 changes: 13 additions & 0 deletions llmfoundry/utils/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,19 @@ def __init__(self, cluster_id: str) -> None:
super().__init__(message, cluster_id=cluster_id)


class ClusterInvalidAccessMode(NetworkError):
"""Error thrown when the cluster does not exist."""

def __init__(self, cluster_id: str, access_mode: str) -> None:
message = f'Cluster with id {cluster_id} has access mode {access_mode}. ' + \
'please make sure the cluster used has access mode Shared or Single User!'
super().__init__(
message,
cluster_id=cluster_id,
access_mode=access_mode,
)


class FailedToCreateSQLConnectionError(
NetworkError,
):
Expand Down
Loading