Skip to content

Commit ce7682c

Browse files
committed
Try a fix for (populse/mia_processes#40)
1 parent 1b8c295 commit ce7682c

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

populse_mia/user_interface/pipeline_manager/process_mia.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
# Soma-base import
4444
from soma.controller.trait_utils import relax_exists_constraint
4545
from soma.utils.weak_proxy import get_ref
46-
from traits.trait_base import Undefined
4746

4847
# Populse_MIA imports
4948
from populse_mia.data_manager.project import COLLECTION_CURRENT
@@ -208,7 +207,7 @@ def complete_attributes_with_database(self, process_inputs={}):
208207
return attributes
209208

210209
@staticmethod
211-
def complete_nipype_common(process):
210+
def complete_nipype_common(process, output_dir=True):
212211
"""
213212
Set Nipype parameters for SPM. This is used both on
214213
:class:`NipypeProcess` and :class:`ProcessMIA` instances which have the
@@ -217,6 +216,8 @@ def complete_nipype_common(process):
217216
Parameters
218217
----------
219218
process: a process
219+
output_dir: a boolean. If False, the output_directory attribute value
220+
is not initialised
220221
221222
"""
222223

@@ -243,13 +244,20 @@ def complete_nipype_common(process):
243244
process.project = project
244245

245246
# set output_directory
246-
if process.trait(
247-
"output_directory"
248-
) and process.output_directory in (None, Undefined, ""):
247+
out_dir = None
248+
if process.trait("output_directory"):
249249
out_dir = os.path.abspath(
250250
os.path.join(project.folder, "data", "derived_data")
251251
)
252252

253+
else:
254+
print(
255+
"populse_mia.user_interface.pipeline_manager."
256+
"MiaProcessCompletionEngine.complete_nipype_common:"
257+
"\n - The output_directory trait does not exist!)"
258+
)
259+
260+
if output_dir is True and out_dir is not None:
253261
# ensure this output_directory exists since it is not
254262
# actually an output but an input, and thus it is supposed
255263
# to exist in Capsul.
@@ -511,7 +519,9 @@ def complete_parameters_mia(self, process_inputs={}):
511519
print("value:", repr(value))
512520
traceback.print_exc()
513521

514-
MIAProcessCompletionEngine.complete_nipype_common(process)
522+
MIAProcessCompletionEngine.complete_nipype_common(
523+
process, output_dir=False
524+
)
515525

516526
def get_attribute_values(self):
517527
"""Re-route to underlying fallback engine."""

0 commit comments

Comments
 (0)