Home | History | Annotate | Download | only in control_segments
      1 from autotest_lib.client.common_lib.cros.graphite import autotest_stats
      2 from autotest_lib.server import utils
      3 from autotest_lib.server.cros import provision
      4 
      5 
      6 # A string of the form 'label1,label2:value,label3'.
      7 job_labels = locals().get('job_labels') or ','.join(args)
      8 labels_list = [l.strip() for l in job_labels.split(',') if l]
      9 
     10 
     11 def verify(machine):
     12     print 'Initializing host %s' % machine
     13     timer = None
     14     # We set try_lab_servo to True to trigger servo verify and
     15     # servo update if needed.
     16     target = hosts.create_target_machine(machine, initialize=False,
     17                                          auto_monitor=False, try_lab_servo=True)
     18     try:
     19         job.record('START', None, 'verify')
     20         timer = autotest_stats.Timer('verify_time')
     21         timer.start()
     22 
     23         target.verify()
     24         provision.run_special_task_actions(job, target, labels_list,
     25                                            provision.Verify)
     26     except Exception as e:
     27         logging.exception(e)
     28         job.record('END FAIL', None, 'verify')
     29         # See the provision control segment for the explanation of why we're
     30         # doing this.
     31         raise Exception('')
     32     else:
     33         job.record('END GOOD', None, 'verify',
     34                    '%s verified successfully' % machine)
     35     finally:
     36         if timer:
     37             timer.stop()
     38 
     39 
     40 job.parallel_simple(verify, machines)
     41 
     42 # vim: set syntax=python :
     43