Revision 370f63be src/Ganeti/JQueue.hs
b/src/Ganeti/JQueue.hs | ||
---|---|---|
41 | 41 |
, calcJobStatus |
42 | 42 |
, jobStarted |
43 | 43 |
, jobFinalized |
44 |
, jobArchivable |
|
44 | 45 |
, calcJobPriority |
45 | 46 |
, jobFileName |
46 | 47 |
, liveJobFile |
... | ... | |
60 | 61 |
, cancelJob |
61 | 62 |
) where |
62 | 63 |
|
64 |
import Control.Applicative (liftA2, (<|>)) |
|
63 | 65 |
import Control.Arrow (second) |
64 | 66 |
import Control.Concurrent.MVar |
65 | 67 |
import Control.Exception |
... | ... | |
272 | 274 |
jobFinalized :: QueuedJob -> Bool |
273 | 275 |
jobFinalized = (> JOB_STATUS_RUNNING) . calcJobStatus |
274 | 276 |
|
277 |
-- | Determine if a job is finalized and its timestamp is before |
|
278 |
-- a given time. |
|
279 |
jobArchivable :: Timestamp -> QueuedJob -> Bool |
|
280 |
jobArchivable ts = liftA2 (&&) jobFinalized |
|
281 |
$ maybe False (< ts) |
|
282 |
. liftA2 (<|>) qjEndTimestamp qjStartTimestamp |
|
283 |
|
|
275 | 284 |
-- | Determine whether an opcode status is finalized. |
276 | 285 |
opStatusFinalized :: OpStatus -> Bool |
277 | 286 |
opStatusFinalized = (> OP_STATUS_RUNNING) |
Also available in: Unified diff