Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug for work dirs longer than 255 characters, fixes #2061 #3495

Merged
merged 4 commits into from
Sep 5, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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).
prioux committed Jul 21, 2022
commit 99aad8ab6c6e2d904ed3b1cbc196e006623167c3
3 changes: 2 additions & 1 deletion nipype/pipeline/engine/nodes.py
Original file line number Diff line number Diff line change
@@ -295,7 +295,8 @@ def output_dir(self):
if self.parameterization:
params_str = ["{}".format(p) for p in self.parameterization]
if not str2bool(self.config["execution"]["parameterize_dirs"]):
params_str = [_parameterization_dir(p) for p in params_str]
params_str = [_parameterization_dir(p,32) for p in params_str]
params_str = [_parameterization_dir(p,252) for p in params_str]
outputdir = op.join(outputdir, *params_str)

self._output_dir = op.realpath(op.join(outputdir, self.name))
6 changes: 3 additions & 3 deletions nipype/pipeline/engine/utils.py
Original file line number Diff line number Diff line change
@@ -51,14 +51,14 @@
logger = logging.getLogger("nipype.workflow")


def _parameterization_dir(param):
def _parameterization_dir(param,maxlen):
"""
Returns the directory name for the given parameterization string as follows:
- If the parameterization is longer than 32 characters, then
- If the parameterization is longer than maxlen characters, then
return the SHA-1 hex digest.
- Otherwise, return the parameterization unchanged.
"""
if len(param) > 32:
if len(param) > maxlen:
return sha1(param.encode()).hexdigest()
return param