Skip to content

Commit 40f9930

Browse files
committed
handling error
Signed-off-by: Wenqi Li <[email protected]>
1 parent 459eed8 commit 40f9930

File tree

5 files changed

+9
-0
lines changed

5 files changed

+9
-0
lines changed

.github/workflows/cron.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
nvidia-smi
4343
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils)
4444
echo $CUDA_VISIBLE_DEVICES
45+
trap 'if pgrep python; then pkill python; fi;' ERR
4546
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 &
4647
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
4748
python -c 'import torch; print(torch.rand(5, 3, device=torch.device("cuda:0")))'
@@ -81,6 +82,7 @@ jobs:
8182
nvidia-smi
8283
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils)
8384
echo $CUDA_VISIBLE_DEVICES
85+
trap 'if pgrep python; then pkill python; fi;' ERR
8486
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 &
8587
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
8688
python -c 'import torch; print(torch.rand(5, 3, device=torch.device("cuda:0")))'
@@ -109,6 +111,7 @@ jobs:
109111
nvidia-smi
110112
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils)
111113
echo $CUDA_VISIBLE_DEVICES
114+
trap 'if pgrep python; then pkill python; fi;' ERR
112115
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 &
113116
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
114117
python -c 'import torch; print(torch.rand(5,3, device=torch.device("cuda:0")))'
@@ -154,6 +157,7 @@ jobs:
154157
run: |
155158
export CUDA_VISIBLE_DEVICES=${{ steps.monai-install.outputs.devices }}
156159
echo $CUDA_VISIBLE_DEVICES
160+
trap 'if pgrep python; then pkill python; fi;' ERR
157161
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 &
158162
cd /opt/tutorials
159163
$(pwd)/runner.sh

.github/workflows/docker.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ jobs:
8989
run: |
9090
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils)
9191
echo $CUDA_VISIBLE_DEVICES
92+
trap 'if pgrep python; then pkill python; fi;' ERR
9293
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 &
9394
python -c 'import monai; monai.config.print_config()'
9495
cd /opt/monai
@@ -110,6 +111,7 @@ jobs:
110111
run: |
111112
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils)
112113
echo $CUDA_VISIBLE_DEVICES
114+
trap 'if pgrep python; then pkill python; fi;' ERR
113115
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 &
114116
python -c 'import monai; monai.config.print_config()'
115117
cd /opt/monai

.github/workflows/integration.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
nvidia-smi
4343
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils)
4444
echo $CUDA_VISIBLE_DEVICES
45+
trap 'if pgrep python; then pkill python; fi;' ERR
4546
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 &
4647
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
4748
python -c 'import torch; print(torch.rand(5,3, device=torch.device("cuda:0")))'

.github/workflows/pythonapp.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ jobs:
290290
sleep $LAUNCH_DELAY
291291
export CUDA_VISIBLE_DEVICES=$(coverage run -m tests.utils)
292292
echo $CUDA_VISIBLE_DEVICES
293+
trap 'if pgrep python; then pkill python; fi;' ERR
293294
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 &
294295
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
295296
python -c 'import torch; print(torch.rand(5, 3, device=torch.device("cuda:0")))'

.github/workflows/setupapp.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
nvidia-smi
4848
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils)
4949
echo $CUDA_VISIBLE_DEVICES
50+
trap 'if pgrep python; then pkill python; fi;' ERR
5051
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 &
5152
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
5253
python -c 'import torch; print(torch.rand(5, 3, device=torch.device("cuda:0")))'

0 commit comments

Comments
 (0)