Skip to content

Commit fce47e9

Browse files
committed
Fixing paths
- Fixed paths in tests - Fixed paths in scripts installed in Dockerfile - Fixed run_examples.py for improved coverage logging - Simplified the __version__ handling, so it can be replaced in circle
1 parent 3988d57 commit fce47e9

File tree

7 files changed

+84
-70
lines changed

7 files changed

+84
-70
lines changed

.circle/tests.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ fi
1717
# They may need to be rebalanced in the future.
1818
case ${CIRCLE_NODE_INDEX} in
1919
0)
20-
docker run --rm -it -e FSL_COURSE_DATA="/root/examples/nipype-fsl_course_data" -v $HOME/examples:/root/examples:ro -v $WORKDIR:/work -w /root/src/nipype nipype/nipype:py27 /usr/bin/run_pytests.sh py27 && \
21-
docker run --rm -it -e FSL_COURSE_DATA="/root/examples/nipype-fsl_course_data" -v $HOME/examples:/root/examples:ro -v $WORKDIR:/work -w /root/src/nipype nipype/nipype:py35 /usr/bin/run_pytests.sh py35 && \
22-
docker run --rm -it -v $WORKDIR:/work -w /root/src/nipype/doc nipype/nipype:py35 /usr/bin/run_builddocs.sh && \
23-
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh test_spm Linear /root/examples/ workflow3d && \
24-
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh test_spm Linear /root/examples/ workflow4d
20+
docker run --rm -it -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /src/nipype nipype/nipype:py27 /usr/bin/run_pytests.sh py27 && \
21+
docker run --rm -it -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /src/nipype nipype/nipype:py35 /usr/bin/run_pytests.sh py35 && \
22+
docker run --rm -it -v $WORKDIR:/work -w /src/nipype/doc nipype/nipype:py35 /usr/bin/run_builddocs.sh && \
23+
docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow3d && \
24+
docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow4d
2525
;;
2626
1)
27-
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /root/examples/ level1 && \
28-
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /root/examples/ l2pipeline
27+
docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ level1 && \
28+
docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ l2pipeline
2929
;;
3030
2)
31-
docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/root/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py27 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /root/examples/ level1 && \
32-
docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/root/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /root/examples/ l2pipeline
31+
docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py27 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ level1 && \
32+
docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ l2pipeline
3333
;;
3434
3)
35-
docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/root/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /root/examples/ level1 && \
36-
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_fsl_feeds Linear /root/examples/ l1pipeline && \
37-
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_fsl_reuse Linear /root/examples/ level1_workflow
35+
docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ level1 && \
36+
docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_fsl_feeds Linear /data/examples/ l1pipeline && \
37+
docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_fsl_reuse Linear /data/examples/ level1_workflow
3838
;;
3939
esac

