Skip to content

Commit 8d831e1

Browse files
committed
FIX: Check for runtime attributes
1 parent f328a96 commit 8d831e1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

nipype/interfaces/base/core.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ def run(self, cwd=None, ignore_exception=None, **inputs):
500500
platform=platform.platform(),
501501
hostname=platform.node(),
502502
version=self.version)
503+
runtime_attrs = set(runtime.keys())
503504

504505
mon_sp = None
505506
if enable_rm:
@@ -540,9 +541,10 @@ def run(self, cwd=None, ignore_exception=None, **inputs):
540541
if not ignore_exception:
541542
raise
542543
finally:
543-
if runtime is None:
544-
raise RuntimeError("{} interface failed to return runtime "
545-
"object".format(interface.__class__.__name__))
544+
if runtime is None or runtime_attrs - set(runtime.keys()):
545+
raise RuntimeError("{} interface failed to return valid "
546+
"runtime object".format(
547+
interface.__class__.__name__))
546548
# This needs to be done always
547549
runtime.endTime = dt.isoformat(dt.utcnow())
548550
timediff = parseutc(runtime.endTime) - parseutc(runtime.startTime)

nipype/interfaces/base/support.py

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ def update(self, *args, **kwargs):
6868
Note: update is very much like HasTraits.set"""
6969
self.__dict__.update(*args, **kwargs)
7070

71+
def keys(self):
72+
return list(self.__dict__.keys())
73+
7174
def items(self):
7275
"""iterates over bunch attributes as key, value pairs"""
7376
return list(self.__dict__.items())

0 commit comments

Comments
 (0)