Skip to content

Commit ec43408

Browse files
committed
Fixed bug for work dirs longer than 255 characters
This change is fully backwards compatible and will not affect existing pipelines, but it will prevent the pipeline engine from crashing when some parameters are long and it was trying to create subdirectories longer than 255 characters (a typical unix limit).
1 parent ff8e514 commit ec43408

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

nipype/pipeline/engine/nodes.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ def output_dir(self):
295295
if self.parameterization:
296296
params_str = ["{}".format(p) for p in self.parameterization]
297297
if not str2bool(self.config["execution"]["parameterize_dirs"]):
298-
params_str = [_parameterization_dir(p) for p in params_str]
298+
params_str = [_parameterization_dir(p,32) for p in params_str]
299+
params_str = [_parameterization_dir(p,252) for p in params_str]
299300
outputdir = op.join(outputdir, *params_str)
300301

301302
self._output_dir = op.realpath(op.join(outputdir, self.name))

nipype/pipeline/engine/utils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@
5151
logger = logging.getLogger("nipype.workflow")
5252

5353

54-
def _parameterization_dir(param):
54+
def _parameterization_dir(param,maxlen):
5555
"""
5656
Returns the directory name for the given parameterization string as follows:
57-
- If the parameterization is longer than 32 characters, then
57+
- If the parameterization is longer than maxlen characters, then
5858
return the SHA-1 hex digest.
5959
- Otherwise, return the parameterization unchanged.
6060
"""
61-
if len(param) > 32:
61+
if len(param) > manlen:
6262
return sha1(param.encode()).hexdigest()
6363
return param
6464

0 commit comments

Comments
 (0)