On Thu, Nov 7, 2013 at 1:20 PM, Klaus Aehlig <[email protected]> wrote:
> Adding jobs to the queue is only allowed if the queue
> is not drained.
>
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  src/Ganeti/JQueue.hs | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/Ganeti/JQueue.hs b/src/Ganeti/JQueue.hs
> index ebb9e43..1ddc33d 100644
> --- a/src/Ganeti/JQueue.hs
> +++ b/src/Ganeti/JQueue.hs
> @@ -49,6 +49,7 @@ module Ganeti.JQueue
>      , allocateJobIds
>      , allocateJobId
>      , writeJobToDisk
> +    , isQueueOpen
>      ) where
>
>  import Control.Concurrent.MVar
> @@ -389,3 +390,7 @@ allocateJobId :: [Node] -> MVar () -> IO (Result JobId)
>  allocateJobId mastercandidates lock = do
>    jids <- allocateJobIds mastercandidates lock 1
>    return (jids >>= resultThe "Failed to acllocate precisely one Job ID")
> +
> +-- | Decide if job queue is open
> +isQueueOpen :: IO Bool
> +isQueueOpen = liftM not (jobQueueDrainFile >>= doesFileExist)
> --
> 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