ganeti

Safe HaskellSafe-Infered

Ganeti.JQScheduler

Description

Implementation of a reader for the job queue.

Synopsis

Documentation

data JobWithStat Source

Constructors

JobWithStat 

Fields

jINotify :: Maybe INotify
 
jStat :: FStat
 
jJob :: QueuedJob
 

data Queue Source

Constructors

Queue 

data JQStatus Source

Representation of the job queue

We keep two lists of jobs (together with information about the last fstat result observed): the jobs that are enqueued, but not yet handed over for execution, and the jobs already handed over for execution. They are kept together in a single IORef, so that we can atomically update both, in particular when scheduling jobs to be handed over for execution.

Constructors

JQStatus 

Fields

jqJobs :: IORef Queue
 
jqConfig :: IORef (Result ConfigData)
 

modifyJobs :: JQStatus -> (Queue -> Queue) -> IO ()Source

jobWatcher :: JQStatus -> JobWithStat -> Event -> IO ()Source

requeueJobs :: JQStatus -> [JobWithStat] -> IOError -> IO ()Source

showQueue :: Queue -> StringSource

initJQScheduler :: JQStatus -> IO ()Source

Set up the job scheduler. This will also start the monitoring of changes to the running jobs.

enqueueNewJobs :: JQStatus -> [QueuedJob] -> IO ()Source

Enqueue new jobs. This will guarantee that the jobs will be executed eventually.

dequeueJob :: JQStatus -> JobId -> IO (Result Bool)Source

Try to remove a queued job from the job queue. Return True, if the job could be removed from the queue before being handed over to execution, False if the job already started, and a Bad result if the job is unknown.

setJobPriority :: JQStatus -> JobId -> Int -> IO (Result (Maybe QueuedJob))Source

Change the priority of a queued job (once the job is handed over to execution, the job itself needs to be informed). To avoid the job being started unmodified, it is temporarily unqueued during the change. Return the modified job, if the job's priority was sucessfully modified, Nothing, if the job already started, and a Bad value, if the job is unkown.