Statistics
| Branch: | Tag: | Revision:

root / htools / Ganeti / Jobs.hs @ d6f9f5bd

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 56c094b4 Iustin Pop
Copyright (C) 2009, 2010, 2011 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
import qualified Text.JSON as J
35 13b6cb3f Iustin Pop
36 56c094b4 Iustin Pop
import qualified Ganeti.Constants as C
37 e9aaa3c6 Iustin Pop
import qualified Ganeti.THH as THH
38 56c094b4 Iustin Pop
39 525bfb36 Iustin Pop
-- | Our ADT for the OpCode status at runtime (while in a job).
40 e9aaa3c6 Iustin Pop
$(THH.declareSADT "OpStatus"
41 ebf38064 Iustin Pop
       [ ("OP_STATUS_QUEUED",    'C.opStatusQueued)
42 ebf38064 Iustin Pop
       , ("OP_STATUS_WAITING",   'C.opStatusWaiting)
43 ebf38064 Iustin Pop
       , ("OP_STATUS_CANCELING", 'C.opStatusCanceling)
44 ebf38064 Iustin Pop
       , ("OP_STATUS_RUNNING",   'C.opStatusRunning)
45 ebf38064 Iustin Pop
       , ("OP_STATUS_CANCELED",  'C.opStatusCanceled)
46 ebf38064 Iustin Pop
       , ("OP_STATUS_SUCCESS",   'C.opStatusSuccess)
47 ebf38064 Iustin Pop
       , ("OP_STATUS_ERROR",     'C.opStatusError)
48 ebf38064 Iustin Pop
       ])
49 e9aaa3c6 Iustin Pop
$(THH.makeJSONInstance ''OpStatus)
50 41065165 Iustin Pop
51 13b6cb3f Iustin Pop
-- | The JobStatus data type. Note that this is ordered especially
52 c4ef235b Iustin Pop
-- such that greater\/lesser comparison on values of this type makes
53 13b6cb3f Iustin Pop
-- sense.
54 e9aaa3c6 Iustin Pop
$(THH.declareSADT "JobStatus"
55 ebf38064 Iustin Pop
       [ ("JOB_STATUS_QUEUED",    'C.jobStatusQueued)
56 ebf38064 Iustin Pop
       , ("JOB_STATUS_WAITING",   'C.jobStatusWaiting)
57 ebf38064 Iustin Pop
       , ("JOB_STATUS_CANCELING", 'C.jobStatusCanceling)
58 ebf38064 Iustin Pop
       , ("JOB_STATUS_RUNNING",   'C.jobStatusRunning)
59 ebf38064 Iustin Pop
       , ("JOB_STATUS_CANCELED",  'C.jobStatusCanceled)
60 ebf38064 Iustin Pop
       , ("JOB_STATUS_SUCCESS",   'C.jobStatusSuccess)
61 ebf38064 Iustin Pop
       , ("JOB_STATUS_ERROR",     'C.jobStatusError)
62 ebf38064 Iustin Pop
       ])
63 e9aaa3c6 Iustin Pop
$(THH.makeJSONInstance ''JobStatus)