blob: 7dce052f04727799c4f4db76f2c7ff0f07e9844f [file] [log] [blame]
showardeaa408e2009-09-11 18:45:31 +00001"""
2This module contains the status enums for use by HostQueueEntrys in the
3database. It is a stand alone module as these status strings are needed
4from various disconnected pieces of code that should not depend on everything
5that frontend.afe.models depends on such as RPC clients.
6"""
7
8from autotest_lib.client.common_lib import enum
9
Alex Millerdfff2fd2013-05-28 13:05:06 -070010Status_list = ['Queued', 'Starting', 'Resetting', 'Verifying', 'Provisioning',
Allen Lifd907102017-06-22 16:13:44 -070011 'Pending', 'Running', 'Gathering', 'Parsing',
Allen Li8745b0d2017-06-22 16:09:52 -070012 'Aborted', 'Completed', 'Failed', 'Stopped',
Alex Millerdfff2fd2013-05-28 13:05:06 -070013 'Cleaning', 'Template']
Alex Miller08c68f02012-09-19 13:21:37 -070014
15Status = enum.Enum(*Status_list, string_values=True)
Dan Shi07e09af2013-04-12 09:31:29 -070016ACTIVE_STATUSES = (Status.STARTING, Status.RESETTING, Status.VERIFYING,
Alex Millerdfff2fd2013-05-28 13:05:06 -070017 Status.PROVISIONING, Status.PENDING, Status.RUNNING,
18 Status.GATHERING, Status.CLEANING)
showardeaa408e2009-09-11 18:45:31 +000019COMPLETE_STATUSES = (Status.ABORTED, Status.COMPLETED, Status.FAILED,
20 Status.STOPPED, Status.TEMPLATE)
Allen Li9e2adb62017-11-13 11:57:34 -080021# A state cannot both be active and complete
22assert not set(ACTIVE_STATUSES) & set(COMPLETE_STATUSES)
Laurence Goodby303d2662016-07-01 15:57:04 -070023PRE_JOB_STATUSES = (Status.RESETTING, Status.PROVISIONING, Status.VERIFYING,
Allen Lifd907102017-06-22 16:13:44 -070024 Status.PENDING, Status.QUEUED)
25IDLE_PRE_JOB_STATUSES = (Status.PENDING, Status.QUEUED)
Alex Miller08c68f02012-09-19 13:21:37 -070026
27IntStatus = enum.Enum(*Status_list)