On Thu, Nov 7, 2013 at 1:20 PM, Klaus Aehlig <[email protected]> wrote:
> This function handles the pure part of generating a job,
> i.e., assuming the job id already assigned and not setting
> time stamps.
>
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  src/Ganeti/JQueue.hs | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/src/Ganeti/JQueue.hs b/src/Ganeti/JQueue.hs
> index 937dd27..991cfa0 100644
> --- a/src/Ganeti/JQueue.hs
> +++ b/src/Ganeti/JQueue.hs
> @@ -30,6 +30,7 @@ module Ganeti.JQueue
>      , QueuedJob(..)
>      , InputOpCode(..)
>      , queuedOpCodeFromMetaOpCode
> +    , queuedJobFromOpCodes
>      , Timestamp
>      , noTimestamp
>      , opStatusFinalized
> @@ -147,6 +148,19 @@ queuedOpCodeFromMetaOpCode op =
>                 , qoExecTimestamp = Nothing
>                 }
>
> +-- | From a job-id and a list of op-codes create a job. This is
> +-- the pure part of job creation, as allocating a new job id
> +-- lives in IO.
> +queuedJobFromOpCodes :: (Monad m) => JobId -> [MetaOpCode] -> m QueuedJob
> +queuedJobFromOpCodes jobid ops = do
> +  ops' <- mapM (`resolveDependencies` jobid) ops
> +  return QueuedJob { qjId = jobid
> +                   , qjOps = map queuedOpCodeFromMetaOpCode ops'
> +                   , qjReceivedTimestamp = Nothing
> +                   , qjStartTimestamp = Nothing
> +                   , qjEndTimestamp = Nothing
> +                   }
> +
>  -- | Job file prefix.
>  jobFilePrefix :: String
>  jobFilePrefix = "job-"
> --
> 1.8.4.1
>

LGTM, thanks.

Michele

-- 
Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to