Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
153
Issues
153
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
cb861bf2
Commit
cb861bf2
authored
Apr 03, 2023
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove superclass constraint of MonadJob for MonadJobStatus
parent
97e04297
Pipeline
#3855
failed with stage
in 33 minutes and 1 second
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
28 deletions
+6
-28
EnvTypes.hs
src/Gargantext/API/Admin/EnvTypes.hs
+0
-4
Dev.hs
src/Gargantext/API/Dev.hs
+3
-20
Monad.hs
src/Gargantext/Utils/Jobs/Monad.hs
+3
-4
No files found.
src/Gargantext/API/Admin/EnvTypes.hs
View file @
cb861bf2
...
...
@@ -200,7 +200,6 @@ data DevEnv = DevEnv
,
_dev_env_nodeStory
::
!
NodeStoryEnv
,
_dev_env_mail
::
!
MailConfig
,
_dev_env_nlp
::
!
NLPServerMap
,
_dev_env_jobs
::
!
(
Jobs
.
JobEnv
GargJob
(
Seq
JobLog
)
JobLog
)
}
makeLenses
''
D
evEnv
...
...
@@ -208,9 +207,6 @@ makeLenses ''DevEnv
-- | Our /mock/ job handle.
data
DevJobHandle
=
DevJobHandle
instance
Jobs
.
MonadJob
(
GargM
DevEnv
err
)
GargJob
(
Seq
JobLog
)
JobLog
where
getJobEnv
=
asks
(
view
dev_env_jobs
)
instance
Jobs
.
MonadJobStatus
(
GargM
DevEnv
err
)
where
type
JobHandle
(
GargM
DevEnv
err
)
=
DevJobHandle
...
...
src/Gargantext/API/Dev.hs
View file @
cb861bf2
...
...
@@ -9,8 +9,6 @@ Portability : POSIX
-}
{-# LANGUAGE ScopedTypeVariables #-}
-- Use only for dev/repl
module
Gargantext.API.Dev
where
...
...
@@ -27,11 +25,8 @@ import Gargantext.Core.NodeStory
import
Gargantext.Database.Prelude
import
Gargantext.Prelude
import
Gargantext.Prelude.Config
(
readConfig
)
import
Network.HTTP.Client.TLS
(
newTlsManager
)
import
qualified
Gargantext.Prelude.Mail
as
Mail
import
qualified
Gargantext.Prelude.NLP
as
NLP
import
qualified
Gargantext.Utils.Jobs.Monad
as
Jobs
import
qualified
Gargantext.Utils.Jobs.Queue
as
Jobs
import
Servant
import
System.IO
(
FilePath
)
...
...
@@ -52,10 +47,6 @@ withDevEnv iniPath k = do
setts
<-
devSettings
devJwkFile
mail
<-
Mail
.
readConfig
iniPath
nlp_config
<-
NLP
.
readConfig
iniPath
secret
<-
Jobs
.
genSecret
let
jobs_settings
=
Jobs
.
defaultJobSettings
1
secret
manager_env
<-
newTlsManager
jobs_env
<-
Jobs
.
newJobEnv
jobs_settings
Jobs
.
defaultPrios
manager_env
pure
$
DevEnv
{
_dev_env_pool
=
pool
,
_dev_env_nodeStory
=
nodeStory_env
...
...
@@ -63,14 +54,8 @@ withDevEnv iniPath k = do
,
_dev_env_config
=
cfg
,
_dev_env_mail
=
mail
,
_dev_env_nlp
=
nlpServerMap
nlp_config
,
_dev_env_jobs
=
jobs_env
}
type
DevCmd
env
err
a
=
forall
m
.
(
CmdM''
env
err
m
,
Jobs
.
MonadJobStatus
m
)
=>
m
a
-- | Run Cmd Sugar for the Repl (GHCI)
runCmdRepl
::
Show
err
=>
Cmd''
DevEnv
err
a
->
IO
a
runCmdRepl
f
=
withDevEnv
"gargantext.ini"
$
\
env
->
runCmdDev
env
f
...
...
@@ -82,11 +67,9 @@ runCmdReplServantErr = runCmdRepl
-- the command.
-- This function is constrained to the DevEnv rather than
-- using HasConnectionPool and HasRepoVar.
runCmdDev
::
Show
err
=>
DevEnv
->
DevCmd
DevEnv
err
a
->
IO
a
runCmdDev
env
cmd
=
(
either
(
fail
.
show
)
pure
=<<
runExceptT
(
runReaderT
cmd
env
))
`
finally
`
runReaderT
saveNodeStoryImmediate
env
runCmdDev
::
Show
err
=>
DevEnv
->
Cmd''
DevEnv
err
a
->
IO
a
runCmdDev
env
f
=
(
either
(
fail
.
show
)
pure
=<<
runCmd
env
f
)
runCmdGargDev
::
DevEnv
->
GargM
DevEnv
GargError
a
->
IO
a
runCmdGargDev
env
cmd
=
...
...
src/Gargantext/Utils/Jobs/Monad.hs
View file @
cb861bf2
{-# LANGUAGE MultiWayIf, FunctionalDependencies, MultiParamTypeClasses, TypeFamilies
, TypeFamilyDependencies
#-}
{-# LANGUAGE MultiWayIf, FunctionalDependencies, MultiParamTypeClasses, TypeFamilies #-}
module
Gargantext.Utils.Jobs.Monad
(
-- * Types and classes
JobEnv
(
..
)
...
...
@@ -37,7 +37,6 @@ import Control.Monad.Except
import
Control.Monad.Reader
import
Data.Kind
(
Type
)
import
Data.Map.Strict
(
Map
)
import
Data.Sequence
(
Seq
)
import
Data.Time.Clock
import
qualified
Data.Text
as
T
import
Network.HTTP.Client
(
Manager
)
...
...
@@ -174,7 +173,7 @@ removeJob queued t jid = do
--
-- | A monad to query for the status of a particular job /and/ submit updates for in-progress jobs.
class
MonadJob
m
(
JobType
m
)
(
Seq
(
JobEventType
m
))
(
JobOutputType
m
)
=>
MonadJob
Status
m
where
class
MonadJobStatus
m
where
-- | 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
...
...
@@ -187,7 +186,7 @@ class MonadJob m (JobType m) (Seq (JobEventType m)) (JobOutputType m) => MonadJo
-- | 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.
getLatestJobStatus
::
MonadJobStatus
m
=>
JobHandle
m
->
m
(
JobEventType
m
)
getLatestJobStatus
::
JobHandle
m
->
m
(
JobEventType
m
)
-- | Adds an extra \"tracer\" that logs events to the passed action. Produces
-- a new 'JobHandle'.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment