Dan Shi | 07e09af | 2013-04-12 09:31:29 -0700 | [diff] [blame^] | 1 | import sys |
| 2 | |
| 3 | from autotest_lib.site_utils.graphite import stats |
| 4 | |
| 5 | def reset(machine): |
| 6 | print 'Starting to reset host ' + machine |
| 7 | timer = None |
| 8 | try: |
| 9 | host = hosts.create_host(machine, initialize=False, auto_monitor=False) |
| 10 | timer = stats.Timer('reset_time.%s' % |
| 11 | host._get_board_from_afe()) |
| 12 | timer.start() |
| 13 | # Assume cleanup always runs first. |
| 14 | host.cleanup() |
| 15 | host.verify() |
| 16 | job.record('GOOD', None, 'reset', |
| 17 | '%s is reset successfully' % machine) |
| 18 | except Exception as e: |
| 19 | msg = 'reset failed: %s' % e |
| 20 | job.record('FAIL', None, 'reset', msg) |
| 21 | raise |
| 22 | finally: |
| 23 | if timer: |
| 24 | timer.stop() |
| 25 | |
| 26 | |
| 27 | job.parallel_simple(reset, machines) |