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

Bug: Don't try to parse annotations two times in a row #537

Merged
merged 1 commit into from
Oct 9, 2024
Merged
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
22 changes: 13 additions & 9 deletions dagshub/data_engine/model/query_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@ def _convert_annotation_fields(self, *fields, load_into_memory):
for dp in self:
for fld in annotation_fields:
if fld in dp.metadata:
# Already loaded - skip
if isinstance(dp.metadata[fld], MetadataAnnotations):
continue
# Override the load_into_memory flag, because we need the contents
if not load_into_memory:
dp.metadata[fld] = Path(dp.metadata[fld]).read_bytes()
Expand All @@ -433,15 +436,16 @@ def _convert_annotation_fields(self, *fields, load_into_memory):
else:
dp.metadata[fld] = MetadataAnnotations(datapoint=dp, field=fld)

log_message(
"Warning: The following datapoints had invalid annotations, "
"any annotation-related operations will not work on these:"
)
err_msg = ""
for fld, dps in bad_annotations.items():
err_msg += f'Field "{fld}" in datapoints:\n\t'
err_msg += "\n\t".join(dps)
log_message(err_msg)
if bad_annotations:
log_message(
"Warning: The following datapoints had invalid annotations, "
"any annotation-related operations will not work on these:"
)
err_msg = ""
for fld, dps in bad_annotations.items():
err_msg += f'Field "{fld}" in datapoints:\n\t'
err_msg += "\n\t".join(dps)
log_message(err_msg)

def download_binary_columns(
self,
Expand Down
Loading