Revision 3f68544e

b/src/Ganeti/Jobs.hs
24 24
-}
25 25

  
26 26
module Ganeti.Jobs
27
  ( execJobsWait
27
  ( submitJobs
28
  , execJobsWait
28 29
  , waitForJobs
29 30
  ) where
30 31

  
......
36 37
import Ganeti.OpCodes
37 38
import Ganeti.Types
38 39

  
40
-- | Submits a set of jobs and returns their job IDs without waiting for
41
-- completion.
42
submitJobs :: [[MetaOpCode]] -> L.Client -> IO (Result [L.JobId])
43
submitJobs opcodes client = do
44
  jids <- L.submitManyJobs client opcodes
45
  return (case jids of
46
            Bad e    -> Bad $ "Job submission error: " ++ formatError e
47
            Ok jids' -> Ok jids')
48

  
39 49
-- | Executes a set of jobs and waits for their completion, returning their
40 50
-- status.
41 51
execJobsWait :: [[MetaOpCode]]        -- ^ The list of jobs
......
43 53
             -> L.Client              -- ^ The Luxi client
44 54
             -> IO (Result [(L.JobId, JobStatus)])
45 55
execJobsWait opcodes callback client = do
46
  jids <- L.submitManyJobs client opcodes
56
  jids <- submitJobs opcodes client
47 57
  case jids of
48
    Bad e -> return . Bad $ "Job submission error: " ++ formatError e
58
    Bad e -> return $ Bad e
49 59
    Ok jids' -> do
50 60
      callback jids'
51 61
      waitForJobs jids' client

Also available in: Unified diff