From 0331df86e46af7d371fc1b525f55140a66b0f650 Mon Sep 17 00:00:00 2001 From: Rich <33289025+rijobro@users.noreply.github.com> Date: Wed, 27 Jan 2021 15:39:14 +0000 Subject: [PATCH 01/12] run modified notebooks --- .github/workflows/pep8.yml | 13 ++++++++----- requirements.txt | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pep8.yml b/.github/workflows/pep8.yml index 587472e4a5..dc5853659b 100644 --- a/.github/workflows/pep8.yml +++ b/.github/workflows/pep8.yml @@ -8,11 +8,7 @@ on: pull_request: jobs: - # caching of these jobs: - # - docker-20-03-py3-pip- (shared) - # - ubuntu py37 pip- - # - os-latest-pip- (shared) - pep8: + build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -34,6 +30,13 @@ jobs: run: | python -m pip install --upgrade pip wheel python -m pip install -r requirements.txt + python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/master/requirements.txt + python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/master/requirements-dev.txt - name: PEP8 check run: | $(pwd)/runner.sh --no-run + - name: Run changed files + run: | + python -c "import torch; print(torch.cuda.is_available())" + git fetch origin master:master + git diff --name-only master | while read line; do [[ $line == *.ipynb ]] && ./runner.sh --file "$line" --no-checks; done diff --git a/requirements.txt b/requirements.txt index 8bd733221f..193df2c022 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,4 @@ papermill autopep8 jupytext autoflake +ipykernel From fb027577ef14b01e90ff83bcff7bc75796271d0f Mon Sep 17 00:00:00 2001 From: Richard Brown <33289025+rijobro@users.noreply.github.com> Date: Wed, 27 Jan 2021 15:43:33 +0000 Subject: [PATCH 02/12] add pip install --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 193df2c022..646fdfdbd5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,4 @@ autopep8 jupytext autoflake ipykernel +scikit-learn From 12e76d946d501d675198e6a10768f261e12b0452 Mon Sep 17 00:00:00 2001 From: Richard Brown <33289025+rijobro@users.noreply.github.com> Date: Wed, 27 Jan 2021 15:45:41 +0000 Subject: [PATCH 03/12] separate lines --- .github/workflows/pep8.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pep8.yml b/.github/workflows/pep8.yml index dc5853659b..eb36fdc815 100644 --- a/.github/workflows/pep8.yml +++ b/.github/workflows/pep8.yml @@ -34,9 +34,15 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/master/requirements-dev.txt - name: PEP8 check run: | - $(pwd)/runner.sh --no-run + git diff --name-only master | \ + while read line; do + [[ $line == *.ipynb ]] && ./runner.sh --file "$line" --no-run + done - name: Run changed files run: | python -c "import torch; print(torch.cuda.is_available())" git fetch origin master:master - git diff --name-only master | while read line; do [[ $line == *.ipynb ]] && ./runner.sh --file "$line" --no-checks; done + git diff --name-only master | \ + while read line; do + [[ $line == *.ipynb ]] && ./runner.sh --file "$line" --no-checks + done From 5d3f609aabbc6fc74672b8d20b068413ca701bdd Mon Sep 17 00:00:00 2001 From: Richard Brown <33289025+rijobro@users.noreply.github.com> Date: Wed, 27 Jan 2021 15:48:26 +0000 Subject: [PATCH 04/12] cancel workflows and pip install monai-weekly --- .github/workflows/cleanup.yml | 20 ++++++++++++++++++++ .github/workflows/pep8.yml | 1 + 2 files changed, 21 insertions(+) create mode 100644 .github/workflows/cleanup.yml diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml new file mode 100644 index 0000000000..d30caf36b1 --- /dev/null +++ b/.github/workflows/cleanup.yml @@ -0,0 +1,20 @@ +name: cleanup-workflow + +on: + workflow_run: + workflows: + - "build" + types: ["requested"] + +jobs: + cancel-duplicated-workflow: + name: "Cancel duplicated workflow" + runs-on: ubuntu-latest + steps: + - uses: potiuk/cancel-workflow-runs@953e057dc81d3458935a18d1184c386b0f6b5738 # tested + name: "Cancel duplicate workflows" + with: + cancelMode: allDuplicates + token: ${{ secrets.GITHUB_TOKEN }} + sourceRunId: ${{ github.event.workflow_run.id }} + skipEventTypes: '["schedule"]' \ No newline at end of file diff --git a/.github/workflows/pep8.yml b/.github/workflows/pep8.yml index eb36fdc815..8b59821684 100644 --- a/.github/workflows/pep8.yml +++ b/.github/workflows/pep8.yml @@ -30,6 +30,7 @@ jobs: run: | python -m pip install --upgrade pip wheel python -m pip install -r requirements.txt + python -m pip install monai-weekly python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/master/requirements.txt python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/master/requirements-dev.txt - name: PEP8 check From 1fab60602c68b25703c9f9f104dce7ab502a2a7c Mon Sep 17 00:00:00 2001 From: Richard Brown <33289025+rijobro@users.noreply.github.com> Date: Wed, 27 Jan 2021 15:50:33 +0000 Subject: [PATCH 05/12] combine check and run --- .github/workflows/pep8.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pep8.yml b/.github/workflows/pep8.yml index 8b59821684..05b2f79a70 100644 --- a/.github/workflows/pep8.yml +++ b/.github/workflows/pep8.yml @@ -33,17 +33,9 @@ jobs: python -m pip install monai-weekly python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/master/requirements.txt python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/master/requirements-dev.txt - - name: PEP8 check + - name: PEP8 check and execute run: | git diff --name-only master | \ while read line; do - [[ $line == *.ipynb ]] && ./runner.sh --file "$line" --no-run - done - - name: Run changed files - run: | - python -c "import torch; print(torch.cuda.is_available())" - git fetch origin master:master - git diff --name-only master | \ - while read line; do - [[ $line == *.ipynb ]] && ./runner.sh --file "$line" --no-checks + [[ $line == *.ipynb ]] && ./runner.sh --file "$line" done From 88be176e5494bb648131d89429f3b5998d6ed159 Mon Sep 17 00:00:00 2001 From: Richard Brown <33289025+rijobro@users.noreply.github.com> Date: Wed, 27 Jan 2021 15:52:01 +0000 Subject: [PATCH 06/12] bug fix --- .github/workflows/pep8.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pep8.yml b/.github/workflows/pep8.yml index 05b2f79a70..1040290c6a 100644 --- a/.github/workflows/pep8.yml +++ b/.github/workflows/pep8.yml @@ -35,7 +35,9 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/master/requirements-dev.txt - name: PEP8 check and execute run: | + python -c "import torch; print(torch.cuda.is_available())" + git fetch origin master:master git diff --name-only master | \ - while read line; do + while read line; do [[ $line == *.ipynb ]] && ./runner.sh --file "$line" done From ab1995eb48ed2e150c5e4a1eacbd7dadfd5ca3f4 Mon Sep 17 00:00:00 2001 From: Richard Brown <33289025+rijobro@users.noreply.github.com> Date: Wed, 27 Jan 2021 15:55:50 +0000 Subject: [PATCH 07/12] install master branch --- .github/workflows/pep8.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pep8.yml b/.github/workflows/pep8.yml index 1040290c6a..278cb41999 100644 --- a/.github/workflows/pep8.yml +++ b/.github/workflows/pep8.yml @@ -30,7 +30,7 @@ jobs: run: | python -m pip install --upgrade pip wheel python -m pip install -r requirements.txt - python -m pip install monai-weekly + BUILD_MONAI=1 python -m pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/master/requirements.txt python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/master/requirements-dev.txt - name: PEP8 check and execute From 835533eacdd1329453d1a2c27695c9ffa947ca6a Mon Sep 17 00:00:00 2001 From: Richard Brown <33289025+rijobro@users.noreply.github.com> Date: Wed, 27 Jan 2021 15:56:39 +0000 Subject: [PATCH 08/12] remove cuda print --- .github/workflows/pep8.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pep8.yml b/.github/workflows/pep8.yml index 278cb41999..735e9c1431 100644 --- a/.github/workflows/pep8.yml +++ b/.github/workflows/pep8.yml @@ -35,7 +35,7 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/master/requirements-dev.txt - name: PEP8 check and execute run: | - python -c "import torch; print(torch.cuda.is_available())" + # python -c "import torch; print(torch.cuda.is_available())" git fetch origin master:master git diff --name-only master | \ while read line; do From a02bc57f9a60fd18a0747ad1e134ea99257dba02 Mon Sep 17 00:00:00 2001 From: Richard Brown <33289025+rijobro@users.noreply.github.com> Date: Thu, 19 May 2022 11:34:46 +0100 Subject: [PATCH 09/12] run modified notebooks --- .github/workflows/cleanup.yml | 20 -------------------- .github/workflows/pep8.yml | 11 +++++------ requirements.txt | 2 -- 3 files changed, 5 insertions(+), 28 deletions(-) delete mode 100644 .github/workflows/cleanup.yml diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml deleted file mode 100644 index d30caf36b1..0000000000 --- a/.github/workflows/cleanup.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: cleanup-workflow - -on: - workflow_run: - workflows: - - "build" - types: ["requested"] - -jobs: - cancel-duplicated-workflow: - name: "Cancel duplicated workflow" - runs-on: ubuntu-latest - steps: - - uses: potiuk/cancel-workflow-runs@953e057dc81d3458935a18d1184c386b0f6b5738 # tested - name: "Cancel duplicate workflows" - with: - cancelMode: allDuplicates - token: ${{ secrets.GITHUB_TOKEN }} - sourceRunId: ${{ github.event.workflow_run.id }} - skipEventTypes: '["schedule"]' \ No newline at end of file diff --git a/.github/workflows/pep8.yml b/.github/workflows/pep8.yml index 735e9c1431..d71150de4f 100644 --- a/.github/workflows/pep8.yml +++ b/.github/workflows/pep8.yml @@ -4,7 +4,7 @@ on: # quick tests for every pull request push: branches: - - master + - main pull_request: jobs: @@ -31,13 +31,12 @@ jobs: python -m pip install --upgrade pip wheel python -m pip install -r requirements.txt BUILD_MONAI=1 python -m pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI - python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/master/requirements.txt - python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/master/requirements-dev.txt + python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/main/requirements.txt + python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/main/requirements-dev.txt - name: PEP8 check and execute run: | - # python -c "import torch; print(torch.cuda.is_available())" - git fetch origin master:master - git diff --name-only master | \ + git fetch origin main:main + git diff --name-only main | \ while read line; do [[ $line == *.ipynb ]] && ./runner.sh --file "$line" done diff --git a/requirements.txt b/requirements.txt index ab0e6bdfb5..096c01c178 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,4 @@ papermill autopep8 jupytext autoflake -ipykernel -scikit-learn tensorboard>=2.4.0 From 5bdc2efea281fd4af3964bf108c2a8cc73a0c1b0 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Tue, 11 Oct 2022 09:06:31 +0100 Subject: [PATCH 10/12] update runner Signed-off-by: Wenqi Li --- .github/workflows/pep8.yml | 24 +++++++++---------- .github/workflows/test-modified.yml | 37 +++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/test-modified.yml diff --git a/.github/workflows/pep8.yml b/.github/workflows/pep8.yml index d71150de4f..f33c3a3f41 100644 --- a/.github/workflows/pep8.yml +++ b/.github/workflows/pep8.yml @@ -8,12 +8,16 @@ on: pull_request: jobs: - build: + # caching of these jobs: + # - docker-20-03-py3-pip- (shared) + # - ubuntu py37 pip- + # - os-latest-pip- (shared) + pep8: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python 3.8 - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: 3.8 - name: cache weekly timestamp @@ -21,7 +25,7 @@ jobs: run: | echo "::set-output name=datew::$(date '+%Y-%V')" - name: cache for pip - uses: actions/cache@v2 + uses: actions/cache@v3 id: cache with: path: ~/.cache/pip @@ -29,14 +33,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip wheel + python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/dev/requirements-dev.txt python -m pip install -r requirements.txt - BUILD_MONAI=1 python -m pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI - python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/main/requirements.txt - python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/main/requirements-dev.txt - - name: PEP8 check and execute + - name: PEP8 check run: | - git fetch origin main:main - git diff --name-only main | \ - while read line; do - [[ $line == *.ipynb ]] && ./runner.sh --file "$line" - done + $(pwd)/runner.sh --no-run diff --git a/.github/workflows/test-modified.yml b/.github/workflows/test-modified.yml new file mode 100644 index 0000000000..0a7ed6b910 --- /dev/null +++ b/.github/workflows/test-modified.yml @@ -0,0 +1,37 @@ +name: build + +on: + # quick tests of modified notebooks for every pull request + push: + branches: + - main + - update-runner + pull_request: + +concurrency: + # automatically cancel the previously triggered workflows when there's a newer version + group: build-gpu-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build: + if: github.repository == 'Project-MONAI/tutorials' + container: + image: nvcr.io/nvidia/pytorch:21.06-py3 # CUDA 11.3 + options: "--gpus 0" + runs-on: [self-hosted, linux, x64] + steps: + - name: Install MONAI + id: monai-install + run: | + which python + python -m pip install --upgrade pip wheel + BUILD_MONAI=0 python -m pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI + python -m pip install -r https://raw.githubusercontent.com/Project-MONAI/MONAI/main/requirements-dev.txt + - uses: actions/checkout@v3 + - name: Notebook quick check + shell: bash + run: | + git fetch origin main + git diff --name-only origin/main | while read line; do if [[ $line == *.ipynb ]]; then ./runner.sh --file "$line"; fi; done; + # [[ $line == *.ipynb ]] && ./runner.sh --file "$line" From 3732c054acdad74d93a3043229c56e18570879c8 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Tue, 11 Oct 2022 10:06:14 +0100 Subject: [PATCH 11/12] update Signed-off-by: Wenqi Li --- .github/workflows/test-modified.yml | 3 ++- modules/2d_slices_from_3d_training.ipynb | 2 +- runner.sh | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-modified.yml b/.github/workflows/test-modified.yml index 0a7ed6b910..17c45a5b78 100644 --- a/.github/workflows/test-modified.yml +++ b/.github/workflows/test-modified.yml @@ -33,5 +33,6 @@ jobs: shell: bash run: | git fetch origin main - git diff --name-only origin/main | while read line; do if [[ $line == *.ipynb ]]; then ./runner.sh --file "$line"; fi; done; + python -m pip install -r requirements.txt; python -m pip list + git diff --name-only origin/main | while read line; do if [[ $line == *.ipynb ]]; then ./runner.sh -p "-and -wholename './${line}'"; fi; done; # [[ $line == *.ipynb ]] && ./runner.sh --file "$line" diff --git a/modules/2d_slices_from_3d_training.ipynb b/modules/2d_slices_from_3d_training.ipynb index c99d58ffb4..a547dcbcf3 100644 --- a/modules/2d_slices_from_3d_training.ipynb +++ b/modules/2d_slices_from_3d_training.ipynb @@ -6,7 +6,7 @@ "source": [ "# Training with 2D slices from volumes\n", "\n", - "This tutorial shows how to train a network with 2D samples from 3D inputs.\n", + "This tutorial shows how to train a network with 2D slice samples from 3D inputs.\n", "\n", "It mainly demonstrates 2d slice dataset using `monai.data.PatchIterd` and `monai.data.GridPatchDataset`.\n", "\n", diff --git a/runner.sh b/runner.sh index 108c57330f..0c4db3be67 100755 --- a/runner.sh +++ b/runner.sh @@ -141,7 +141,8 @@ do failfast=true ;; -p|--pattern) - pattern="$2" + pattern+="$2" + echo $pattern shift ;; -k|--kernelspec) From b771bd8536e9e3fb355db61ece5ddf375f83cb68 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Tue, 11 Oct 2022 10:55:18 +0100 Subject: [PATCH 12/12] remove temp tests Signed-off-by: Wenqi Li --- .github/workflows/test-modified.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-modified.yml b/.github/workflows/test-modified.yml index 17c45a5b78..422e8e8526 100644 --- a/.github/workflows/test-modified.yml +++ b/.github/workflows/test-modified.yml @@ -5,7 +5,6 @@ on: push: branches: - main - - update-runner pull_request: concurrency: