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
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
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
3d954f25
Commit
3d954f25
authored
Nov 03, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ngrams] refactoring of job log functions
parent
ec4c006c
Pipeline
#1185
canceled with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
13 deletions
+17
-13
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+2
-0
Job.hs
src/Gargantext/Prelude/Job.hs
+15
-13
No files found.
src/Gargantext/API/Ngrams.hs
View file @
3d954f25
...
...
@@ -130,6 +130,7 @@ import Gargantext.Database.Action.Metrics.NgramsByNode (getOccByNgramsOnlyFast')
import
Gargantext.Database.Admin.Config
(
userMaster
)
import
Gargantext.Database.Admin.Types.Node
(
NodeType
(
..
))
import
Gargantext.Database.Prelude
(
HasConnectionPool
,
HasConfig
)
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
)
import
Gargantext.Database.Query.Table.Node.Select
import
Gargantext.Database.Query.Table.Ngrams
hiding
(
NgramsType
(
..
),
ngrams
,
ngramsType
,
ngrams_terms
)
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
)
...
...
@@ -350,6 +351,7 @@ tableNgramsPut tabType listId (Versioned p_version p_table)
tableNgramsPostChartsAsync
::
(
FlowCmdM
env
err
m
,
HasNodeError
err
,
HasSettings
env
)
=>
UpdateTableNgramsCharts
...
...
src/Gargantext/Prelude/Job.hs
View file @
3d954f25
module
Gargantext.Prelude.Job
where
import
Control.Monad.IO.Class
(
liftIO
,
MonadIO
)
import
Data.IORef
import
Data.Maybe
...
...
@@ -35,17 +36,18 @@ jobLogFail (JobLog { _scst_succeeded = mSucc
,
_scst_failed
=
(
+
1
)
<$>
mFail
,
_scst_events
=
evt
}
runJobLog
::
Int
->
(
JobLog
->
IO
()
)
->
IO
(
IO
()
,
IO
()
,
IO
JobLog
)
runJobLog
::
MonadIO
io
=>
Int
->
(
JobLog
->
io
()
)
->
io
(
io
()
,
io
()
,
io
JobLog
)
runJobLog
num
logStatus
=
do
jlRef
<-
newIORef
$
jobLogInit
num
let
logRef
=
do
jl
<-
readIORef
jlRef
logStatus
jl
let
logRefSuccess
=
do
jl
<-
readIORef
jlRef
writeIORef
$
jobLogSuccess
jl
let
getRef
=
do
readIORef
jlRef
return
(
logRef
,
logRefSuccess
,
getRef
)
jlRef
<-
liftIO
$
newIORef
$
jobLogInit
num
return
(
logRefF
jlRef
,
logRefSuccessF
jlRef
,
getRefF
jlRef
)
where
logRefF
ref
=
do
jl
<-
liftIO
$
readIORef
ref
logStatus
jl
logRefSuccessF
ref
=
do
jl
<-
liftIO
$
readIORef
ref
liftIO
$
writeIORef
ref
$
jobLogSuccess
jl
getRefF
ref
=
do
liftIO
$
readIORef
ref
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