Commit 47c3c7b1 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Support canceling dequeued jobs

Even after jobs have been handed over for execution, it might
still be possible to cancel them. On such case would be the
job still waiting for a lock. Eventually, we will have to
communicate to the job directly, but as long as execution is
still managed by masterd, ask masterd to cancel the job.
Signed-off-by: default avatarKlaus Aehlig <>
Reviewed-by: default avatarPetr Pudlak <>
parent bb62d52e
......@@ -56,6 +56,7 @@ module Ganeti.JQueue
, replicateManyJobs
, isQueueOpen
, startJobs
, cancelJob
) where
import Control.Arrow (second)
......@@ -78,6 +79,7 @@ import Text.JSON.Types
import Ganeti.BasicTypes
import qualified Ganeti.Constants as C
import Ganeti.Errors (ErrorResult)
import Ganeti.JSON
import Ganeti.Logging
import Ganeti.Luxi
......@@ -452,3 +454,11 @@ startJobs jobs = do
let failures = map show $ justBad pickupResults
unless (null failures)
. logWarning . (++) "Failed to notify masterd: " . commaJoin $ failures
-- | Try to cancel a job that has already been handed over to execution,
-- currently by asking masterd to cancel it.
cancelJob :: JobId -> IO (ErrorResult JSValue)
cancelJob jid = do
socketpath <- defaultMasterSocket
client <- getLuxiClient socketpath
callMethod (CancelJob jid) client
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment