Home | History | Annotate | Download | only in common_lib
      1 """
      2 This module contains the status enums for use by HostQueueEntrys in the
      3 database.  It is a stand alone module as these status strings are needed
      4 from various disconnected pieces of code that should not depend on everything
      5 that frontend.afe.models depends on such as RPC clients.
      6 """
      7 
      8 from autotest_lib.client.common_lib import enum
      9 
     10 Status_list = ['Queued', 'Starting', 'Resetting', 'Verifying', 'Provisioning',
     11                'Pending', 'Running', 'Gathering', 'Parsing',
     12                'Aborted', 'Completed', 'Failed', 'Stopped',
     13                'Cleaning', 'Template']
     14 
     15 Status = enum.Enum(*Status_list, string_values=True)
     16 ACTIVE_STATUSES = (Status.STARTING, Status.RESETTING, Status.VERIFYING,
     17                    Status.PROVISIONING, Status.PENDING, Status.RUNNING,
     18                    Status.GATHERING, Status.CLEANING)
     19 COMPLETE_STATUSES = (Status.ABORTED, Status.COMPLETED, Status.FAILED,
     20                      Status.STOPPED, Status.TEMPLATE)
     21 # A state cannot both be active and complete
     22 assert not set(ACTIVE_STATUSES) & set(COMPLETE_STATUSES)
     23 PRE_JOB_STATUSES = (Status.RESETTING, Status.PROVISIONING, Status.VERIFYING,
     24                     Status.PENDING, Status.QUEUED)
     25 IDLE_PRE_JOB_STATUSES = (Status.PENDING, Status.QUEUED)
     26 
     27 IntStatus = enum.Enum(*Status_list)
     28