From bfee0e760cb4c18e55b718b2800e13a02f1cc9e3 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 15 Jun 2021 17:18:07 -0400 Subject: [PATCH 1/9] FIX: Path location is updated when symlinked --- notebooks/basic_nodes.ipynb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/notebooks/basic_nodes.ipynb b/notebooks/basic_nodes.ipynb index b8e2627..20cdbfe 100644 --- a/notebooks/basic_nodes.ipynb +++ b/notebooks/basic_nodes.ipynb @@ -170,8 +170,10 @@ "metadata": {}, "outputs": [], "source": [ + "in_file = '/data/ds000114/sub-01/ses-test/anat/sub-01_ses-test_T1w.nii.gz'\n", + "\n", "# Specify node inputs\n", - "bet.inputs.in_file = '/data/ds000114/sub-01/ses-test/anat/sub-01_ses-test_T1w.nii.gz'\n", + "bet.inputs.in_file = in_file\n", "bet.inputs.out_file = '/output/node_T1w_bet.nii.gz'" ] }, @@ -200,7 +202,7 @@ "from nilearn.plotting import plot_anat\n", "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", - "plot_anat(bet.inputs.in_file, title='BET input', cut_coords=(10,10,10),\n", + "plot_anat(in_file, title='BET input', cut_coords=(10,10,10),\n", " display_mode='ortho', dim=-1, draw_cross=False, annotate=False);\n", "plot_anat(res.outputs.out_file, title='BET output', cut_coords=(10,10,10),\n", " display_mode='ortho', dim=-1, draw_cross=False, annotate=False);" From c8d1989885317bf72ef4badafb232bbbb90d9398 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 30 Jun 2021 20:36:07 -0400 Subject: [PATCH 2/9] FIX: Save .mat files with unicode keys --- notebooks/advanced_create_interfaces.ipynb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/notebooks/advanced_create_interfaces.ipynb b/notebooks/advanced_create_interfaces.ipynb index 0ad6bd3..33c47db 100644 --- a/notebooks/advanced_create_interfaces.ipynb +++ b/notebooks/advanced_create_interfaces.ipynb @@ -1216,7 +1216,7 @@ "# 1. save the image in matlab format as tmp_image.mat\n", "tmp_image = 'tmp_image.mat'\n", "data = nb.load(in_file).get_data()\n", - "savemat(tmp_image, {b'data': data}, do_compression=False)" + "savemat(tmp_image, {'data': data}, do_compression=False)" ] }, { @@ -1300,7 +1300,7 @@ " # Save the image in matlab format as tmp_image.mat\n", " tmp_image = 'tmp_image.mat'\n", " data = nb.load(self.inputs.in_file).get_data()\n", - " savemat(tmp_image, {b'data': data}, do_compression=False)\n", + " savemat(tmp_image, {'data': data}, do_compression=False)\n", " \n", " # Load script\n", " with open(self.inputs.script_file) as script_file:\n", @@ -1413,7 +1413,7 @@ " # Save the image in matlab format as tmp_image.mat\n", " tmp_image = 'tmp_image.mat'\n", " data = nb.load(self.inputs.in_file).get_data()\n", - " savemat(tmp_image, {b'data': data}, do_compression=False)\n", + " savemat(tmp_image, {'data': data}, do_compression=False)\n", " \n", " # Load script\n", " with open(self.inputs.script_file) as script_file:\n", From 831c5972ca26137fbf965edc9fe7480365bde392 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 18 Oct 2021 11:50:27 -0400 Subject: [PATCH 3/9] FIX: Be more forgiving of the exception type Nipype changed how it reports exceptions raised in nodes in 1.7.0 --- notebooks/basic_function_interface.ipynb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/notebooks/basic_function_interface.ipynb b/notebooks/basic_function_interface.ipynb index f4b4076..5dc2b89 100644 --- a/notebooks/basic_function_interface.ipynb +++ b/notebooks/basic_function_interface.ipynb @@ -247,8 +247,8 @@ "# Run node\n", "try:\n", " rndArray.run()\n", - "except(NameError) as err:\n", - " print(\"NameError:\", err)\n", + "except Exception as err:\n", + " print(err)\n", "else:\n", " raise" ] @@ -259,8 +259,12 @@ "source": [ "As you can see, if we don't import `random` inside the scope of the function, we receive the following error:\n", "\n", - " NameError: global name 'random' is not defined\n", - " Interface Function failed to run. " + " Exception raised while executing Node rndArray_node.\n", + "\n", + " Traceback (most recent call last):\n", + " [...]\n", + " File \"\", line 3, in get_random_array\n", + " NameError: name 'random' is not defined" ] } ], From 48460056378b47cd4537bc162ae13e2fb4c2bd31 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 18 Oct 2021 14:29:44 -0400 Subject: [PATCH 4/9] ENH: Update to more recent PyBIDS --- generate.sh | 4 ++-- notebooks/basic_data_input_bids.ipynb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/generate.sh b/generate.sh index a22ace7..950990f 100644 --- a/generate.sh +++ b/generate.sh @@ -18,7 +18,7 @@ generate_docker() { conda_install="python=3.7 pytest jupyter jupyterlab jupyter_contrib_nbextensions traits pandas matplotlib scikit-learn scikit-image seaborn nbformat nb_conda" \ pip_install="https://github.com/nipy/nipype/tarball/master-%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20https://github.com/INCF/pybids/tarball/0.7.1+%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pybids==0.13.1%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20nilearn%20datalad[full]%20nipy%20duecredit%20nbval%20niflow-nipype1-workflows" \ create_env="neuro" \ activate=True \ @@ -57,7 +57,7 @@ generate_singularity() { conda_install="python=3.7 pytest jupyter jupyterlab jupyter_contrib_nbextensions traits pandas matplotlib scikit-learn scikit-image seaborn nbformat nb_conda" \ pip_install="https://github.com/nipy/nipype/tarball/master-%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20https://github.com/INCF/pybids/tarball/0.7.1+%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pybids==0.13.1%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20nilearn%20datalad[full]%20nipy%20duecredit%20nbval%20niflow-nipype1-workflows" \ create_env="neuro" \ activate=True \ diff --git a/notebooks/basic_data_input_bids.ipynb b/notebooks/basic_data_input_bids.ipynb index 3275f9d..e87d70a 100644 --- a/notebooks/basic_data_input_bids.ipynb +++ b/notebooks/basic_data_input_bids.ipynb @@ -140,7 +140,7 @@ "metadata": {}, "outputs": [], "source": [ - "layout.get(subject='01', suffix='bold', extensions=['nii', 'nii.gz'])" + "layout.get(subject='01', suffix='bold', extension=['.nii', '.nii.gz'])" ] }, { @@ -156,7 +156,7 @@ "metadata": {}, "outputs": [], "source": [ - "layout.get(subject='01', suffix='bold', extensions=['nii', 'nii.gz'], return_type='file')" + "layout.get(subject='01', suffix='bold', extension=['.nii', '.nii.gz'], return_type='file')" ] }, { From 0ca3dd83b48affc9274d0f61124aabbdf0f3723b Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 4 Apr 2022 13:09:51 -0400 Subject: [PATCH 5/9] MNT: Update Python to 3.8 --- generate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate.sh b/generate.sh index 950990f..3c2f44d 100644 --- a/generate.sh +++ b/generate.sh @@ -15,7 +15,7 @@ generate_docker() { --user=neuro \ --workdir /home/neuro \ --miniconda \ - conda_install="python=3.7 pytest jupyter jupyterlab jupyter_contrib_nbextensions + conda_install="python=3.8 pytest jupyter jupyterlab jupyter_contrib_nbextensions traits pandas matplotlib scikit-learn scikit-image seaborn nbformat nb_conda" \ pip_install="https://github.com/nipy/nipype/tarball/master%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pybids==0.13.1From%20da92a08bfbc734ea3ca22d249a64ab9a1766ae2e%20Mon%20Sep%2017%2000:00:00%202001From:%20mathiasg%20%3Cmathiasg@stanford.edu%3EDate:%20Thu,%201%20Sep%202022%2015:36:31%20-0400Subject:%20[PATCH%206/9]%20ENH:%20Allow%20passing%20in%20specific%20nipype%20branch---%20generate.sh%20|%2014%20++++++++++++--%201%20file%20changed,%2012%20insertions(+),%202%20deletions(-)diff%20--git%20a/generate.sh%20b/generate.shindex%203c2f44d..635192a%20100644---%20a/generate.sh+++%20b/generate.sh@@%20-2,6%20+2,16%20@@%20%20set%20-e%20+NIPYPE_BRANCH=$%7B1:-"master"} +case $NIPYPE_BRANCH in + master) + NIPYPE_URL="https://github.com/nipy/nipype/tarball/master" + ;; + *) + NIPYPE_URL="git+https://github.com/nipy/nipype.git@${NIPYPE_BRANCH}" + ;; +esac + # Generate Dockerfile generate_docker() { docker run --rm kaczmarj/neurodocker:master generate docker \ @@ -17,7 +27,7 @@ generate_docker() { --miniconda \ conda_install="python=3.8 pytest jupyter jupyterlab jupyter_contrib_nbextensions traits pandas matplotlib scikit-learn scikit-image seaborn nbformat nb_conda" \ - pip_install="https://github.com/nipy/nipype/tarball/master+%20%20%20%20%20%20%20%20%20%20%20%20%20pip_install="$NIPYPE_URL pybids==0.13.1 nilearn datalad[full] nipy duecredit nbval niflow-nipype1-workflows" \ create_env="neuro" \ @@ -56,7 +66,7 @@ generate_singularity() { --miniconda \ conda_install="python=3.7 pytest jupyter jupyterlab jupyter_contrib_nbextensions traits pandas matplotlib scikit-learn scikit-image seaborn nbformat nb_conda" \ - pip_install="https://github.com/nipy/nipype/tarball/master+%20%20%20%20%20%20%20%20%20%20%20%20%20pip_install="$NIPYPE_URL pybids==0.13.1 nilearn datalad[full] nipy duecredit nbval niflow-nipype1-workflows" \ create_env="neuro" \ From 1836933d07a1cdb129ab8bcc4a7890114a3c5511 Mon Sep 17 00:00:00 2001 From: mathiasg Date: Thu, 1 Sep 2022 15:37:02 -0400 Subject: [PATCH 7/9] MAINT: Bump singularity python version --- generate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate.sh b/generate.sh index 635192a..81ec0f1 100644 --- a/generate.sh +++ b/generate.sh @@ -64,7 +64,7 @@ generate_singularity() { --user=neuro \ --workdir /home/neuro \ --miniconda \ - conda_install="python=3.7 pytest jupyter jupyterlab jupyter_contrib_nbextensions + conda_install="python=3.8 pytest jupyter jupyterlab jupyter_contrib_nbextensions traits pandas matplotlib scikit-learn scikit-image seaborn nbformat nb_conda" \ pip_install="$NIPYPE_URL pybids==0.13.1 From b574d85b8fa65e6e46b7bf0b9e6bb4c6f9755414 Mon Sep 17 00:00:00 2001 From: mathiasg Date: Thu, 1 Sep 2022 15:44:33 -0400 Subject: [PATCH 8/9] TST: Add manual trigger option to GHA --- .github/workflows/testing.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index ccdc31d..b265c03 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -5,6 +5,12 @@ on: branches: [ master ] pull_request: branches: [ master ] + workflow_dispatch: + inputs: + nipype_branch: + description: 'Build specific Nipype branch' + required: true + default: 'master' jobs: @@ -14,7 +20,10 @@ jobs: steps: - uses: actions/checkout@v2 - name: generate the Dockerfile from generate.sh - run: bash generate.sh + run: | + BRANCH=${{ github.event.inputs.nipype_branch }} + BRANCH=${BRANCH:-"master"} + bash generate.sh $BRANCH # In this step, this action saves a list of existing images, # the cache is created without them in the post run. # It also restores the cache if it exists. From 9cc50bdf8151cca19bdea0398b2b63336161094d Mon Sep 17 00:00:00 2001 From: mathiasg Date: Wed, 21 Sep 2022 10:39:40 -0400 Subject: [PATCH 9/9] CI: Reset docker layer caching --- .github/workflows/testing.yml | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index b265c03..5ac3bc4 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -1,4 +1,4 @@ -name: CI +name: Build & run notebooks on: push: @@ -27,7 +27,12 @@ jobs: # In this step, this action saves a list of existing images, # the cache is created without them in the post run. # It also restores the cache if it exists. - - uses: satackey/action-docker-layer-caching@v0.0.7 + - uses: satackey/action-docker-layer-caching@v0.0.11 + with: + key: tutorial-docker-cache-{hash} + restore-keys: | + tutorial-docker-cache- + layer-tutorial-docker-cache- - name: build the image run: docker build . --file Dockerfile -t nipype_tutorial:latest @@ -35,8 +40,12 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: satackey/action-docker-layer-caching@v0.0.7 + - uses: satackey/action-docker-layer-caching@v0.0.11 + with: + key: tutorial-docker-cache-{hash} + restore-keys: | + tutorial-docker-cache- + layer-tutorial-docker-cache- - name: run test 1 run: docker run --rm nipype_tutorial:latest python /home/neuro/nipype_tutorial/test_notebooks.py 1 @@ -44,8 +53,12 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: satackey/action-docker-layer-caching@v0.0.7 + - uses: satackey/action-docker-layer-caching@v0.0.11 + with: + key: tutorial-docker-cache-{hash} + restore-keys: | + tutorial-docker-cache- + layer-tutorial-docker-cache- - name: run test 2 run: docker run --rm nipype_tutorial:latest python /home/neuro/nipype_tutorial/test_notebooks.py 2 @@ -53,7 +66,11 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: satackey/action-docker-layer-caching@v0.0.7 + - uses: satackey/action-docker-layer-caching@v0.0.11 + with: + key: tutorial-docker-cache-{hash} + restore-keys: | + tutorial-docker-cache- + layer-tutorial-docker-cache- - name: run test 3 run: docker run --rm nipype_tutorial:latest python /home/neuro/nipype_tutorial/test_notebooks.py 3