##// 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 results = [results]
195 results = [results]
196 engine_ids = [ md['engine_id'] for md in self._metadata ]
196 engine_ids = [ md['engine_id'] for md in self._metadata ]
197
197
198 seen = set()
198
199 for engine_id in engine_ids:
199 rdict = {}
200 if engine_id in seen:
200 for engine_id, result in zip(engine_ids, results):
201 if engine_id in rdict:
201 raise ValueError("Cannot build dict, %i jobs ran on engine #%i"%(
202 raise ValueError("Cannot build dict, %i jobs ran on engine #%i" % (
202 engine_ids.count(engine_id), engine_id))
203 engine_ids.count(engine_id), engine_id)
204 )
203 else:
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 @property
210 @property
209 def result(self):
211 def result(self):
General Comments 0
You need to be logged in to leave comments. Login now