.coveragerc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[run]
22
branch = True
3-
source = nipype
43
include = */nipype/*
54
omit =
65
*/nipype/external/*

Dockerfile

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@
3333
FROM nipype/base:latest
3434
MAINTAINER The nipype developers https://github.com/nipy/nipype
3535

36-
ARG BUILD_DATE
37-
ARG VCS_REF
38-
ARG VERSION
3936
ARG PYTHON_VERSION_MAJOR=3
40-
ARG PYTHON_VERSION_MINOR=5
4137

4238
# Installing and setting up miniconda
4339
RUN curl -sSLO https://repo.continuum.io/miniconda/Miniconda${PYTHON_VERSION_MAJOR}-4.2.12-Linux-x86_64.sh && \
@@ -54,11 +50,9 @@ ENV PATH=/usr/local/miniconda/bin:$PATH \
5450
# only use one thread - nipype will handle parallelization
5551

5652
# Installing precomputed python packages
57-
RUN conda config --add channels conda-forge --add channels intel && \
58-
chmod +x /usr/local/miniconda/bin/* && \
59-
conda config --set always_yes yes --set changeps1 no && \
60-
conda update -q conda && \
61-
chmod +x /usr/local/miniconda/bin/*; sync && \
53+
ARG PYTHON_VERSION_MINOR=5
54+
RUN conda config --add channels conda-forge; sync && \
55+
conda config --set always_yes yes --set changeps1 no; sync && \
6256
conda install -y python=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} \
6357
mkl \
6458
numpy \
@@ -71,7 +65,7 @@ RUN conda config --add channels conda-forge --add channels intel && \
7165
traits=4.6.0 \
7266
psutil \
7367
icu=58.1 && \
74-
find /usr/local/miniconda/ -exec chmod 775 {} +
68+
sync;
7569

7670
# matplotlib cleanups: set default backend, precaching fonts
7771
RUN sed -i 's/\(backend *: \).*$/\1Agg/g' /usr/local/miniconda/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/matplotlib/mpl-data/matplotlibrc && \
@@ -101,6 +95,9 @@ RUN rm -rf ${FSLDIR}/bin/imglob && \
10195

10296
WORKDIR /work/
10397

98+
ARG BUILD_DATE
99+
ARG VCS_REF
100+
ARG VERSION
104101
LABEL org.label-schema.build-date=$BUILD_DATE \
105102
org.label-schema.name="NIPYPE" \
106103
org.label-schema.description="NIPYPE - Neuroimaging in Python: Pipelines and Interfaces" \

docker/files/run_builddocs.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ set -e
33
set -x
44
set -u
55

6-
mkdir -p /scratch/docs
7-
make html 2>&1 | tee /scratch/builddocs.log
8-
cp -r /root/src/nipype/doc/_build/html/* /scratch/docs/
9-
cat /scratch/builddocs.log && if grep -q "ERROR" /scratch/builddocs.log; then false; else true; fi
6+
WORKDIR=${WORK:-/work}
7+
8+
mkdir -p ${WORKDIR}/docs
9+
make html 2>&1 | tee ${WORKDIR}/builddocs.log
10+
cp -r /src/nipype/doc/_build/html/* ${WORKDIR}/docs/
11+
cat ${WORKDIR}/builddocs.log && if grep -q "ERROR" ${WORKDIR}/builddocs.log; then false; else true; fi

docker/files/run_examples.sh

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,37 @@ set -e
33
set -x
44
set -u
55

6-
mkdir -p /root/.nipype
7-
echo '[logging]' > /root/.nipype/nipype.cfg
8-
echo 'workflow_level = DEBUG' >> /root/.nipype/nipype.cfg
9-
echo 'interface_level = DEBUG' >> /root/.nipype/nipype.cfg
10-
echo 'filemanip_level = DEBUG' >> /root/.nipype/nipype.cfg
11-
echo 'log_to_file = true' >> /root/.nipype/nipype.cfg
12-
echo 'log_directory = /scratch/logs/' >> /root/.nipype/nipype.cfg
13-
14-
coverage run /root/src/nipype/tools/run_examples.py $@
6+
WORKDIR=${WORK:-/work}
157
arr=$@
168
tmp_var=$( IFS=$' '; echo "${arr[*]}" )
17-
coverage xml -o "/scratch/smoketest_${tmp_var//[^A-Za-z0-9_-]/_}.xml"
9+
example_id=${tmp_var//[^A-Za-z0-9_-]/_}
10+
11+
mkdir -p ${HOME}/.nipype ${WORKDIR}/logs/example_${example_id}
12+
echo "[logging]" > ${HOME}/.nipype/nipype.cfg
13+
echo "workflow_level = DEBUG" >> ${HOME}/.nipype/nipype.cfg
14+
echo "interface_level = DEBUG" >> ${HOME}/.nipype/nipype.cfg
15+
echo "filemanip_level = DEBUG" >> ${HOME}/.nipype/nipype.cfg
16+
echo "log_to_file = true" >> ${HOME}/.nipype/nipype.cfg
17+
echo "log_directory = ${WORKDIR}/logs/example_${example_id}" >> ${HOME}/.nipype/nipype.cfg
18+
19+
# Set up coverage
20+
echo "[run]" >> .coveragerc
21+
echo "branch = True" >> .coveragerc
22+
echo "source = /src/nipype" >> .coveragerc
23+
echo "include = */nipype/*" >> .coveragerc
24+
echo "omit =" >> .coveragerc
25+
echo " */nipype/external/*" >> .coveragerc
26+
echo " */nipype/fixes/*" >> .coveragerc
27+
echo " */setup.py" >> .coveragerc
28+
29+
30+
parallel=""
31+
if [ "$2" == "MultiProc" ]; then
32+
parallel="--concurrency=multiprocessing"
33+
fi
34+
35+
coverage run ${parallel} /src/nipype/tools/run_examples.py $@
36+
test_exit=$?
37+
coverage xml -o "${WORKDIR}/smoketest_${example_id}.xml"
38+
39+
exit $test_exit

