Skip to content

Commit e9c96a7

Browse files
committed
Merge remote-tracking branch 'origin/fix/use_current_prov' into fix/use_current_prov
* origin/fix/use_current_prov: fix: string decoding for prov literal and few pipeline job submission info statements
2 parents ca2be1f + 233f05d commit e9c96a7

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

nipype/pipeline/plugins/base.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,10 @@ def _send_procs_to_workers(self, updatehash=False, graph=None):
342342
(self.depidx.sum(axis=0) == 0).__array__())
343343
if len(jobids) > 0:
344344
# send all available jobs
345-
logger.info('Submitting %d jobs' % len(jobids[:slots]))
345+
if slots:
346+
logger.info('Pending[%d] Submitting[%d] jobs Slots[%d]' % (num_jobs, len(jobids[:slots]), slots))
347+
else:
348+
logger.info('Pending[%d] Submitting[%d] jobs Slots[inf]' % (num_jobs, len(jobids)))
346349
for jobid in jobids[:slots]:
347350
if isinstance(self.procs[jobid], MapNode):
348351
try:
@@ -401,6 +404,8 @@ def _send_procs_to_workers(self, updatehash=False, graph=None):
401404
self.proc_pending[jobid] = False
402405
else:
403406
self.pending_tasks.insert(0, (tid, jobid))
407+
logger.info('Finished executing: %s ID: %d' %
408+
(self.procs[jobid]._id, jobid))
404409
else:
405410
break
406411

@@ -507,9 +512,6 @@ def _get_result(self, taskid):
507512
timed_out = True
508513
while (time() - t) < timeout:
509514
try:
510-
logger.debug(os.listdir(os.path.realpath(os.path.join(node_dir,
511-
'..'))))
512-
logger.debug(os.listdir(node_dir))
513515
glob(os.path.join(node_dir, 'result_*.pklz')).pop()
514516
timed_out = False
515517
break
@@ -633,9 +635,6 @@ def _get_result(self, taskid):
633635
return None
634636
node_dir = self._pending[taskid]
635637

636-
logger.debug(os.listdir(os.path.realpath(os.path.join(node_dir,
637-
'..'))))
638-
logger.debug(os.listdir(node_dir))
639638
glob(os.path.join(node_dir, 'result_*.pklz')).pop()
640639

641640
results_file = glob(os.path.join(node_dir, 'result_*.pklz'))[0]

nipype/utils/provenance.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def safe_encode(x, as_literal=True):
119119
if x is None:
120120
value = "Unknown"
121121
if as_literal:
122-
return pm.Literal(value, pm.XSD['string'])
122+
return pm.Literal(value.decode('utf-8'), pm.XSD['string'])
123123
else:
124124
return value
125125
try:
@@ -131,15 +131,15 @@ def safe_encode(x, as_literal=True):
131131
try:
132132
return pm.URIRef(value)
133133
except AttributeError:
134-
return pm.Literal(value, pm.XSD['anyURI'])
134+
return pm.Literal(value.decode('utf-8'), pm.XSD['anyURI'])
135135
else:
136136
if len(x) > max_text_len:
137137
value = x[:max_text_len - 13] + ['...Clipped...']
138138
else:
139139
value = x
140140
if not as_literal:
141141
return value
142-
return pm.Literal(value, pm.XSD['string'])
142+
return pm.Literal(value.decode('utf-8'), pm.XSD['string'])
143143
if isinstance(x, int):
144144
if not as_literal:
145145
return x
@@ -158,7 +158,7 @@ def safe_encode(x, as_literal=True):
158158
outdict[key] = encoded_value
159159
if not as_literal:
160160
return simplejson.dumps(outdict)
161-
return pm.Literal(simplejson.dumps(outdict), pm.XSD['string'])
161+
return pm.Literal(simplejson.dumps(outdict).decode('utf-8'), pm.XSD['string'])
162162
if isinstance(x, list):
163163
try:
164164
nptype = np.array(x).dtype
@@ -176,7 +176,7 @@ def safe_encode(x, as_literal=True):
176176
outlist = x
177177
if not as_literal:
178178
return simplejson.dumps(outlist)
179-
return pm.Literal(simplejson.dumps(outlist), pm.XSD['string'])
179+
return pm.Literal(simplejson.dumps(outlist).decode('utf-8'), pm.XSD['string'])
180180
if not as_literal:
181181
return dumps(x)
182182
return pm.Literal(dumps(x), nipype_ns['pickle'])
@@ -185,7 +185,7 @@ def safe_encode(x, as_literal=True):
185185
value = "Could not encode: " + str(e)
186186
if not as_literal:
187187
return value
188-
return pm.Literal(value, pm.XSD['string'])
188+
return pm.Literal(value.decode('utf-8'), pm.XSD['string'])
189189

190190

191191
def prov_encode(graph, value, create_container=True):

0 commit comments

Comments
 (0)