Skip to content

Commit d892072

Browse files
committed
Merge branch 'master' of git://github.com/nipy/nipype into rel/0.14.0
2 parents 13e454f + 14161a5 commit d892072

File tree

5 files changed

+28
-13
lines changed

5 files changed

+28
-13
lines changed

.circleci/config.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ jobs:
6767
echo "Pulling base image ..."
6868
docker pull nipype/nipype:base
6969
elif [ "$GET_BASE" == "BUILD" ]; then
70-
echo "Building base image ..."
71-
docker build -t nipype/nipype:base - < docker/Dockerfile.base
70+
e=1 && for i in {1..5}; do
71+
docker build -t nipype/nipype:base - < docker/Dockerfile.base && e=0 && break || sleep 15
72+
done && [ "$e" -eq "0" ]
7273
else
7374
echo "Error: method to get base image not understood"
7475
exit 1
@@ -138,15 +139,11 @@ jobs:
138139
nipype/nipype:py36 \
139140
nipype/nipype:py27 | gzip -1 > /tmp/docker/nipype-base-latest-py36-py27.tar.gz
140141
du -h /tmp/docker/nipype-base-latest-py36-py27.tar.gz
141-
else
142-
# Workaround for `persist_to_workspace` to succeed when we are
143-
# not deploying Docker images.
144-
touch /tmp/docker/nipype-base-latest-py36-py27.tar.gz
145142
fi
146143
- persist_to_workspace:
147144
root: /tmp
148145
paths:
149-
- docker/nipype-base-latest-py36-py27.tar.gz
146+
- docker/*
150147

151148

152149
deploy:

doc/users/plugins.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ Optional arguments::
8282
exceed the total amount of resources available (memory and threads), when
8383
``False`` (default), only a warning will be issued.
8484

85+
maxtasksperchild : number of nodes to run on each process before refreshing
86+
the worker (default: 10).
87+
88+
8589
To distribute processing on a multicore machine, simply call::
8690

8791
workflow.run(plugin='MultiProc')

docker/generate_dockerfiles.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ do
5353
done
5454

5555

56-
# neurodocker version 0.3.1-19-g8d02eb4
57-
NEURODOCKER_IMAGE="kaczmarj/neurodocker@sha256:6b5f92f413b9710b7581e62293a8f74438b14ce7e4ab1ce68db2a09f7c64375a"
56+
# neurodocker version 0.3.1-22-gb0ee069
57+
NEURODOCKER_IMAGE="kaczmarj/neurodocker@sha256:c670ec2e0666a63d4e017a73780f66554283e294f3b12250928ee74b8a48bc59"
5858

5959
# neurodebian:stretch-non-free pulled on November 3, 2017
6060
BASE_IMAGE="neurodebian@sha256:7590552afd0e7a481a33314724ae27f76ccedd05ffd7ac06ec38638872427b9b"

nipype/pipeline/plugins/multiproc.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def run_node(node, updatehash, taskid):
6060
class NonDaemonProcess(Process):
6161
"""A non-daemon process to support internal multiprocessing.
6262
"""
63+
6364
def _get_daemon(self):
6465
return False
6566

@@ -104,6 +105,8 @@ class MultiProcPlugin(DistributedPluginBase):
104105
- scheduler: sort jobs topologically (``'tsort'``, default value)
105106
or prioritize jobs by, first, memory consumption and, second,
106107
number of threads (``'mem_thread'`` option).
108+
- maxtasksperchild: number of nodes to run on each process before
109+
refreshing the worker (default: 10).
107110
108111
"""
109112

@@ -116,6 +119,7 @@ def __init__(self, plugin_args=None):
116119

117120
# Read in options or set defaults.
118121
non_daemon = self.plugin_args.get('non_daemon', True)
122+
maxtasks = self.plugin_args.get('maxtasksperchild', 10)
119123
self.processors = self.plugin_args.get('n_procs', cpu_count())
120124
self.memory_gb = self.plugin_args.get('memory_gb', # Allocate 90% of system memory
121125
get_system_total_memory_gb() * 0.9)
@@ -124,7 +128,14 @@ def __init__(self, plugin_args=None):
124128
# Instantiate different thread pools for non-daemon processes
125129
logger.debug('MultiProcPlugin starting in "%sdaemon" mode (n_procs=%d, mem_gb=%0.2f)',
126130
'non' if non_daemon else '', self.processors, self.memory_gb)
127-
self.pool = (NonDaemonPool if non_daemon else Pool)(processes=self.processors)
131+
132+
NipypePool = NonDaemonPool if non_daemon else Pool
133+
try:
134+
self.pool = NipypePool(processes=self.processors,
135+
maxtasksperchild=maxtasks)
136+
except TypeError:
137+
self.pool = NipypePool(processes=self.processors)
138+
128139
self._stats = None
129140

130141
def _async_callback(self, args):

nipype/pkg_info.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33

44
from future import standard_library
55
standard_library.install_aliases()
6+
from builtins import open
67
import configparser
78

89
import os
910
import sys
1011
import subprocess
1112

12-
from .info import VERSION
13-
1413
COMMIT_INFO_FNAME = 'COMMIT_INFO.txt'
1514
PY3 = sys.version_info[0] >= 3
1615

@@ -52,7 +51,8 @@ def pkg_commit_hash(pkg_path):
5251
cfg_parser = configparser.RawConfigParser()
5352
else:
5453
cfg_parser = configparser.ConfigParser()
55-
cfg_parser.read(pth)
54+
with open(pth, encoding='utf-8') as fp:
55+
cfg_parser.readfp(fp)
5656
archive_subst = cfg_parser.get('commit hash', 'archive_subst_hash')
5757
if not archive_subst.startswith('$Format'): # it has been substituted
5858
return 'archive substitution', archive_subst
@@ -86,6 +86,9 @@ def get_pkg_info(pkg_path):
8686
with named parameters of interest
8787
'''
8888
src, hsh = pkg_commit_hash(pkg_path)
89+
from .info import VERSION
90+
if not PY3:
91+
src, hsh, VERSION = src.encode(), hsh.encode(), VERSION.encode()
8992
import networkx
9093
import nibabel
9194
import numpy

0 commit comments

Comments
 (0)