Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype JobMap jid w a = JobMap {}
- data JobEntry jid w a = JobEntry {}
- data J w a
- = QueuedJ (QueuedJob w a)
- | RunningJ (RunningJob w a)
- | DoneJ w (Either SomeException a)
- data QueuedJob w r where
- data RunningJob w a = RunningJob {}
- type LoggerM m w = w -> m ()
- type Logger w = LoggerM IO w
- newJobMap :: IO (JobMap jid w a)
- lookupJob :: Ord jid => jid -> JobMap jid w a -> IO (Maybe (JobEntry jid w a))
- gcThread :: Ord jid => JobSettings -> JobMap jid w a -> IO ()
- addJobEntry :: Ord jid => UTCTime -> jid -> a -> (jid -> a -> Logger w -> IO r) -> JobMap jid w r -> STM (JobEntry jid w r)
- deleteJob :: Ord jid => jid -> JobMap jid w a -> STM ()
- runJob :: (Ord jid, Monoid w) => jid -> QueuedJob w a -> JobMap jid w a -> JobSettings -> IO (RunningJob w a)
- waitJobDone :: Ord jid => jid -> RunningJob w a -> JobMap jid w a -> IO (Either SomeException a, w)
- runJ :: Monoid w => QueuedJob w a -> IO (RunningJob w a)
- waitJ :: RunningJob w a -> IO (Either SomeException a)
- pollJ :: RunningJob w a -> IO (Maybe (Either SomeException a))
- killJ :: RunningJob w a -> IO ()
Types
(Mutable) Map
containing job id -> job info mapping.
Information associated to a job ID
A job computation, which has a different representation depending on the status of the job.
A queued job consists of the input to the computation and the computation.
A running job consists of an Async
as well as an action to get the current logs.
A done job consists of the result of the computation and the final logs.
QueuedJ (QueuedJob w a) | |
RunningJ (RunningJob w a) | |
DoneJ w (Either SomeException a) |
An unexecuted job is an input paired with a computation to run with it. Input type is "hidden" to be able to store different job types together.
data RunningJob w a #
A running job points to the async computation for the job and provides a function to peek at the current logs.
type Logger w = LoggerM IO w #
A
is a function that can do something with "messages" of type
Logger
ww
in IO.
Functions
addJobEntry :: Ord jid => UTCTime -> jid -> a -> (jid -> a -> Logger w -> IO r) -> JobMap jid w r -> STM (JobEntry jid w r) #
Generating new JobEntry
s.
runJob :: (Ord jid, Monoid w) => jid -> QueuedJob w a -> JobMap jid w a -> JobSettings -> IO (RunningJob w a) #
waitJobDone :: Ord jid => jid -> RunningJob w a -> JobMap jid w a -> IO (Either SomeException a, w) #
runJ :: Monoid w => QueuedJob w a -> IO (RunningJob w a) #
Turn a queued job into a running job by setting up the logging of w
s and
firing up the async action.
waitJ :: RunningJob w a -> IO (Either SomeException a) #
Wait for a running job to return (blocking).
pollJ :: RunningJob w a -> IO (Maybe (Either SomeException a)) #
Poll a running job to see if it's done.
killJ :: RunningJob w a -> IO () #
Kill a running job by cancelling the action.