Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ jobs:
cron-docker:
if: github.repository == 'Project-MONAI/MONAI'
container:
image: localhost:5000/local_monai:dockerhub # use currently latest, locally available dockerhub image
image: docker://projectmonai/monai:latest # this might be slow and has the pull count limitations
options: "--gpus all"
runs-on: [self-hosted, linux, x64, common]
steps:
Expand Down
74 changes: 27 additions & 47 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,22 @@ on:
workflow_dispatch:

jobs:
versioning:
versioning_dev:
# compute versioning file from python setup.py
# upload as artifact
# (also used in release.yml)
if: github.repository == 'Project-MONAI/MONAI'
container:
image: localhost:5000/local_monai:latest
runs-on: [self-hosted, linux, x64, build_only]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# full history so that we can git describe
with:
ref: dev
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- shell: bash
run: |
git describe
Expand All @@ -43,13 +45,11 @@ jobs:
ls -al
rm -rf {*,.[^.]*}

local_docker:
# builds two versions: local_monai:latest and local_monai:dockerhub
# latest: used for local tests
# dockerhub: release, no flake package
docker_build_dev:
# builds projectmonai/monai:latest
if: github.repository == 'Project-MONAI/MONAI'
needs: versioning
runs-on: [self-hosted, linux, x64, build_only]
needs: versioning_dev
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -58,67 +58,47 @@ jobs:
uses: actions/download-artifact@v2
with:
name: _version.py
- name: Install Latest Docker
run: |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce
- name: docker_build
shell: bash
run: |
# get tag info for versioning
cat _version.py
mv _version.py monai/
# build and run original docker image for local registry
docker build -t localhost:5000/local_monai:latest -f Dockerfile .
docker push localhost:5000/local_monai:latest
# build once more w/ tag "latest": remove flake package as it is not needed on hub.docker.com

# build "latest": remove flake package as it is not needed on hub.docker.com
sed -i '/flake/d' requirements-dev.txt
docker build -t projectmonai/monai:latest -f Dockerfile .
# also push as tag "dockerhub" to local registry
docker image tag projectmonai/monai:latest localhost:5000/local_monai:dockerhub
docker push localhost:5000/local_monai:dockerhub

# distribute as always w/ tag "latest" to hub.docker.com
echo "${{ secrets.DOCKER_PW }}" | docker login -u projectmonai --password-stdin

docker push projectmonai/monai:latest
docker logout
docker image prune -f

docker_test_latest:
if: github.repository == 'Project-MONAI/MONAI'
needs: local_docker
container:
image: localhost:5000/local_monai:latest
runs-on: [self-hosted, linux, x64, common]
steps:
- name: Import
run: |
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils)
echo $CUDA_VISIBLE_DEVICES
trap 'if pgrep python; then pkill python; fi;' ERR
python -c $'import torch\na,b=torch.zeros(1,device="cuda:0"),torch.zeros(1,device="cuda:1");\nwhile True:print(a,b)' > /dev/null &
python -c 'import monai; monai.config.print_config()'
cd /opt/monai
ls -al
ngc --version
python -m tests.min_tests
if pgrep python; then pkill python; fi
env:
QUICKTEST: True

docker_test_dockerhub:
if: github.repository == 'Project-MONAI/MONAI'
needs: local_docker
needs: docker_build_dev
container:
image: localhost:5000/local_monai:dockerhub
runs-on: [self-hosted, linux, x64, common]
image: docker://projectmonai/monai:latest
options: "--shm-size=4g --ipc=host"
runs-on: ubuntu-latest
steps:
- name: Import
run: |
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils)
echo $CUDA_VISIBLE_DEVICES
trap 'if pgrep python; then pkill python; fi;' ERR
python -c $'import torch\na,b=torch.zeros(1,device="cuda:0"),torch.zeros(1,device="cuda:1");\nwhile True:print(a,b)' > /dev/null &
python -c 'import monai; monai.config.print_config()'
python -c 'import monai; monai.config.print_debug_info()'
cd /opt/monai
ls -al
ngc --version
python -m tests.min_tests
if pgrep python; then pkill python; fi
./runtests.sh --min
shell: bash
env:
QUICKTEST: True
1 change: 1 addition & 0 deletions tests/min_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def run_testsuit():
"test_nifti_rw",
"test_nifti_saver",
"test_occlusion_sensitivity",
"test_openslide_reader",
"test_orientation",
"test_orientationd",
"test_parallel_execution",
Expand Down
16 changes: 12 additions & 4 deletions tests/test_efficientnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,12 @@ class TestEFFICIENTNET(unittest.TestCase):
def test_shape(self, input_param, input_shape, expected_shape):
device = "cuda" if torch.cuda.is_available() else "cpu"

# initialize model
net = EfficientNetBN(**input_param).to(device)
try:
# initialize model
net = EfficientNetBN(**input_param).to(device)
except (ContentTooShortError, HTTPError, RuntimeError) as e:
print(str(e))
return # skipping the tests because of http errors

# run inference with random tensor
with eval_mode(net):
Expand All @@ -264,8 +268,12 @@ def test_shape(self, input_param, input_shape, expected_shape):
def test_non_default_shapes(self, input_param, input_shape, expected_shape):
device = "cuda" if torch.cuda.is_available() else "cpu"

# initialize model
net = EfficientNetBN(**input_param).to(device)
try:
# initialize model
net = EfficientNetBN(**input_param).to(device)
except (ContentTooShortError, HTTPError, RuntimeError) as e:
print(str(e))
return # skipping the tests because of http errors

# override input shape with different variations
num_dims = len(input_shape) - 2
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ def query_memory(n=2):
free_memory = np.asarray(free_memory, dtype=float).T
free_memory[1] += free_memory[0] # combine 0/1 column measures
ids = np.lexsort(free_memory)[:n]
except (FileNotFoundError, TypeError, IndexError):
except (TypeError, IndexError, OSError):
ids = range(n) if isinstance(n, int) else []
return ",".join(f"{int(x)}" for x in ids)

Expand Down