*Commit message fixed*

On 11/24/2015 08:36 PM, Hrvoje Ribicic wrote:
LGTM with a single nit.

On Fri, Nov 20, 2015 at 5:11 PM, 'Oleg Ponomarev' via ganeti-devel <[email protected] <mailto:[email protected]>> wrote:

    Start execution of global POST hooks as soon as the scheduler
    finds out that job process has disappeared.


Sorry for missing this nit earlier: a job process


    Signed-off-by: Oleg Ponomarev <[email protected]
    <mailto:[email protected]>>
    ---
     src/Ganeti/JQScheduler.hs | 21 +++++++++++++++++++--
     1 file changed, 19 insertions(+), 2 deletions(-)

    diff --git a/src/Ganeti/JQScheduler.hs b/src/Ganeti/JQScheduler.hs
    index 19ef14a..ea4b845 100644
    --- a/src/Ganeti/JQScheduler.hs
    +++ b/src/Ganeti/JQScheduler.hs
    @@ -90,6 +90,7 @@ import Ganeti.Lens hiding (chosen)
     import Ganeti.Logging
     import Ganeti.Objects
     import Ganeti.Path
    +import Ganeti.Query.Exec (forkPostHooksProcess)
     import Ganeti.Types
     import Ganeti.Utils
     import Ganeti.Utils.Livelock
    @@ -474,13 +475,29 @@ checkForDeath state jobWS = do
       return died

     -- | Trigger job detection for the job with the given job id.
    --- Return True, if the job is dead.
    +-- If the job is dead, start post hooks execution process and
    return True
     cleanupIfDead :: JQStatus -> JobId -> IO Bool
     cleanupIfDead state jid = do
       logDebug $ "Extra job-death detection for " ++ show (fromJobId jid)
       jobs <- readIORef (jqJobs state)
       let jobWS = find ((==) jid . qjId . jJob) $ qRunning jobs
    -  maybe (return True) (checkForDeath state) jobWS
    +  -- and run the post hooks
    +  let runHooks = do
    +        r <- runResultT . withLock (jqForkLock state)
    +                                   $ forkPostHooksProcess jid
    +        let sjid = show $ fromJobId jid
    +        logDebug $ genericResult ((++) $ "Error starting post
    hooks process "
    +                                         ++ "for disappeared job "
    +                                         ++ sjid ++ ":")
    +                                 (\pid -> "Post hooks for
    disappeared job "
    +                                          ++ sjid ++ "have
    started in "
    +                                          ++ show pid)
    +                                 r
    +  dead <- maybe (return True) (checkForDeath state) jobWS
    +  if dead
    +    then runHooks
    +    else pure ()
    +  return dead

     -- | Force the queue to check the state of all jobs.
     updateStatusAndScheduleSomeJobs :: JQStatus -> IO ()
    --
    2.6.0.rc2.230.g3dd15c0


Hrvoje Ribicic
Ganeti Engineering
Google Germany GmbH
Dienerstr. 12, 80331, München

Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

Diese E-Mail ist vertraulich. Wenn Sie nicht der richtige Adressat sind, leiten Sie diese bitte nicht weiter, informieren Sie den Absender und löschen Sie die E-Mail und alle Anhänge. Vielen Dank. This e-mail is confidential. If you are not the right addressee please do not forward it, please inform the sender, and please erase this e-mail including any attachments. Thanks.


Reply via email to