Commit 519d41f4 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[jobs] add JS_JOB_TIMEOUT/JS_ID_TIMEOUT settings for jobs

parent c53aa1ac
...@@ -40,6 +40,10 @@ FRAME_ISTEX_URL = URL_TO_CHANGE ...@@ -40,6 +40,10 @@ FRAME_ISTEX_URL = URL_TO_CHANGE
MAX_DOCS_PARSERS = 1000000 MAX_DOCS_PARSERS = 1000000
MAX_DOCS_SCRAPERS = 10000 MAX_DOCS_SCRAPERS = 10000
# in seconds
JS_JOB_TIMEOUT = 1800
JS_ID_TIMEOUT = 1800
[server] [server]
# Server config (TODO connect in ReaderMonad) # Server config (TODO connect in ReaderMonad)
ALLOWED_ORIGIN = http://localhost ALLOWED_ORIGIN = http://localhost
......
...@@ -43,13 +43,14 @@ import qualified Data.ByteString.Lazy as L ...@@ -43,13 +43,14 @@ import qualified Data.ByteString.Lazy as L
import Gargantext.API.Admin.EnvTypes import Gargantext.API.Admin.EnvTypes
import Gargantext.API.Admin.Types import Gargantext.API.Admin.Types
-- import Gargantext.API.Ngrams.Types (NgramsRepo, HasRepo(..), RepoEnv(..), r_version, initRepo, renv_var, renv_lock) -- import Gargantext.API.Ngrams.Types (NgramsRepo, HasRepo(..), RepoEnv(..), r_version, initRepo, renv_var, renv_lock)
import Gargantext.Database.Prelude (databaseParameters) import Gargantext.Database.Prelude (databaseParameters, hasConfig)
import Gargantext.Prelude import Gargantext.Prelude
-- import Gargantext.Prelude.Config (gc_repofilepath) import Gargantext.Prelude.Config (gc_js_job_timeout, gc_js_id_timeout)
import qualified Gargantext.Prelude.Mail as Mail import qualified Gargantext.Prelude.Mail as Mail
import qualified Gargantext.Utils.Jobs as Jobs import qualified Gargantext.Utils.Jobs as Jobs
import qualified Gargantext.Utils.Jobs.Monad as Jobs import qualified Gargantext.Utils.Jobs.Monad as Jobs
import qualified Gargantext.Utils.Jobs.Queue as Jobs import qualified Gargantext.Utils.Jobs.Queue as Jobs
import qualified Gargantext.Utils.Jobs.Settings as Jobs
devSettings :: FilePath -> IO Settings devSettings :: FilePath -> IO Settings
devSettings jwkFile = do devSettings jwkFile = do
...@@ -192,7 +193,10 @@ newEnv port file = do ...@@ -192,7 +193,10 @@ newEnv port file = do
scrapers_env <- newJobEnv defaultSettings manager_env scrapers_env <- newJobEnv defaultSettings manager_env
secret <- Jobs.genSecret secret <- Jobs.genSecret
jobs_env <- Jobs.newJobEnv (Jobs.defaultJobSettings 1 secret) prios' manager_env let jobs_settings = (Jobs.defaultJobSettings 1 secret)
& Jobs.l_jsJobTimeout .~ (fromIntegral $ config_env ^. hasConfig ^. gc_js_job_timeout)
& Jobs.l_jsIDTimeout .~ (fromIntegral $ config_env ^. hasConfig ^. gc_js_id_timeout)
jobs_env <- Jobs.newJobEnv jobs_settings prios' manager_env
logger <- newStderrLoggerSet defaultBufSize logger <- newStderrLoggerSet defaultBufSize
config_mail <- Mail.readConfig file config_mail <- Mail.readConfig file
......
{-# LANGUAGE TemplateHaskell #-}
module Gargantext.Utils.Jobs.Settings where module Gargantext.Utils.Jobs.Settings where
import Control.Lens
import Prelude import Prelude
import qualified Servant.Job.Core as SJ import qualified Servant.Job.Core as SJ
...@@ -12,3 +15,6 @@ data JobSettings = JobSettings ...@@ -12,3 +15,6 @@ data JobSettings = JobSettings
, jsGcPeriod :: Int -- in seconds, how long between each GC , jsGcPeriod :: Int -- in seconds, how long between each GC
, jsSecretKey :: SJ.SecretKey , jsSecretKey :: SJ.SecretKey
} }
makeLensesFor [ ("jsJobTimeout", "l_jsJobTimeout")
, ("jsIDTimeout", "l_jsIDTimeout")] ''JobSettings
...@@ -32,10 +32,10 @@ ghc-options: ...@@ -32,10 +32,10 @@ ghc-options:
# "$everything": -haddock # "$everything": -haddock
extra-deps: extra-deps:
- git: https://gitlab.iscpif.fr/gargantext/haskell-gargantext-prelude.git #- git: https://gitlab.iscpif.fr/gargantext/haskell-gargantext-prelude.git
commit: 7bcd5fc5bad511892c4fd337cf2d4d23c1ec051b # commit: 7bcd5fc5bad511892c4fd337cf2d4d23c1ec051b
#- git: https://gitlab.iscpif.fr/cgenie/haskell-gargantext-prelude - git: https://gitlab.iscpif.fr/cgenie/haskell-gargantext-prelude
# commit: 7b9656ce5180d2723301561b0715f06c7b905182 commit: 791c2a7046a3760f8ae5fabdbd708f61caa63741
- git: https://gitlab.iscpif.fr/gargantext/gargantext-graph.git - git: https://gitlab.iscpif.fr/gargantext/gargantext-graph.git
commit: 588e104fe7593210956610cab0041fd16584a4ce commit: 588e104fe7593210956610cab0041fd16584a4ce
# Data Mining Libs # Data Mining Libs
......
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