in collection_manager/collection_manager/services/CollectionWatcher.py [0:0]
def _load_collections(self):
try:
with open(self._collections_path, 'r') as f:
collections_yaml = yaml.load(f, Loader=yaml.FullLoader)
self._collections_by_dir.clear()
logger.info('Refreshing collection config')
for collection_dict in collections_yaml['collections']:
try:
collection = Collection.from_dict(collection_dict)
if collection.storage_type() == CollectionStorageType.ZARR:
self._dataset_added_callback(collection)
elif collection.storage_type() != CollectionStorageType.REMOTE:
self._validate_collection(collection)
self._collections_by_dir[collection.directory()].add(collection)
except MissingValueCollectionError as e:
logger.exception(e)
logger.error(f"A collection is missing '{e.missing_value}'. Ignoring this collection for now.")
except RelativePathCollectionError as e:
logger.error(f"Relative paths are not allowed for the 'path' property of a collection. "
f"Ignoring collection '{e.collection.dataset_id}' until its path is fixed.")
except ConflictingPathCollectionError as e:
logger.error(f"Collection '{e.collection.dataset_id}' has granule path '{e.collection.path}' "
f"which uses same directory as the collection configuration file, "
f"'{self._collections_path}'. The granules need to be in their own directory. "
f"Ignoring collection '{e.collection.dataset_id}' for now.")
except FileNotFoundError:
raise CollectionConfigFileNotFoundError("The collection config file could not be found at "
f"{self._collections_path}")
except yaml.scanner.ScannerError:
raise CollectionConfigParsingError("Bad YAML syntax in collection configuration file. Will attempt "
"to reload collections after the next configuration change.")
except KeyError:
raise CollectionConfigParsingError("The collections configuration YAML file does not conform to the "
"proper schema. Will attempt to reload collections config after the "
"next file modification.")