docker/files/run_pytests.sh

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,37 @@ set -e
33
set -x
44
set -u
55

6+
WORKDIR=${WORK:-/work}
67
PYTHON_VERSION=$( python -c "import sys; print('{}{}'.format(sys.version_info[0], sys.version_info[1]))" )
78

89
# Create necessary directories
9-
mkdir -p /scratch/crashfiles /scratch/logs/py${PYTHON_VERSION}
10+
mkdir -p ${WORKDIR}/crashfiles ${WORKDIR}/logs/py${PYTHON_VERSION}
1011

1112
# Create a nipype config file
12-
mkdir -p /root/.nipype
13-
echo '[logging]' > /root/.nipype/nipype.cfg
14-
echo 'log_to_file = true' >> /root/.nipype/nipype.cfg
15-
echo "log_directory = /scratch/logs/py${PYTHON_VERSION}" >> /root/.nipype/nipype.cfg
13+
mkdir -p ${HOME}/.nipype
14+
echo '[logging]' > ${HOME}/.nipype/nipype.cfg
15+
echo 'log_to_file = true' >> ${HOME}/.nipype/nipype.cfg
16+
echo "log_directory = ${WORKDIR}/logs/py${PYTHON_VERSION}" >> ${HOME}/.nipype/nipype.cfg
1617

1718
# Enable profile_runtime tests only for python 2.7
1819
if [[ "${PYTHON_VERSION}" -lt "30" ]]; then
19-
echo '[execution]' >> /root/.nipype/nipype.cfg
20-
echo 'profile_runtime = true' >> /root/.nipype/nipype.cfg
20+
echo '[execution]' >> ${HOME}/.nipype/nipype.cfg
21+
echo 'profile_runtime = true' >> ${HOME}/.nipype/nipype.cfg
2122
fi
2223

23-
# Run tests using pytest
24-
cd /root/src/nipype/
24+
cd /src/nipype/
2525
make clean
26-
py.test -n ${CIRCLE_NCPUS:-4} --doctest-modules --junitxml=/scratch/pytests_py${PYTHON_VERSION}.xml --cov-report xml:/scratch/coverage_py${PYTHON_VERSION}.xml --cov=nipype nipype
26+
# Run tests using pytest
27+
py.test -n ${CIRCLE_NCPUS:-4} --doctest-modules --junitxml=${WORKDIR}/pytests_py${PYTHON_VERSION}.xml --cov-report xml:${WORKDIR}/coverage_py${PYTHON_VERSION}.xml --cov=nipype nipype
2728

2829

