-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
output: Don't serialize hash_info
or meta
in cloud versioning.
#8849
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -368,7 +368,14 @@ def __init__( | |
name=self.hash_name, | ||
value=getattr(self.meta, self.hash_name, None), | ||
) | ||
if self.meta.nfiles or self.hash_info and self.hash_info.isdir: | ||
if self.files: | ||
tree = Tree.from_list(self.files, hash_name=self.hash_name) | ||
tree.digest() | ||
self.hash_info = tree.hash_info | ||
self.meta.isdir = True | ||
self.meta.nfiles = len(self.files) | ||
self.meta.size = sum(file.get("size") for file in self.files) | ||
elif self.meta.nfiles or self.hash_info and self.hash_info.isdir: | ||
self.meta.isdir = True | ||
if not self.hash_info and self.hash_name != "md5": | ||
md5 = getattr(self.meta, "md5", None) | ||
|
@@ -747,7 +754,22 @@ def _commit_granular_dir(self, filter_info) -> Optional["HashFile"]: | |
def dumpd(self, **kwargs): # noqa: C901 | ||
meta = self.meta.to_dict() | ||
meta.pop("isdir", None) | ||
ret: Dict[str, Any] = {**self.hash_info.to_dict(), **meta} | ||
ret: Dict[str, Any] = {} | ||
if ( | ||
(not self.IS_DEPENDENCY or self.stage.is_import) | ||
and self.hash_info.isdir | ||
and (kwargs.get("with_files") or self.files is not None) | ||
): | ||
Comment on lines
+758
to
+762
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason to move this upward @daavoo? This might affect the ordering of metadata in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No real reason. Could be moved bellow There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created #8879. |
||
obj: Optional["HashFile"] | ||
if self.obj: | ||
obj = self.obj | ||
else: | ||
obj = self.get_obj() | ||
if obj: | ||
obj = cast(Tree, obj) | ||
ret[self.PARAM_FILES] = obj.as_list(with_meta=True) | ||
else: | ||
ret = {**self.hash_info.to_dict(), **meta} | ||
|
||
if self.is_in_repo: | ||
path = self.fs.path.as_posix( | ||
|
@@ -788,20 +810,6 @@ def dumpd(self, **kwargs): # noqa: C901 | |
if not self.can_push: | ||
ret[self.PARAM_PUSH] = self.can_push | ||
|
||
if ( | ||
(not self.IS_DEPENDENCY or self.stage.is_import) | ||
and self.hash_info.isdir | ||
and (kwargs.get("with_files") or self.files is not None) | ||
): | ||
obj: Optional["HashFile"] | ||
if self.obj: | ||
obj = self.obj | ||
else: | ||
obj = self.get_obj() | ||
if obj: | ||
obj = cast(Tree, obj) | ||
ret[self.PARAM_FILES] = obj.as_list(with_meta=True) | ||
|
||
return ret | ||
|
||
def verify_metric(self): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This introduces overhead but need to check how big it is