gargantext-0.0.7.1.5.3: Search, map, share
Safe HaskellSafe-Inferred
LanguageHaskell2010

Gargantext.Utils.Jobs.Map

Synopsis

Types

newtype JobMap jid w a #

(Mutable) Map containing job id -> job info mapping.

Constructors

JobMap 

Fields

data JobEntry jid w a #

Information associated to a job ID

Constructors

JobEntry 

data J w a #

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.

Constructors

QueuedJ (QueuedJob w a) 
RunningJ (RunningJob w a) 
DoneJ w (Either SomeException a) 

data QueuedJob w r where #

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.

Constructors

QueuedJob :: a -> (a -> Logger w -> IO r) -> QueuedJob w r 

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.

Constructors

RunningJob 

Fields

type LoggerM m w = w -> m () #

Polymorphic logger over any monad m.

type Logger w = LoggerM IO w #

A Logger w is a function that can do something with "messages" of type w in IO.

Functions

newJobMap :: IO (JobMap jid w a) #

lookupJob :: Ord jid => jid -> JobMap jid w a -> IO (Maybe (JobEntry jid w a)) #

Lookup a job by ID

gcThread :: Ord jid => JobSettings -> JobMap jid w a -> IO () #

Ready to use GC thread

addJobEntry :: Ord jid => UTCTime -> jid -> a -> (jid -> a -> Logger w -> IO r) -> JobMap jid w r -> STM (JobEntry jid w r) #

Generating new JobEntrys.

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) #

Turn a queued job into a running job by setting up the logging of ws 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.