Commit 16e01365 authored by davelopez's avatar davelopez
Browse files

Log when set metadata fails on import



Co-authored-by: default avatarmvdbeek <m.vandenbeek@gmail.com>
parent eaacbd48
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
import abc
import contextlib
import datetime
import logging
import os
import shutil
import tarfile
@@ -65,6 +66,8 @@ from ..item_attrs import (
)
from ... import model

log = logging.getLogger(__name__)

ObjectKeyType = Union[str, int]

ATTRS_FILENAME_HISTORY = "history_attrs.txt"
@@ -589,11 +592,12 @@ class ModelImportStore(metaclass=abc.ABCMeta):
                                    dataset_instance, history, **regenerate_kwds
                                )
                            else:
                                # Try to set metadata directly. TODO: check efficiency of this?
                                # Try to set metadata directly. @mvdbeek thinks we should only record the datasets
                                try:
                                    if dataset_instance.has_metadata_files:
                                        dataset_instance.datatype.set_meta(dataset_instance)
                                except Exception:
                                    log.debug(f"Metadata setting failed on {dataset_instance}", exc_info=True)
                                    dataset_instance.dataset.state = dataset_instance.dataset.states.FAILED_METADATA

                if model_class == "HistoryDatasetAssociation":