Skip to content

Commit

Permalink
No need for the new dataset_validate function.
Browse files Browse the repository at this point in the history
  • Loading branch information
nvoxland committed Jun 29, 2023
1 parent 14a672d commit 3fe8baa
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
2 changes: 0 additions & 2 deletions deeplake/core/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
)
from deeplake.util.keys import (
dataset_exists,
dataset_validate,
get_dataset_info_key,
get_dataset_meta_key,
tensor_exists,
Expand Down Expand Up @@ -1761,7 +1760,6 @@ def diff(
def _populate_meta(self, verbose=True):
"""Populates the meta information for the dataset."""
if dataset_exists(self.storage):
dataset_validate(self.storage)
load_meta(self)

elif not self.storage.empty():
Expand Down
16 changes: 1 addition & 15 deletions deeplake/util/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,24 +196,10 @@ def dataset_exists(storage) -> bool:
)
except S3GetAccessError as err:
raise AuthorizationException("The dataset storage cannot be accessed") from err
except S3GetError:
except (KeyError, S3GetError) as err:
return False


def dataset_validate(storage) -> None:
"""
Checks the structure of the dataset and throws a descriptive DatasetCorruptError for any problems.
"""
try:
for file in [get_dataset_meta_key(FIRST_COMMIT_ID), get_version_control_info_key()]:
if file not in storage:
raise DatasetCorruptError(f"Invalid dataset: missing file {file}")
except S3GetAccessError as err:
raise AuthorizationException("The dataset storage cannot be accessed") from err
except S3GetError:
raise DatasetCorruptError("Error reading from S3")


def tensor_exists(key: str, storage, commit_id: str) -> bool:
try:
storage[get_tensor_meta_key(key, commit_id)]
Expand Down

0 comments on commit 3fe8baa

Please sign in to comment.