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

make deepdiff optional #753

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 11 additions & 3 deletions src/levanter/store/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from dataclasses import dataclass
from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, TypeVar, Union

import deepdiff
# import deepdiff

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment?

import fsspec.core
import pyarrow as pa
import ray
Expand Down Expand Up @@ -508,7 +508,7 @@ class CacheMetadata:
options: CacheOptions = CacheOptions.default()
preprocessor_metadata: Optional[dict[str, Any]] = None

def compare_to(self, other: "CacheMetadata") -> deepdiff.DeepDiff:
def compare_to(self, other: "CacheMetadata"):
"""
Compare this metadata to another set of metadata. This is used to check if the cache being loaded
was created with the expected configuration.
Expand All @@ -519,7 +519,15 @@ def compare_to(self, other: "CacheMetadata") -> deepdiff.DeepDiff:
sorta_self = dataclasses.replace(self, preprocessor_metadata=None)
else:
sorta_self = self
return deepdiff.DeepDiff(sorta_self, other)
try:
import deepdiff

return deepdiff.DeepDiff(sorta_self, other)
except Exception as e:
if "deepdiff" in str(e):
if sorta_self != other:
return {"message": "Metadata mismatch"}
return {}

@staticmethod
def empty():
Expand Down
Loading