showard | eaa408e | 2009-09-11 18:45:31 +0000 | [diff] [blame] | 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 | |
Alex Miller | dfff2fd | 2013-05-28 13:05:06 -0700 | [diff] [blame] | 10 | Status_list = ['Queued', 'Starting', 'Resetting', 'Verifying', 'Provisioning', |
Allen Li | fd90710 | 2017-06-22 16:13:44 -0700 | [diff] [blame] | 11 | 'Pending', 'Running', 'Gathering', 'Parsing', |
Allen Li | 8745b0d | 2017-06-22 16:09:52 -0700 | [diff] [blame] | 12 | 'Aborted', 'Completed', 'Failed', 'Stopped', |
Alex Miller | dfff2fd | 2013-05-28 13:05:06 -0700 | [diff] [blame] | 13 | 'Cleaning', 'Template'] |
Alex Miller | 08c68f0 | 2012-09-19 13:21:37 -0700 | [diff] [blame] | 14 | |
| 15 | Status = enum.Enum(*Status_list, string_values=True) |
Dan Shi | 07e09af | 2013-04-12 09:31:29 -0700 | [diff] [blame] | 16 | ACTIVE_STATUSES = (Status.STARTING, Status.RESETTING, Status.VERIFYING, |
Alex Miller | dfff2fd | 2013-05-28 13:05:06 -0700 | [diff] [blame] | 17 | Status.PROVISIONING, Status.PENDING, Status.RUNNING, |
| 18 | Status.GATHERING, Status.CLEANING) |
showard | eaa408e | 2009-09-11 18:45:31 +0000 | [diff] [blame] | 19 | COMPLETE_STATUSES = (Status.ABORTED, Status.COMPLETED, Status.FAILED, |
| 20 | Status.STOPPED, Status.TEMPLATE) |
Allen Li | 9e2adb6 | 2017-11-13 11:57:34 -0800 | [diff] [blame] | 21 | # A state cannot both be active and complete |
| 22 | assert not set(ACTIVE_STATUSES) & set(COMPLETE_STATUSES) |
Laurence Goodby | 303d266 | 2016-07-01 15:57:04 -0700 | [diff] [blame] | 23 | PRE_JOB_STATUSES = (Status.RESETTING, Status.PROVISIONING, Status.VERIFYING, |
Allen Li | fd90710 | 2017-06-22 16:13:44 -0700 | [diff] [blame] | 24 | Status.PENDING, Status.QUEUED) |
| 25 | IDLE_PRE_JOB_STATUSES = (Status.PENDING, Status.QUEUED) |
Alex Miller | 08c68f0 | 2012-09-19 13:21:37 -0700 | [diff] [blame] | 26 | |
| 27 | IntStatus = enum.Enum(*Status_list) |