2930
# Workaround: run here the profiler tests in python 3
3031
if [[ "${PYTHON_VERSION}" -ge "30" ]]; then
31-
echo '[execution]' >> /root/.nipype/nipype.cfg
32-
echo 'profile_runtime = true' >> /root/.nipype/nipype.cfg
33-
py.test -n ${CIRCLE_NCPUS:-4} --junitxml=/scratch/pytests_py${PYTHON_VERSION}_profiler.xml --cov-report xml:/scratch/coverage_py${PYTHON_VERSION}_profiler.xml --cov=nipype nipype/interfaces/tests/test_runtime_profiler.py
34-
py.test -n ${CIRCLE_NCPUS:-4} --junitxml=/scratch/pytests_py${PYTHON_VERSION}_multiproc.xml --cov-report xml:/scratch/coverage_py${PYTHON_VERSION}_multiproc.xml --cov=nipype nipype/pipeline/plugins/tests/test_multiproc*.py
32+
echo '[execution]' >> ${HOME}/.nipype/nipype.cfg
33+
echo 'profile_runtime = true' >> ${HOME}/.nipype/nipype.cfg
34+
py.test -n ${CIRCLE_NCPUS:-4} --junitxml=${WORKDIR}/pytests_py${PYTHON_VERSION}_profiler.xml --cov-report xml:${WORKDIR}/coverage_py${PYTHON_VERSION}_profiler.xml --cov=nipype nipype/interfaces/tests/test_runtime_profiler.py
35+
py.test -n ${CIRCLE_NCPUS:-4} --junitxml=${WORKDIR}/pytests_py${PYTHON_VERSION}_multiproc.xml --cov-report xml:${WORKDIR}/coverage_py${PYTHON_VERSION}_multiproc.xml --cov=nipype nipype/pipeline/plugins/tests/test_multiproc*.py
3536
fi
3637

3738
# Copy crashfiles to scratch
38-
for i in $(find /root/src/nipype/ -name "crash-*" ); do cp $i /scratch/crashfiles/; done
39+
find /src/nipype/ -name "crash-*" -exec cp {} ${WORKDIR}/crashfiles/ \;

nipype/info.py

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
from __future__ import print_function, division, unicode_literals, absolute_import
66

77

8-
# nipype version information. An empty _version_extra corresponds to a
9-
# full release. '.dev' as a _version_extra string means this is a development
8+
# nipype version information. An empty version_extra corresponds to a
9+
# full release. '.dev' as a version_extra string means this is a development
1010
# version
11-
_version_major = 0
12-
_version_minor = 13
13-
_version_micro = 0
14-
_version_extra = '-dev' # Remove -dev for release
11+
# Remove -dev for release
12+
__version__ = '0.13.0-dev'
1513

1614

1715
def get_nipype_gitversion():
@@ -43,16 +41,10 @@ def get_nipype_gitversion():
4341
ver = o.decode().strip().split('-')[-1]
4442
return ver
4543

46-
if '-dev' in _version_extra:
44+
if __version__.endswith('-dev'):
4745
gitversion = get_nipype_gitversion()
4846
if gitversion:
49-
_version_extra = '-' + gitversion + '.dev'
50-
51-
# Format expected by setup.py and doc/source/conf.py: string of form 'X.Y.Z'
52-
__version__ = '%s.%s.%s%s' % (_version_major,
53-
_version_minor,
54-
_version_micro,
55-
_version_extra)
47+
__version__ = __version__.replace('-dev', '-' + gitversion + '.dev')
5648

5749
CLASSIFIERS = ['Development Status :: 5 - Production/Stable',
5850
'Environment :: Console',
@@ -126,10 +118,11 @@ def get_nipype_gitversion():
126118
AUTHOR = 'nipype developers'
127119
AUTHOR_EMAIL = '[email protected]'
128120
PLATFORMS = 'OS Independent'
129-
MAJOR = _version_major
130-
MINOR = _version_minor
131-
MICRO = _version_micro
132-
ISRELEASE = _version_extra == ''
121+
MAJOR = __version__.split('.')[0]
122+
MINOR = __version__.split('.')[1]
123+
MICRO = __version__.replace('-', '.').split('.')[2]
124+
ISRELEASE = (len(__version__.replace('-', '.').split('.')) == 3 or
125+
'post' in __version__.replace('-', '.').split('.')[-1])
133126
VERSION = __version__
134127
PROVIDES = ['nipype']
135128
REQUIRES = [

0 commit comments

Comments
 (0)