##// END OF EJS Templates
fix AsyncResult.get_dict for single result...
MinRK -
Show More
@@ -191,12 +191,17 b' class AsyncResult(object):'
191 191 """
192 192
193 193 results = self.get(timeout)
194 if self._single_result:
195 results = [results]
194 196 engine_ids = [ md['engine_id'] for md in self._metadata ]
195 bycount = sorted(engine_ids, key=lambda k: engine_ids.count(k))
196 maxcount = bycount.count(bycount[-1])
197 if maxcount > 1:
198 raise ValueError("Cannot build dict, %i jobs ran on engine #%i"%(
199 maxcount, bycount[-1]))
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))
203 else:
204 seen.add(engine_id)
200 205
201 206 return dict(zip(engine_ids,results))
202 207
General Comments 0
You need to be logged in to leave comments. Login now