Safe Haskell | Safe-Infered |
---|
Implementation of a reader for the job queue.
- data JobWithStat = JobWithStat {}
- data Queue = Queue {
- qEnqueued :: [JobWithStat]
- qRunning :: [JobWithStat]
- data JQStatus = JQStatus {
- jqJobs :: IORef Queue
- jqConfig :: IORef (Result ConfigData)
- emptyJQStatus :: IORef (Result ConfigData) -> IO JQStatus
- onRunningJobs :: ([JobWithStat] -> [JobWithStat]) -> Queue -> Queue
- onQueuedJobs :: ([JobWithStat] -> [JobWithStat]) -> Queue -> Queue
- unreadJob :: QueuedJob -> JobWithStat
- watchInterval :: Int
- getMaxRunningJobs :: JQStatus -> IO Int
- modifyJobs :: JQStatus -> (Queue -> Queue) -> IO ()
- readJobStatus :: JobWithStat -> IO (Maybe JobWithStat)
- updateJobStatus :: JobWithStat -> [JobWithStat] -> [JobWithStat]
- updateJob :: JQStatus -> JobWithStat -> IO ()
- sortoutFinishedJobs :: Queue -> (Queue, [JobWithStat])
- cleanupFinishedJobs :: JQStatus -> IO ()
- jobWatcher :: JQStatus -> JobWithStat -> Event -> IO ()
- attachWatcher :: JQStatus -> JobWithStat -> IO ()
- selectJobsToRun :: Int -> Queue -> (Queue, [JobWithStat])
- requeueJobs :: JQStatus -> [JobWithStat] -> IOError -> IO ()
- scheduleSomeJobs :: JQStatus -> IO ()
- showQueue :: Queue -> String
- onTimeWatcher :: JQStatus -> IO ()
- readJobFromDisk :: JobId -> IO (Result JobWithStat)
- readJobsFromDisk :: IO [JobWithStat]
- initJQScheduler :: JQStatus -> IO ()
- enqueueNewJobs :: JQStatus -> [QueuedJob] -> IO ()
- rmJob :: JobId -> Queue -> (Queue, Result (Maybe QueuedJob))
- dequeueJob :: JQStatus -> JobId -> IO (Result Bool)
- setJobPriority :: JQStatus -> JobId -> Int -> IO (Result (Maybe QueuedJob))
Documentation
data JobWithStat Source
Queue | |
|
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.
emptyJQStatus :: IORef (Result ConfigData) -> IO JQStatusSource
onRunningJobs :: ([JobWithStat] -> [JobWithStat]) -> Queue -> QueueSource
onQueuedJobs :: ([JobWithStat] -> [JobWithStat]) -> Queue -> QueueSource
watchInterval :: IntSource
getMaxRunningJobs :: JQStatus -> IO IntSource
modifyJobs :: JQStatus -> (Queue -> Queue) -> IO ()Source
readJobStatus :: JobWithStat -> IO (Maybe JobWithStat)Source
updateJobStatus :: JobWithStat -> [JobWithStat] -> [JobWithStat]Source
updateJob :: JQStatus -> JobWithStat -> IO ()Source
sortoutFinishedJobs :: Queue -> (Queue, [JobWithStat])Source
cleanupFinishedJobs :: JQStatus -> IO ()Source
jobWatcher :: JQStatus -> JobWithStat -> Event -> IO ()Source
attachWatcher :: JQStatus -> JobWithStat -> IO ()Source
selectJobsToRun :: Int -> Queue -> (Queue, [JobWithStat])Source
requeueJobs :: JQStatus -> [JobWithStat] -> IOError -> IO ()Source
scheduleSomeJobs :: JQStatus -> IO ()Source
onTimeWatcher :: JQStatus -> IO ()Source
readJobFromDisk :: JobId -> IO (Result JobWithStat)Source
readJobsFromDisk :: IO [JobWithStat]Source
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.