Revision e7beaa02
b/tools/burnin | ||
---|---|---|
201 | 201 |
ARGUMENTS = [cli.ArgInstance(min=1)] |
202 | 202 |
|
203 | 203 |
|
204 |
def _DoCheckInstances(fn): |
|
205 |
"""Decorator for checking instances. |
|
206 |
|
|
207 |
""" |
|
208 |
def wrapper(self, *args, **kwargs): |
|
209 |
val = fn(self, *args, **kwargs) |
|
210 |
for instance in self.instances: |
|
211 |
self._CheckInstanceAlive(instance) |
|
212 |
return val |
|
213 |
|
|
214 |
return wrapper |
|
215 |
|
|
216 |
|
|
217 |
def _DoBatch(retry): |
|
218 |
"""Decorator for possible batch operations. |
|
219 |
|
|
220 |
Must come after the _DoCheckInstances decorator (if any). |
|
221 |
|
|
222 |
@param retry: whether this is a retryable batch, will be |
|
223 |
passed to StartBatch |
|
224 |
|
|
225 |
""" |
|
226 |
def wrap(fn): |
|
227 |
def batched(self, *args, **kwargs): |
|
228 |
self.StartBatch(retry) |
|
229 |
val = fn(self, *args, **kwargs) |
|
230 |
self.CommitQueue() |
|
231 |
return val |
|
232 |
return batched |
|
233 |
|
|
234 |
return wrap |
|
235 |
|
|
236 |
|
|
204 | 237 |
class Burner(object): |
205 | 238 |
"""Burner class.""" |
206 | 239 |
|
... | ... | |
350 | 383 |
raise BurninFailure() |
351 | 384 |
return results |
352 | 385 |
|
353 |
def _DoCheckInstances(fn): |
|
354 |
"""Decorator for checking instances. |
|
355 |
|
|
356 |
""" |
|
357 |
def wrapper(self, *args, **kwargs): |
|
358 |
val = fn(self, *args, **kwargs) |
|
359 |
for instance in self.instances: |
|
360 |
self._CheckInstanceAlive(instance) |
|
361 |
return val |
|
362 |
|
|
363 |
return wrapper |
|
364 |
|
|
365 |
def _DoBatch(retry): |
|
366 |
"""Decorator for possible batch operations. |
|
367 |
|
|
368 |
Must come after the _DoCheckInstances decorator (if any). |
|
369 |
|
|
370 |
@param retry: whether this is a retryable batch, will be |
|
371 |
passed to StartBatch |
|
372 |
|
|
373 |
""" |
|
374 |
def wrap(fn): |
|
375 |
def batched(self, *args, **kwargs): |
|
376 |
self.StartBatch(retry) |
|
377 |
val = fn(self, *args, **kwargs) |
|
378 |
self.CommitQueue() |
|
379 |
return val |
|
380 |
return batched |
|
381 |
|
|
382 |
return wrap |
|
383 |
|
|
384 | 386 |
def ParseOptions(self): |
385 | 387 |
"""Parses the command line options. |
386 | 388 |
|
Also available in: Unified diff