Commit 71a30935 authored by Alfredo Di Napoli's avatar Alfredo Di Napoli

Move Gargantext.Utils.Jobs.API to Gargantext.Utils.Job.Internal

This commit renames the `Gargantext.Utils.Job.API` module to
`Gargantext.Utils.Job.Internal`, because it turns out it's *not* what
Gargantext is using directly; rather, the user-facing function in use
lives at `Gargantext.Utils.Jobs` and is called `serveJobsAPI`. This
distinction makes clearer who is using what.
parent 3fe5b772
...@@ -101,7 +101,7 @@ library ...@@ -101,7 +101,7 @@ library
Gargantext.Database.Schema.Ngrams Gargantext.Database.Schema.Ngrams
Gargantext.Defaults Gargantext.Defaults
Gargantext.Utils.Jobs Gargantext.Utils.Jobs
Gargantext.Utils.Jobs.API Gargantext.Utils.Jobs.Internal
Gargantext.Utils.Jobs.Map Gargantext.Utils.Jobs.Map
Gargantext.Utils.Jobs.Monad Gargantext.Utils.Jobs.Monad
Gargantext.Utils.Jobs.Queue Gargantext.Utils.Jobs.Queue
......
module Gargantext.Utils.Jobs where module Gargantext.Utils.Jobs (
-- * Serving the JOBS API
serveJobsAPI
-- * Parsing and reading @GargJob@s from disk
, readPrios
) where
import Control.Monad.Except import Control.Monad.Except
import Control.Monad.Reader import Control.Monad.Reader
...@@ -9,7 +14,7 @@ import Text.Read (readMaybe) ...@@ -9,7 +14,7 @@ import Text.Read (readMaybe)
import Gargantext.API.Admin.EnvTypes import Gargantext.API.Admin.EnvTypes
import Gargantext.API.Admin.Orchestrator.Types (JobLog) import Gargantext.API.Admin.Orchestrator.Types (JobLog)
import Gargantext.API.Prelude import Gargantext.API.Prelude
import qualified Gargantext.Utils.Jobs.API as API import qualified Gargantext.Utils.Jobs.Internal as Internal
import Gargantext.Utils.Jobs.Map import Gargantext.Utils.Jobs.Map
import Gargantext.Utils.Jobs.Monad import Gargantext.Utils.Jobs.Monad
...@@ -24,7 +29,7 @@ serveJobsAPI ...@@ -24,7 +29,7 @@ serveJobsAPI
=> GargJob => GargJob
-> (input -> Logger JobLog -> GargM Env GargError JobLog) -> (input -> Logger JobLog -> GargM Env GargError JobLog)
-> JobsServerAPI ctI ctO callbacks input -> JobsServerAPI ctI ctO callbacks input
serveJobsAPI t f = API.serveJobsAPI ask t jobErrorToGargError $ \env i l -> do serveJobsAPI t f = Internal.serveJobsAPI ask t jobErrorToGargError $ \env i l -> do
putStrLn ("Running job of type: " ++ show t) putStrLn ("Running job of type: " ++ show t)
runExceptT $ runReaderT (f i l) env runExceptT $ runReaderT (f i l) env
......
{-# LANGUAGE TypeFamilies, ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies, ScopedTypeVariables #-}
module Gargantext.Utils.Jobs.API where module Gargantext.Utils.Jobs.Internal (serveJobsAPI) where
import Control.Concurrent import Control.Concurrent
import Control.Concurrent.Async import Control.Concurrent.Async
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment