Skip to content

Commit

Permalink
Merge branch 'main' into update_reupload_script
Browse files Browse the repository at this point in the history
  • Loading branch information
FynnBe committed Apr 24, 2024
2 parents ce432fd + 7c4cfcf commit a6a3ada
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/backup.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: backup
run-name: backup ${{vars.S3_BUCKET}}/${{vars.S3_FOLDER}} to ${{ inputs.ZENODO_URL }}
run-name: backup ${{vars.S3_BUCKET}}/${{vars.S3_FOLDER}} to ${{ vars.ZENODO_URL }}

on:
schedule:
- cron: "0 0 * * 0" # every sunday at midnight
- cron: "0 8 * * *" # every day at 8am
workflow_dispatch:

concurrency: ${{vars.ZENODO_URL}}

Expand Down
6 changes: 5 additions & 1 deletion bioimageio_collection_backoffice/generate_collection_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def generate_collection_json(
with collection_template.open() as f:
collection = json.load(f)

collection["config"]["url_root"] = client.get_file_url("").strip("/")
for p in remote_collection.get_all_published_versions():
collection["collection"].append(create_entry(p))

Expand Down Expand Up @@ -79,7 +80,10 @@ def maybe_swap_with_thumbnail(

if isinstance(src, str):
clean_name = Path(src).name # remove any leading './'
return thumbnails.get(clean_name, src)
if clean_name in thumbnails:
return p.get_file_url(thumbnails[clean_name])
else:
return src

return src

Expand Down
3 changes: 3 additions & 0 deletions bioimageio_collection_backoffice/remote_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ def get_uploader(self):

return Uploader(email=email, name=name)

def get_file_url(self, path: str):
return self.client.get_file_url(f"{self.folder}files/{path}")

def get_file_urls(self):
return self.client.get_file_urls(f"{self.folder}files/")

Expand Down
4 changes: 2 additions & 2 deletions bioimageio_collection_backoffice/validate_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from bioimageio.spec.model.v0_5 import Version, WeightsFormat
from bioimageio.spec.summary import ErrorEntry, ValidationDetail
from ruyaml import YAML
from typing_extensions import assert_never
from typing_extensions import assert_never, get_args

from .db_structure.log import BioimageioLogWithDefaults, LogWithDefaults
from .remote_resource import PublishedVersion, StagedVersion
Expand Down Expand Up @@ -204,7 +204,7 @@ def prepare_dynamic_test_cases(
for wf, entry in rd.weights:
# we skip the keras validation for now, see
# https://github.com/bioimage-io/collection-bioimage-io/issues/16
if not isinstance(entry, SupportedWeightsEntry):
if not isinstance(entry, get_args(SupportedWeightsEntry)):
warnings.warn(f"{wf} weights are currently not validated")
continue

Expand Down
1 change: 0 additions & 1 deletion collection_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"dataset"
],
"default_type": "model",
"url_root": "https://raw.githubusercontent.com/bioimage-io/collection-bioimage-io/gh-pages",
"partners": [
{
"id": "bioimageio",
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
],
packages=find_packages(exclude=["tests"]),
install_requires=[
"bioimageio.core @ git+https://github.com/bioimage-io/core-bioimage-io-python@f0f0a94022ea4ad570c9124c647e3027d9c94b43", # TODO: change to released version
"bioimageio.spec @ git+https://github.com/bioimage-io/spec-bioimage-io@4c1e18d6e6382a5b06d90107defb2f15e9319421",
"bioimageio.core @ git+https://github.com/bioimage-io/core-bioimage-io-python@b84d33b321b1f4e755aebe900f0bd74ed74eb012", # TODO: change to released version
"bioimageio.spec @ git+https://github.com/bioimage-io/spec-bioimage-io@68479898acdb4a7e4b53a04d86ad6fc014c69ed9",
"fire",
"loguru",
"minio==7.2.4",
Expand Down

0 comments on commit a6a3ada

Please sign in to comment.