Revision ebf38064 htools/Ganeti/Jobs.hs
b/htools/Ganeti/Jobs.hs | ||
---|---|---|
26 | 26 |
-} |
27 | 27 |
|
28 | 28 |
module Ganeti.Jobs |
29 |
( OpStatus(..)
|
|
30 |
, JobStatus(..)
|
|
31 |
) where
|
|
29 |
( OpStatus(..) |
|
30 |
, JobStatus(..) |
|
31 |
) where |
|
32 | 32 |
|
33 | 33 |
import Text.JSON (readJSON, showJSON, JSON) |
34 | 34 |
import qualified Text.JSON as J |
... | ... | |
38 | 38 |
|
39 | 39 |
-- | Our ADT for the OpCode status at runtime (while in a job). |
40 | 40 |
$(THH.declareSADT "OpStatus" |
41 |
[ ("OP_STATUS_QUEUED", 'C.opStatusQueued)
|
|
42 |
, ("OP_STATUS_WAITING", 'C.opStatusWaiting)
|
|
43 |
, ("OP_STATUS_CANCELING", 'C.opStatusCanceling)
|
|
44 |
, ("OP_STATUS_RUNNING", 'C.opStatusRunning)
|
|
45 |
, ("OP_STATUS_CANCELED", 'C.opStatusCanceled)
|
|
46 |
, ("OP_STATUS_SUCCESS", 'C.opStatusSuccess)
|
|
47 |
, ("OP_STATUS_ERROR", 'C.opStatusError)
|
|
48 |
])
|
|
41 |
[ ("OP_STATUS_QUEUED", 'C.opStatusQueued) |
|
42 |
, ("OP_STATUS_WAITING", 'C.opStatusWaiting) |
|
43 |
, ("OP_STATUS_CANCELING", 'C.opStatusCanceling) |
|
44 |
, ("OP_STATUS_RUNNING", 'C.opStatusRunning) |
|
45 |
, ("OP_STATUS_CANCELED", 'C.opStatusCanceled) |
|
46 |
, ("OP_STATUS_SUCCESS", 'C.opStatusSuccess) |
|
47 |
, ("OP_STATUS_ERROR", 'C.opStatusError) |
|
48 |
]) |
|
49 | 49 |
$(THH.makeJSONInstance ''OpStatus) |
50 | 50 |
|
51 | 51 |
-- | The JobStatus data type. Note that this is ordered especially |
52 | 52 |
-- such that greater\/lesser comparison on values of this type makes |
53 | 53 |
-- sense. |
54 | 54 |
$(THH.declareSADT "JobStatus" |
55 |
[ ("JOB_STATUS_QUEUED", 'C.jobStatusQueued)
|
|
56 |
, ("JOB_STATUS_WAITING", 'C.jobStatusWaiting)
|
|
57 |
, ("JOB_STATUS_CANCELING", 'C.jobStatusCanceling)
|
|
58 |
, ("JOB_STATUS_RUNNING", 'C.jobStatusRunning)
|
|
59 |
, ("JOB_STATUS_CANCELED", 'C.jobStatusCanceled)
|
|
60 |
, ("JOB_STATUS_SUCCESS", 'C.jobStatusSuccess)
|
|
61 |
, ("JOB_STATUS_ERROR", 'C.jobStatusError)
|
|
62 |
])
|
|
55 |
[ ("JOB_STATUS_QUEUED", 'C.jobStatusQueued) |
|
56 |
, ("JOB_STATUS_WAITING", 'C.jobStatusWaiting) |
|
57 |
, ("JOB_STATUS_CANCELING", 'C.jobStatusCanceling) |
|
58 |
, ("JOB_STATUS_RUNNING", 'C.jobStatusRunning) |
|
59 |
, ("JOB_STATUS_CANCELED", 'C.jobStatusCanceled) |
|
60 |
, ("JOB_STATUS_SUCCESS", 'C.jobStatusSuccess) |
|
61 |
, ("JOB_STATUS_ERROR", 'C.jobStatusError) |
|
62 |
]) |
|
63 | 63 |
$(THH.makeJSONInstance ''JobStatus) |
Also available in: Unified diff