1 {-# OPTIONS_GHC -fno-warn-unused-imports #-}
2 {-# LANGUAGE DeriveAnyClass #-}
3 {-# LANGUAGE DuplicateRecordFields #-}
5 module Gargantext.API.GraphQL.AsyncTask where
7 import Control.Concurrent.MVar (readMVar)
9 import Control.Monad.Base (liftBase)
10 import Control.Monad.Reader (ask, liftIO)
11 import Data.Morpheus.Types
18 import Data.Text (Text)
19 import qualified Data.Text as T
20 import Gargantext.API.Admin.Orchestrator.Types (JobLog(..))
21 import Gargantext.API.Prelude (GargM, GargError, HasJobEnv')
22 import Gargantext.Core.Mail.Types (HasMail)
23 import Gargantext.Database.Admin.Types.Node (NodeId(..))
24 import Gargantext.Database.Prelude (HasConnectionPool, HasConfig)
25 import Gargantext.Prelude
26 import GHC.Generics (Generic)
27 import Servant.Job.Async (HasJobEnv(job_env), jenv_jobs)
28 import Servant.Job.Core (env_map, env_state_mvar)
33 } deriving (Generic, GQLType)
35 type GqlM e env = Resolver QUERY e (GargM env GargError)
38 :: (HasConnectionPool env, HasConfig env, HasJobEnv' env)
39 => JobLogArgs -> GqlM e env [JobLog]
40 resolveJobLogs JobLogArgs { job_log_id } = dbJobLogs job_log_id
43 :: (HasConnectionPool env, HasConfig env, HasJobEnv' env)
44 => Int -> GqlM e env [JobLog]
45 dbJobLogs job_log_id = do
46 --getJobLogs job_log_id
49 --val <- liftBase $ readMVar $ env ^. job_env . jenv_jobs . env_state_mvar
50 let val = env ^. job_env
51 printDebug "[dbJobLogs] env ^. job_env ^. jenv_jobs" val
52 printDebug "[dbJobLogs] job_log_id" job_log_id