Skip to content

Commit

Permalink
maint: bump siibra-python veresion
Browse files Browse the repository at this point in the history
maint: fix deploy script
  • Loading branch information
xgui3783 committed Oct 17, 2024
1 parent 760bf3a commit b0eaf92
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 10 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/deploy-worker-helm-v4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ on:
WORKER_PATH:
default: "api.worker.app"
type: string

PULL_POLICY:
default: IfNotPresent
type: string

secrets:
KUBECONFIG:
Expand Down Expand Up @@ -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 \
Expand All @@ -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 }} \
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/docker-img.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Expand All @@ -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 }}

Expand All @@ -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 }}

Expand Down
2 changes: 1 addition & 1 deletion .helm/siibra-api-v4-worker/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
40 changes: 33 additions & 7 deletions api/common/data_handlers/compounds/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down Expand Up @@ -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))

Expand Down
2 changes: 1 addition & 1 deletion requirements/siibra.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
siibra==0.4a82
siibra==0.4a83
plotly

0 comments on commit b0eaf92

Please sign in to comment.