From acd91f14ff1ab1e9d6ac0449b12bd19cefc0b975 Mon Sep 17 00:00:00 2001 From: fynnbe Date: Tue, 11 Jun 2024 19:01:48 +0200 Subject: [PATCH] skip updating empty collection --- .../remote_collection.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bioimageio_collection_backoffice/remote_collection.py b/bioimageio_collection_backoffice/remote_collection.py index 39f3d75e..7ed202b8 100644 --- a/bioimageio_collection_backoffice/remote_collection.py +++ b/bioimageio_collection_backoffice/remote_collection.py @@ -457,9 +457,12 @@ def generate_collection_json( # if not isinstance(coll_descr, CollectionDescr): # raise ValueError(coll_descr.validation_summary.format()) - self.client.put_json( - output_file_name, collection.model_dump(mode="json", exclude_none=True) - ) + if entries: + self.client.put_json( + output_file_name, collection.model_dump(mode="json", exclude_none=True) + ) + else: + logger.error("Skipping uploading empty collection!") # raise an error for an invalid (skipped) collection entry if error_in_published_entry is not None: @@ -1105,7 +1108,9 @@ def maybe_swap_with_thumbnail( for d in [v.client.load_file(v.rdf_path) for v in versions] ] entry_dois = [v.doi for v in versions] - legacy_download_count = LEGACY_DOWNLOAD_COUNTS.get(rdf["id"], 0) # TODO: add download count from versions + legacy_download_count = LEGACY_DOWNLOAD_COUNTS.get( + rdf["id"], 0 + ) # TODO: add download count from versions if rdf["id"].startswith("10.5281/zenodo."): # legacy models