diff --git a/.github/workflows/deploy-worker-helm-v4.yml b/.github/workflows/deploy-worker-helm-v4.yml index 5a99d1e..bb1667e 100644 --- a/.github/workflows/deploy-worker-helm-v4.yml +++ b/.github/workflows/deploy-worker-helm-v4.yml @@ -30,6 +30,10 @@ on: WORKER_PATH: default: "api.worker.app" type: string + + PULL_POLICY: + default: IfNotPresent + type: string secrets: KUBECONFIG: @@ -73,6 +77,7 @@ jobs: --set sapi.flavor=${{ inputs.FALVOR }} \ --set sapi.queue=${{ inputs.QUEUE }} \ --set image.tag=${{ inputs.IMAGE_TAG }} \ + --set image.pullPolicy=${{ input.PULL_POLICY }} \ --set sapi.worker=${{ inputs.WORKER_PATH }} \ --set sapi.resources.flavor=${{ inputs.RESOURCE }} \ --reuse-values \ @@ -85,6 +90,7 @@ jobs: --set sapi.flavor=${{ inputs.FALVOR }} \ --set sapi.queue=${{ inputs.QUEUE }} \ --set image.tag=${{ inputs.IMAGE_TAG }} \ + --set image.pullPolicy=${{ input.PULL_POLICY }} \ --set sapi.worker=${{ inputs.WORKER_PATH }} \ --set sapi.resources.flavor=${{ inputs.RESOURCE }} \ ${{ inputs.DEPLOYMENT_NAME }} \ diff --git a/.github/workflows/docker-img.yml b/.github/workflows/docker-img.yml index 83d7c04..4febcec 100644 --- a/.github/workflows/docker-img.yml +++ b/.github/workflows/docker-img.yml @@ -208,7 +208,7 @@ jobs: - queue: "compounds" resource: "low" include: - - queue: "comopunds" + - queue: "compounds" resource: 'high' if: ${{ github.event_name == 'release' && contains(github.ref, 'rc') }} @@ -220,6 +220,7 @@ jobs: QUEUE: ${{ needs.setup-envvar.outputs.version }}.rc.${{ matrix.queue }} IMAGE_TAG: rc-worker RESOURCE: ${{ matrix.resource }} + PULL_POLICY: Always secrets: KUBECONFIG: ${{ secrets.KUBECONFIG }} @@ -237,6 +238,7 @@ jobs: QUEUE: celery IMAGE_TAG: rc-worker-v4 WORKER_PATH: new_api.worker.app + PULL_POLICY: Always secrets: KUBECONFIG: ${{ secrets.KUBECONFIG }} diff --git a/.helm/siibra-api-v4-worker/Chart.yaml b/.helm/siibra-api-v4-worker/Chart.yaml index c13f62d..7a2fa22 100644 --- a/.helm/siibra-api-v4-worker/Chart.yaml +++ b/.helm/siibra-api-v4-worker/Chart.yaml @@ -21,4 +21,4 @@ version: 0.1.0 # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "0.3.21-rc3" +appVersion: "0.3.21-rc3-real" diff --git a/api/common/data_handlers/compounds/download.py b/api/common/data_handlers/compounds/download.py index 7668469..62558c9 100644 --- a/api/common/data_handlers/compounds/download.py +++ b/api/common/data_handlers/compounds/download.py @@ -84,19 +84,45 @@ def write_model(filename, obj, **kwargs): zipfile.writestr(filename, instance_to_model(obj, **kwargs).json(indent=2)) except Exception as e: zipfile.writestr(f"{filename}.error.txt", str(e)) - + def write_desc(filename, obj, **kwargs): - if isinstance(obj, _concept.AtlasConcept): - try: + try: + if isinstance(obj, siibra.core.parcellation.region.Region): + space = kwargs.get("space") + assert isinstance(space, _space.Space) + mp = siibra.get_map(obj.parcellation, space, "statistical") + volidx = mp.get_index(obj) + vol = mp.volumes[volidx.volume] + publications = "\n\n".join([ + f"[{url.get('citation', 'url')}]({url.get('url')})" + for ds in vol.datasets + for url in ds.urls + ]) + desc = "\n\n".join([ds.description for ds in vol.datasets]) + license_list = [] + for ds in vol.datasets: + if isinstance(ds.LICENSE, list): + license_list.extend(ds.LICENSE) + if isinstance(ds.LICENSE, str): + license_list.append(ds.LICENSE) + + license = "\n\n".join(license_list) + desc_str = DESC.format(name=f"Statistical map of {obj.name} in {space.name}", + description=desc, + citations=publications, + license=license) + zipfile.writestr(filename, desc_str) + return + if isinstance(obj, _concept.AtlasConcept): publications = "\n\n".join([f"[{p.get('citation', 'url')}]({p.get('url')})" if p.get('url') else p.get("citation", "CITATION") for p in obj.publications]) desc_str = DESC.format(name=obj.name, description=obj.description, citations=publications, license=obj.LICENSE) zipfile.writestr(filename, desc_str) - except Exception as e: - zipfile.writestr(f"{filename}.error.txt", str(e)) - + return + except Exception as e: + zipfile.writestr(f"{filename}.error.txt", str(e)) readme_txt = README.format(siibra_api_version=__version__, timestamp=str(datetime.now()), @@ -150,7 +176,7 @@ def write_desc(filename, obj, **kwargs): region_filename = f"{region.key}.nii.gz" regional_map = region.fetch_regional_map(space, siibra.MapType.STATISTICAL) zipfile.writestr(region_filename, gzip.compress(regional_map.to_bytes())) - write_desc(f'{region_filename}.info.md', region) + write_desc(f'{region_filename}.info.md', region, space=space) except Exception as e: zipfile.writestr(f"{region_filename or 'UNKNOWN_REGION'}.error.txt", str(e)) diff --git a/requirements/siibra.txt b/requirements/siibra.txt index bf3bb9f..413b43f 100644 --- a/requirements/siibra.txt +++ b/requirements/siibra.txt @@ -1,2 +1,2 @@ -siibra==0.4a82 +siibra==0.4a83 plotly