gargantext-0.0.7.1.5.3: Search, map, share
Copyright(c) CNRS 2017
LicenseAGPL + CECILL v3
Maintainerteam@gargantext.org
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell2010

Gargantext.Utils.Jobs

Description

 
Synopsis

Serving the JOBS API

Parsing and reading GargJobs from disk

Handy re-exports

class MonadJobStatus m where #

A monad to query for the status of a particular job and submit updates for in-progress jobs.

Associated Types

type JobHandle m :: Type #

This is type family for the concrete JobHandle that is associated to a job when it starts and it can be used to query for its completion status. Different environment can decide how this will look like.

type JobType m :: Type #

type JobOutputType m :: Type #

type JobEventType m :: Type #

Methods

noJobHandle :: Proxy m -> JobHandle m #

A job handle that doesn't do anything. Sometimes useful in all those circumstances where we need to test a function taking a JobHandle as input but we are not interested in the progress tracking.

getLatestJobStatus :: JobHandle m -> m (JobEventType m) #

Retrevies the latest JobEventType from the underlying monad. It can be used to query the latest status for a particular job, given its JobHandle as input.

withTracer :: Logger (JobEventType m) -> JobHandle m -> (JobHandle m -> m a) -> m a #

Adds an extra "tracer" that logs events to the passed action. Produces a new JobHandle.

markStarted :: Int -> JobHandle m -> m () #

Start tracking a new JobEventType with n remaining steps.

markProgress :: Int -> JobHandle m -> m () #

Mark n steps of the job as succeeded, while simultaneously substracting this number from the remaining steps.

markFailure :: forall e. ToHumanFriendlyError e => Int -> Maybe e -> JobHandle m -> m () #

Mark n step of the job as failed, while simultaneously substracting this number from the remaining steps. Attach an optional error message to the failure.

markComplete :: JobHandle m -> m () #

Finish tracking a job by marking all the remaining steps as succeeded.

markFailed :: forall e. ToHumanFriendlyError e => Maybe e -> JobHandle m -> m () #

Finish tracking a job by marking all the remaining steps as failed. Attach an optional message to the failure.

addMoreSteps :: MonadJobStatus m => Int -> JobHandle m -> m () #

Add n more steps to the running computation, they will be marked as remaining.

Instances

Instances details
MonadJobStatus (GargM DevEnv err) # 
Instance details

Defined in Gargantext.API.Admin.EnvTypes

Associated Types

type JobHandle (GargM DevEnv err) #

type JobType (GargM DevEnv err) #

type JobOutputType (GargM DevEnv err) #

type JobEventType (GargM DevEnv err) #

MonadJobStatus (GargM Env err) # 
Instance details

Defined in Gargantext.API.Admin.EnvTypes

Associated Types

type JobHandle (GargM Env err) #

type JobType (GargM Env err) #

type JobOutputType (GargM Env err) #

type JobEventType (GargM Env err) #

markFailedNoErr :: MonadJobStatus m => JobHandle m -> m () #

Helper on top of markFailed for when we don't have a diagnostic to log.