Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
amritghimire committed Oct 14, 2024
1 parent 503c186 commit b43daf1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/datachain/catalog/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ def create_new_dataset_version(
self.update_dataset_version_with_warehouse_info(dataset, version)

session = Session.get(session=session, catalog=self)
session.add_created_versions(dataset, version)
session.add_dataset_version(dataset, version)

return dataset

Expand Down Expand Up @@ -1225,7 +1225,7 @@ def register_dataset(
)

session = Session.get(session=session, catalog=self)
session.add_created_versions(target_dataset, target_version)
session.add_dataset_version(target_dataset, target_version)

# to avoid re-creating rows table, we are just renaming it for a new version
# of target dataset
Expand Down
12 changes: 6 additions & 6 deletions src/datachain/query/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __init__(
self.catalog = catalog or get_catalog(
client_config=client_config, in_memory=in_memory
)
self.versions: list[tuple[DatasetRecord, int]] = []
self.dataset_versions: list[tuple[DatasetRecord, int]] = []

def __enter__(self):
# Push the current context onto the stack
Expand All @@ -90,8 +90,8 @@ def __exit__(self, exc_type, exc_val, exc_tb):
if Session.SESSION_CONTEXTS:
Session.SESSION_CONTEXTS.pop()

def add_created_versions(self, dataset: "DatasetRecord", version: int) -> None:
self.versions.append((dataset, version))
def add_dataset_version(self, dataset: "DatasetRecord", version: int) -> None:
self.dataset_versions.append((dataset, version))

def generate_temp_dataset_name(self) -> str:
return self.get_temp_prefix() + uuid4().hex[: self.TEMP_TABLE_UUID_LEN]
Expand All @@ -109,13 +109,13 @@ def _cleanup_temp_datasets(self) -> None:
pass

def _cleanup_created_versions(self) -> None:
if not self.versions:
if not self.dataset_versions:
return

for dataset, version in self.versions:
for dataset, version in self.dataset_versions:
self.catalog.remove_dataset_version(dataset, version)

self.versions.clear()
self.dataset_versions.clear()

@classmethod
def get(
Expand Down

0 comments on commit b43daf1

Please sign in to comment.