Skip to content

Commit

Permalink
Merge pull request #1712 from girder/update-with-master
Browse files Browse the repository at this point in the history
Bring recent changes to `large_image` into the `girder5` branch
  • Loading branch information
naglepuff authored Nov 7, 2024
2 parents d6202e1 + 75a10a0 commit d046aa5
Show file tree
Hide file tree
Showing 146 changed files with 6,835 additions and 1,106 deletions.
110 changes: 86 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
version: 2.1
executors:
toxandnode:
Expand All @@ -8,8 +9,11 @@ commands:
tox:
description: "Run tox"
parameters:
env:
toxenv:
type: string
environ:
type: string
default: ""
steps:
- run:
name: Upgrade virtualenv and tox
Expand All @@ -21,9 +25,9 @@ commands:
name: Run tests via tox
# Piping through cat does less buffering of the output but can
# consume the exit code
# command: PYTEST_ADDOPTS=--forked tox -e << parameters.env >> | cat; test ${PIPESTATUS[0]} -eq 0
# command: PYTEST_ADDOPTS="--reruns=3 --numprocesses=0" tox -e << parameters.env >> | cat; test ${PIPESTATUS[0]} -eq 0
command: PYTEST_NUMPROCESSES=3 PYTEST_ADDOPTS="--reruns=3" tox -e << parameters.env >> | cat; test ${PIPESTATUS[0]} -eq 0
# command: PYTEST_ADDOPTS=--forked tox -e << parameters.toxenv >> | cat; test ${PIPESTATUS[0]} -eq 0
# command: PYTEST_ADDOPTS="--reruns=3 --numprocesses=0" tox -e << parameters.toxenv >> | cat; test ${PIPESTATUS[0]} -eq 0
command: COVERAGE_CORE=sysmon PYTEST_NUMPROCESSES=3 PYTEST_ADDOPTS="--reruns=3" << parameters.environ >> tox -e << parameters.toxenv >> | cat; test ${PIPESTATUS[0]} -eq 0
switchpython:
description: "Upgrade python"
parameters:
Expand All @@ -34,7 +38,8 @@ commands:
name: Upgrade pyenv
command: |
sudo rm -rf /opt/circleci/.pyenv
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
sudo bash -c 'curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | PYENV_ROOT=/opt/circleci/.pyenv bash'
sudo chmod -R 777 /opt/circleci/.pyenv/
pyenv install --list list
- run:
name: Use pyenv to install python
Expand Down Expand Up @@ -71,15 +76,14 @@ commands:
docker-compose -f ./.circleci/dcm4chee/auth-docker-compose.yml up -d
export DICOMWEB_TEST_URL=http://localhost:8008/dcm4chee-arc/aets/DCM4CHEE/rs
echo "export DICOMWEB_TEST_URL=$DICOMWEB_TEST_URL" >> $BASH_ENV
pip install dicomweb_client 'python-keycloak<4.1'
pip install dicomweb_client tenacity 'python-keycloak<4.1'
# Wait up to 60 seconds for keycloak to be ready
echo 'Waiting for keycloak to start...'
KEYCLOAK_URL=https://localhost:8843
curl -k --retry 60 -f --retry-all-errors --retry-delay 1 -s -o /dev/null $KEYCLOAK_URL
echo 'Updating keycloak token lifespan...'
python -W ignore ./.circleci/dcm4chee/update_access_token_lifespan.py
echo 'Creating keycloak access token...'
# Now create the token
export DICOMWEB_TEST_TOKEN=$(python -W ignore ./.circleci/dcm4chee/create_keycloak_token.py)
Expand Down Expand Up @@ -111,13 +115,21 @@ commands:
command: |
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
- restore_cache:
name: Restore nvm cache
key: v1-nvm-cache-<< parameters.node >>
- run:
name: Switch node versions
command: |
nvm install << parameters.node >>
nvm alias default << parameters.node >>
NODE_DIR=$(dirname $(which node))
echo "export PATH=$NODE_DIR:\$PATH" >> $BASH_ENV
- save_cache:
name: Save nvm cache
key: v1-nvm-cache-<< parameters.node >>
paths:
- /opt/circleci/.nvm/.cache
- run:
name: Check node versions
command: |
Expand All @@ -129,13 +141,12 @@ commands:
- run:
name: Install Codecov client
command: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
- run:
name: Upload coverage
command: |
./codecov --disable search pycov gcov --file build/test/coverage/py_coverage.xml,build/test/coverage/cobertura-coverage.xml
./codecov --disable search pycov gcov --file build/test/coverage/py_coverage.xml,build/test/coverage/cobertura-coverage.xml
jobs:
testdocker:
machine:
Expand All @@ -144,12 +155,12 @@ jobs:
- checkout
- run:
name: Build the test docker
command: docker build --force-rm -t girder/tox-and-node -f test.Dockerfile .
command: docker build --progress=plain --force-rm -t girder/tox-and-node -f test.Dockerfile .
- run:
name: Publish the images to Docker Hub
command: |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
docker push girder/tox-and-node:latest
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
docker push girder/tox-and-node:latest
py38:
machine:
image: ubuntu-2204:current
Expand All @@ -160,7 +171,7 @@ jobs:
version: "3.8"
node: v14
- tox:
env: test-py38
toxenv: test-py38
- coverage
- store_artifacts:
path: build/test/artifacts
Expand All @@ -174,7 +185,7 @@ jobs:
version: "3.9"
node: v14
- tox:
env: test-py39
toxenv: test-py39
- coverage
- store_artifacts:
path: build/test/artifacts
Expand All @@ -188,7 +199,7 @@ jobs:
version: "3.10"
node: v14
- tox:
env: test-py310
toxenv: test-py310
- coverage
- store_artifacts:
path: build/test/artifacts
Expand All @@ -202,7 +213,7 @@ jobs:
version: "3.11"
node: v14
- tox:
env: test-py311
toxenv: test-py311
- coverage
- store_artifacts:
path: build/test/artifacts
Expand All @@ -216,7 +227,22 @@ jobs:
version: "3.12"
node: v14
- tox:
env: test-py312
toxenv: test-py312
- coverage
- store_artifacts:
path: build/test/artifacts
py313:
machine:
image: ubuntu-2204:current
resource_class: large
steps:
- checkout
- allservices:
version: "3.13"
node: v14
- tox:
toxenv: test-py313
environ: TOX_VERBOSE=4 TOX_PREFER_BINARY=1
- coverage
- store_artifacts:
path: build/test/artifacts
Expand All @@ -227,8 +253,11 @@ jobs:
- run:
name: Install dependencies
command: apt-get update -yq && apt-get install -yq pandoc && pandoc --version
- run:
name: Permissions for link checker
command: find /root -type d -exec chmod 755 {} \+
- tox:
env: docs,lint,lintclient,notebook
toxenv: docs,lint,lintclient,notebook
- store_artifacts:
path: build/docs
- persist_to_workspace:
Expand All @@ -240,7 +269,7 @@ jobs:
steps:
- checkout
- tox:
env: compare-py311
toxenv: compare-py311
- store_artifacts:
path: build/tox/compare.txt
- store_artifacts:
Expand All @@ -251,7 +280,7 @@ jobs:
steps:
- checkout
- tox:
env: type
toxenv: type
wheels:
executor: toxandnode
steps:
Expand All @@ -264,6 +293,22 @@ jobs:
command: python ./.circleci/make_index.py ~/wheels
- store_artifacts:
path: ~/wheels
check_release:
docker:
- image: cimg/python:3.10
steps:
- checkout
- run:
name: Setup virtual environment
command: |
if [ ! -d env ]; then python -m virtualenv env || python -m venv env; fi
echo ". $CIRCLE_WORKING_DIRECTORY/env/bin/activate" >> $BASH_ENV
- run:
name: Install python packages
command: pip install setuptools_scm twine
- run:
name: Check release to PyPi
command: ./.circleci/release_pypi.sh check
release:
docker:
- image: cimg/python:3.10
Expand All @@ -279,7 +324,7 @@ jobs:
command: pip install setuptools_scm twine
- run:
name: Release to PyPi
command: ./.circleci/release_pypi.sh
command: ./.circleci/release_pypi.sh upload
docs-deploy:
working_directory: ~/project
docker:
Expand All @@ -305,7 +350,6 @@ jobs:
command: |
touch package.json
gh-pages --dotfiles --message "Update documentation" --dist build/docs --no-history
workflows:
version: 2
ci:
Expand Down Expand Up @@ -352,6 +396,13 @@ workflows:
branches:
ignore:
- gh-pages
- py313:
filters:
tags:
only: /^v.*/
branches:
ignore:
- gh-pages
- lint_and_docs:
filters:
tags:
Expand Down Expand Up @@ -380,13 +431,22 @@ workflows:
branches:
ignore:
- gh-pages
- check_release:
filters:
tags:
only: /^v.*/
branches:
ignore:
- gh-pages
- release:
requires:
- check_release
- py38
- py39
- py310
- py311
- py312
- py313
- lint_and_docs
- type
- wheels
Expand All @@ -402,6 +462,7 @@ workflows:
- py310
- py311
- py312
- py313
- lint_and_docs
- type
- wheels
Expand All @@ -427,6 +488,7 @@ workflows:
- py310
- py311
- py312
- py313
- lint_and_docs
- type
- compare
Expand Down
2 changes: 1 addition & 1 deletion .circleci/dcm4chee/auth-docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
volumes:
db_data: {}
arc_data: {}
ldap_data: {}
ldap_config: {}
mysql: {}
keycloak: {}

services:
ldap:
image: dcm4che/slapd-dcm4chee:2.6.5-31.2
Expand Down
3 changes: 1 addition & 2 deletions .circleci/dcm4chee/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
---
version: "3"

volumes:
db_data: {}
arc_data: {}
ldap_data: {}
ldap_config: {}

services:
ldap:
image: dcm4che/slapd-dcm4chee:2.6.5-31.2
Expand Down
8 changes: 6 additions & 2 deletions .circleci/dcm4chee/upload_example_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from dicomweb_client import DICOMwebClient
from pydicom import dcmread
from requests import Session
from tenacity import Retrying, stop_after_attempt, wait_exponential


def upload_example_data(server_url, token=None):
Expand All @@ -22,8 +23,11 @@ def upload_example_data(server_url, token=None):

datasets = []
for url in download_urls:
resp = urllib.request.urlopen(url)
data = resp.read()
for attempt in Retrying(stop=stop_after_attempt(5),
wait=wait_exponential(multiplier=1, min=0.5, max=5)):
with attempt:
resp = urllib.request.urlopen(url)
data = resp.read()
dataset = dcmread(BytesIO(data))
datasets.append(dataset)

Expand Down
Loading

0 comments on commit d046aa5

Please sign in to comment.