Revision 4b49a72b src/Ganeti/JQueue.hs

b/src/Ganeti/JQueue.hs
29 29
    ( QueuedOpCode(..)
30 30
    , QueuedJob(..)
31 31
    , InputOpCode(..)
32
    , queuedOpCodeFromMetaOpCode
32 33
    , Timestamp
33 34
    , noTimestamp
34 35
    , opStatusFinalized
......
48 49
import Control.Exception
49 50
import Control.Monad
50 51
import Data.List
52
import Data.Maybe
51 53
import Data.Ord (comparing)
52 54
-- workaround what seems to be a bug in ghc 7.4's TH shadowing code
53 55
import Prelude hiding (log, id)
......
131 133
    simpleField "end_timestamp"      [t| Timestamp      |]
132 134
  ])
133 135

  
136
-- | Convenience function to obtain a QueuedOpCode from a MetaOpCode
137
queuedOpCodeFromMetaOpCode :: MetaOpCode -> QueuedOpCode
138
queuedOpCodeFromMetaOpCode op =
139
  QueuedOpCode { qoInput = ValidOpCode op
140
               , qoStatus = OP_STATUS_QUEUED
141
               , qoPriority = opSubmitPriorityToRaw . opPriority . metaParams
142
                              $ op
143
               , qoLog = []
144
               , qoResult = JSNull
145
               , qoStartTimestamp = Nothing
146
               , qoEndTimestamp = Nothing
147
               , qoExecTimestamp = Nothing
148
               }
149

  
134 150
-- | Job file prefix.
135 151
jobFilePrefix :: String
136 152
jobFilePrefix = "job-"

Also available in: Unified diff