##// END OF EJS Templates
avoid double-iteration over engine IDs in get_dict
MinRK -
Show More
@@ -195,15 +195,17 b' class AsyncResult(object):'
195 195 results = [results]
196 196 engine_ids = [ md['engine_id'] for md in self._metadata ]
197 197
198 seen = set()
199 for engine_id in engine_ids:
200 if engine_id in seen:
201 raise ValueError("Cannot build dict, %i jobs ran on engine #%i"%(
202 engine_ids.count(engine_id), engine_id))
198
199 rdict = {}
200 for engine_id, result in zip(engine_ids, results):
201 if engine_id in rdict:
202 raise ValueError("Cannot build dict, %i jobs ran on engine #%i" % (
203 engine_ids.count(engine_id), engine_id)
204 )
203 205 else:
204 seen.add(engine_id)
206 rdict[engine_id] = result
205 207
206 return dict(zip(engine_ids,results))
208 return rdict
207 209
208 210 @property
209 211 def result(self):
General Comments 0
You need to be logged in to leave comments. Login now