Statistics
| Branch: | Tag: | Revision:

root / htools / Ganeti / Jobs.hs @ ad0e078e

History | View | Annotate | Download (2.1 kB)

1
{-# LANGUAGE TemplateHaskell #-}
2

    
3
{-| Implementation of the job information.
4

    
5
-}
6

    
7
{-
8

    
9
Copyright (C) 2009, 2010, 2011, 2012 Google Inc.
10

    
11
This program is free software; you can redistribute it and/or modify
12
it under the terms of the GNU General Public License as published by
13
the Free Software Foundation; either version 2 of the License, or
14
(at your option) any later version.
15

    
16
This program is distributed in the hope that it will be useful, but
17
WITHOUT ANY WARRANTY; without even the implied warranty of
18
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19
General Public License for more details.
20

    
21
You should have received a copy of the GNU General Public License
22
along with this program; if not, write to the Free Software
23
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24
02110-1301, USA.
25

    
26
-}
27

    
28
module Ganeti.Jobs
29
  ( OpStatus(..)
30
  , JobStatus(..)
31
  ) where
32

    
33
import Text.JSON (readJSON, showJSON, JSON)
34

    
35
import qualified Ganeti.Constants as C
36
import qualified Ganeti.THH as THH
37

    
38
-- | Our ADT for the OpCode status at runtime (while in a job).
39
$(THH.declareSADT "OpStatus"
40
       [ ("OP_STATUS_QUEUED",    'C.opStatusQueued)
41
       , ("OP_STATUS_WAITING",   'C.opStatusWaiting)
42
       , ("OP_STATUS_CANCELING", 'C.opStatusCanceling)
43
       , ("OP_STATUS_RUNNING",   'C.opStatusRunning)
44
       , ("OP_STATUS_CANCELED",  'C.opStatusCanceled)
45
       , ("OP_STATUS_SUCCESS",   'C.opStatusSuccess)
46
       , ("OP_STATUS_ERROR",     'C.opStatusError)
47
       ])
48
$(THH.makeJSONInstance ''OpStatus)
49

    
50
-- | The JobStatus data type. Note that this is ordered especially
51
-- such that greater\/lesser comparison on values of this type makes
52
-- sense.
53
$(THH.declareSADT "JobStatus"
54
       [ ("JOB_STATUS_QUEUED",    'C.jobStatusQueued)
55
       , ("JOB_STATUS_WAITING",   'C.jobStatusWaiting)
56
       , ("JOB_STATUS_CANCELING", 'C.jobStatusCanceling)
57
       , ("JOB_STATUS_RUNNING",   'C.jobStatusRunning)
58
       , ("JOB_STATUS_CANCELED",  'C.jobStatusCanceled)
59
       , ("JOB_STATUS_SUCCESS",   'C.jobStatusSuccess)
60
       , ("JOB_STATUS_ERROR",     'C.jobStatusError)
61
       ])
62
$(THH.makeJSONInstance ''JobStatus)