Statistics
| Branch: | Tag: | Revision:

root / htools / Ganeti / Jobs.hs @ b1e81520

History | View | Annotate | Download (2.1 kB)

1 e9aaa3c6 Iustin Pop
{-# LANGUAGE TemplateHaskell #-}
2 e9aaa3c6 Iustin Pop
3 13b6cb3f Iustin Pop
{-| Implementation of the job information.
4 13b6cb3f Iustin Pop
5 13b6cb3f Iustin Pop
-}
6 13b6cb3f Iustin Pop
7 13b6cb3f Iustin Pop
{-
8 13b6cb3f Iustin Pop
9 ad0e078e Iustin Pop
Copyright (C) 2009, 2010, 2011, 2012 Google Inc.
10 13b6cb3f Iustin Pop
11 13b6cb3f Iustin Pop
This program is free software; you can redistribute it and/or modify
12 13b6cb3f Iustin Pop
it under the terms of the GNU General Public License as published by
13 13b6cb3f Iustin Pop
the Free Software Foundation; either version 2 of the License, or
14 13b6cb3f Iustin Pop
(at your option) any later version.
15 13b6cb3f Iustin Pop
16 13b6cb3f Iustin Pop
This program is distributed in the hope that it will be useful, but
17 13b6cb3f Iustin Pop
WITHOUT ANY WARRANTY; without even the implied warranty of
18 13b6cb3f Iustin Pop
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 13b6cb3f Iustin Pop
General Public License for more details.
20 13b6cb3f Iustin Pop
21 13b6cb3f Iustin Pop
You should have received a copy of the GNU General Public License
22 13b6cb3f Iustin Pop
along with this program; if not, write to the Free Software
23 13b6cb3f Iustin Pop
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 13b6cb3f Iustin Pop
02110-1301, USA.
25 13b6cb3f Iustin Pop
26 13b6cb3f Iustin Pop
-}
27 13b6cb3f Iustin Pop
28 13b6cb3f Iustin Pop
module Ganeti.Jobs
29 ebf38064 Iustin Pop
  ( OpStatus(..)
30 ebf38064 Iustin Pop
  , JobStatus(..)
31 ebf38064 Iustin Pop
  ) where
32 13b6cb3f Iustin Pop
33 13b6cb3f Iustin Pop
import Text.JSON (readJSON, showJSON, JSON)
34 13b6cb3f Iustin Pop
35 56c094b4 Iustin Pop
import qualified Ganeti.Constants as C
36 e9aaa3c6 Iustin Pop
import qualified Ganeti.THH as THH
37 56c094b4 Iustin Pop
38 525bfb36 Iustin Pop
-- | Our ADT for the OpCode status at runtime (while in a job).
39 e9aaa3c6 Iustin Pop
$(THH.declareSADT "OpStatus"
40 ebf38064 Iustin Pop
       [ ("OP_STATUS_QUEUED",    'C.opStatusQueued)
41 ebf38064 Iustin Pop
       , ("OP_STATUS_WAITING",   'C.opStatusWaiting)
42 ebf38064 Iustin Pop
       , ("OP_STATUS_CANCELING", 'C.opStatusCanceling)
43 ebf38064 Iustin Pop
       , ("OP_STATUS_RUNNING",   'C.opStatusRunning)
44 ebf38064 Iustin Pop
       , ("OP_STATUS_CANCELED",  'C.opStatusCanceled)
45 ebf38064 Iustin Pop
       , ("OP_STATUS_SUCCESS",   'C.opStatusSuccess)
46 ebf38064 Iustin Pop
       , ("OP_STATUS_ERROR",     'C.opStatusError)
47 ebf38064 Iustin Pop
       ])
48 e9aaa3c6 Iustin Pop
$(THH.makeJSONInstance ''OpStatus)
49 41065165 Iustin Pop
50 13b6cb3f Iustin Pop
-- | The JobStatus data type. Note that this is ordered especially
51 c4ef235b Iustin Pop
-- such that greater\/lesser comparison on values of this type makes
52 13b6cb3f Iustin Pop
-- sense.
53 e9aaa3c6 Iustin Pop
$(THH.declareSADT "JobStatus"
54 ebf38064 Iustin Pop
       [ ("JOB_STATUS_QUEUED",    'C.jobStatusQueued)
55 ebf38064 Iustin Pop
       , ("JOB_STATUS_WAITING",   'C.jobStatusWaiting)
56 ebf38064 Iustin Pop
       , ("JOB_STATUS_CANCELING", 'C.jobStatusCanceling)
57 ebf38064 Iustin Pop
       , ("JOB_STATUS_RUNNING",   'C.jobStatusRunning)
58 ebf38064 Iustin Pop
       , ("JOB_STATUS_CANCELED",  'C.jobStatusCanceled)
59 ebf38064 Iustin Pop
       , ("JOB_STATUS_SUCCESS",   'C.jobStatusSuccess)
60 ebf38064 Iustin Pop
       , ("JOB_STATUS_ERROR",     'C.jobStatusError)
61 ebf38064 Iustin Pop
       ])
62 e9aaa3c6 Iustin Pop
$(THH.makeJSONInstance ''JobStatus)