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
195
Issues
195
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
5af7bd5d
Commit
5af7bd5d
authored
Aug 25, 2021
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DEBUG] some debug messages
parent
a3dc2f3f
Pipeline
#1727
passed with stage
in 33 minutes and 41 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
16 deletions
+37
-16
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+33
-13
NodeStory.hs
src/Gargantext/Core/NodeStory.hs
+4
-3
No files found.
src/Gargantext/API/Ngrams.hs
View file @
5af7bd5d
...
@@ -248,6 +248,7 @@ setListNgrams :: HasNodeStory env err m
...
@@ -248,6 +248,7 @@ setListNgrams :: HasNodeStory env err m
->
Map
NgramsTerm
NgramsRepoElement
->
Map
NgramsTerm
NgramsRepoElement
->
m
()
->
m
()
setListNgrams
listId
ngramsType
ns
=
do
setListNgrams
listId
ngramsType
ns
=
do
printDebug
"[setListNgrams]"
(
listId
,
ngramsType
)
getter
<-
view
hasNodeStory
getter
<-
view
hasNodeStory
var
<-
liftBase
$
(
getter
^.
nse_getter
)
listId
var
<-
liftBase
$
(
getter
^.
nse_getter
)
listId
liftBase
$
modifyMVar_
var
$
liftBase
$
modifyMVar_
var
$
...
@@ -278,12 +279,14 @@ newNgramsFromNgramsStatePatch p =
...
@@ -278,12 +279,14 @@ newNgramsFromNgramsStatePatch p =
]
]
-- tableNgramsPut :: (HasInvalidError err, RepoCmdM env err m)
commitStatePatch
::
HasNodeStory
env
err
m
commitStatePatch
::
HasNodeStory
env
err
m
=>
ListId
=>
ListId
->
Versioned
NgramsStatePatch'
->
Versioned
NgramsStatePatch'
->
m
(
Versioned
NgramsStatePatch'
)
->
m
(
Versioned
NgramsStatePatch'
)
commitStatePatch
listId
(
Versioned
p_version
p
)
=
do
commitStatePatch
listId
(
Versioned
p_version
p
)
=
do
printDebug
"[commitStatePatch]"
listId
var
<-
getRepoVar
listId
var
<-
getRepoVar
listId
vq'
<-
liftBase
$
modifyMVar
var
$
\
ns
->
do
vq'
<-
liftBase
$
modifyMVar
var
$
\
ns
->
do
let
let
...
@@ -293,6 +296,19 @@ commitStatePatch listId (Versioned p_version p) = do
...
@@ -293,6 +296,19 @@ commitStatePatch listId (Versioned p_version p) = do
a'
=
a
&
a_version
+~
1
a'
=
a
&
a_version
+~
1
&
a_state
%~
act
p'
&
a_state
%~
act
p'
&
a_history
%~
(
p'
:
)
&
a_history
%~
(
p'
:
)
{-
-- Ideally we would like to check these properties. However:
-- * They should be checked only to debug the code. The client data
-- should be able to trigger these.
-- * What kind of error should they throw (we are in IO here)?
-- * Should we keep modifyMVar?
-- * Should we throw the validation in an Exception, catch it around
-- modifyMVar and throw it back as an Error?
assertValid $ transformable p q
assertValid $ applicable p' (r ^. r_state)
-}
printDebug
"a version"
(
a
^.
a_version
)
pure
(
ns
&
unNodeStory
.
at
listId
.~
(
Just
a'
)
pure
(
ns
&
unNodeStory
.
at
listId
.~
(
Just
a'
)
,
Versioned
(
a'
^.
a_version
)
q'
,
Versioned
(
a'
^.
a_version
)
q'
)
)
...
@@ -300,7 +316,7 @@ commitStatePatch listId (Versioned p_version p) = do
...
@@ -300,7 +316,7 @@ commitStatePatch listId (Versioned p_version p) = do
-- Save new ngrams
-- Save new ngrams
_
<-
insertNgrams
(
newNgramsFromNgramsStatePatch
p
)
_
<-
insertNgrams
(
newNgramsFromNgramsStatePatch
p
)
pure
$
vq'
pure
vq'
...
@@ -311,6 +327,7 @@ tableNgramsPull :: HasNodeStory env err m
...
@@ -311,6 +327,7 @@ tableNgramsPull :: HasNodeStory env err m
->
Version
->
Version
->
m
(
Versioned
NgramsTablePatch
)
->
m
(
Versioned
NgramsTablePatch
)
tableNgramsPull
listId
ngramsType
p_version
=
do
tableNgramsPull
listId
ngramsType
p_version
=
do
printDebug
"[tableNgramsPull]"
(
listId
,
ngramsType
)
var
<-
getRepoVar
listId
var
<-
getRepoVar
listId
r
<-
liftBase
$
readMVar
var
r
<-
liftBase
$
readMVar
var
...
@@ -324,6 +341,7 @@ tableNgramsPull listId ngramsType p_version = do
...
@@ -324,6 +341,7 @@ tableNgramsPull listId ngramsType p_version = do
-- tableNgramsPut :: (HasInvalidError err, RepoCmdM env err m)
-- Apply the given patch to the DB and returns the patch to be applied on the
-- Apply the given patch to the DB and returns the patch to be applied on the
-- client.
-- client.
-- TODO-ACCESS check
-- TODO-ACCESS check
...
@@ -337,10 +355,12 @@ tableNgramsPut :: ( HasNodeStory env err m
...
@@ -337,10 +355,12 @@ tableNgramsPut :: ( HasNodeStory env err m
->
m
(
Versioned
NgramsTablePatch
)
->
m
(
Versioned
NgramsTablePatch
)
tableNgramsPut
tabType
listId
(
Versioned
p_version
p_table
)
tableNgramsPut
tabType
listId
(
Versioned
p_version
p_table
)
|
p_table
==
mempty
=
do
|
p_table
==
mempty
=
do
printDebug
"[tableNgramsPut]"
(
"TableEmpty"
::
Text
)
let
ngramsType
=
ngramsTypeFromTabType
tabType
let
ngramsType
=
ngramsTypeFromTabType
tabType
tableNgramsPull
listId
ngramsType
p_version
tableNgramsPull
listId
ngramsType
p_version
|
otherwise
=
do
|
otherwise
=
do
printDebug
"[tableNgramsPut]"
(
"TableNonEmpty"
::
Text
)
let
ngramsType
=
ngramsTypeFromTabType
tabType
let
ngramsType
=
ngramsTypeFromTabType
tabType
(
p
,
p_validity
)
=
PM
.
singleton
ngramsType
p_table
(
p
,
p_validity
)
=
PM
.
singleton
ngramsType
p_table
...
@@ -370,17 +390,17 @@ tableNgramsPostChartsAsync utn logStatus = do
...
@@ -370,17 +390,17 @@ tableNgramsPostChartsAsync utn logStatus = do
_uId
=
node
^.
node_user_id
_uId
=
node
^.
node_user_id
mCId
=
node
^.
node_parent_id
mCId
=
node
^.
node_parent_id
printDebug
"[tableNgramsPut
] tabType"
tabType
-- printDebug "[tableNgramsPostChartsAsync
] tabType" tabType
printDebug
"[tableNgramsPut
] listId"
listId
-- printDebug "[tableNgramsPostChartsAsync
] listId" listId
case
mCId
of
case
mCId
of
Nothing
->
do
Nothing
->
do
printDebug
"[tableNgramsP
ut
] can't update charts, no parent, nId"
nId
printDebug
"[tableNgramsP
ostChartsAsync
] can't update charts, no parent, nId"
nId
pure
$
jobLogFail
$
jobLogInit
1
pure
$
jobLogFail
$
jobLogInit
1
Just
cId
->
do
Just
cId
->
do
case
tabType
of
case
tabType
of
Authors
->
do
Authors
->
do
-- printDebug "[tableNgramsP
ut
] Authors, updating Pie, cId" cId
-- printDebug "[tableNgramsP
ostChartsAsync
] Authors, updating Pie, cId" cId
(
logRef
,
logRefSuccess
,
getRef
)
<-
runJobLog
1
logStatus
(
logRef
,
logRefSuccess
,
getRef
)
<-
runJobLog
1
logStatus
logRef
logRef
_
<-
Metrics
.
updatePie
cId
(
Just
listId
)
tabType
Nothing
_
<-
Metrics
.
updatePie
cId
(
Just
listId
)
tabType
Nothing
...
@@ -388,22 +408,22 @@ tableNgramsPostChartsAsync utn logStatus = do
...
@@ -388,22 +408,22 @@ tableNgramsPostChartsAsync utn logStatus = do
getRef
getRef
Institutes
->
do
Institutes
->
do
-- printDebug "[tableNgramsP
ut
] Institutes, updating Tree, cId" cId
-- printDebug "[tableNgramsP
ostChartsAsync
] Institutes, updating Tree, cId" cId
-- printDebug "[tableNgramsP
ut
] updating tree StopTerm, cId" cId
-- printDebug "[tableNgramsP
ostChartsAsync
] updating tree StopTerm, cId" cId
(
logRef
,
logRefSuccess
,
getRef
)
<-
runJobLog
3
logStatus
(
logRef
,
logRefSuccess
,
getRef
)
<-
runJobLog
3
logStatus
logRef
logRef
_
<-
Metrics
.
updateTree
cId
(
Just
listId
)
tabType
StopTerm
_
<-
Metrics
.
updateTree
cId
(
Just
listId
)
tabType
StopTerm
-- printDebug "[tableNgramsP
ut
] updating tree CandidateTerm, cId" cId
-- printDebug "[tableNgramsP
ostChartsAsync
] updating tree CandidateTerm, cId" cId
logRefSuccess
logRefSuccess
_
<-
Metrics
.
updateTree
cId
(
Just
listId
)
tabType
CandidateTerm
_
<-
Metrics
.
updateTree
cId
(
Just
listId
)
tabType
CandidateTerm
-- printDebug "[tableNgramsP
ut
] updating tree MapTerm, cId" cId
-- printDebug "[tableNgramsP
ostChartsAsync
] updating tree MapTerm, cId" cId
logRefSuccess
logRefSuccess
_
<-
Metrics
.
updateTree
cId
(
Just
listId
)
tabType
MapTerm
_
<-
Metrics
.
updateTree
cId
(
Just
listId
)
tabType
MapTerm
logRefSuccess
logRefSuccess
getRef
getRef
Sources
->
do
Sources
->
do
-- printDebug "[tableNgramsP
ut
] Sources, updating chart, cId" cId
-- printDebug "[tableNgramsP
ostChartsAsync
] Sources, updating chart, cId" cId
(
logRef
,
logRefSuccess
,
getRef
)
<-
runJobLog
1
logStatus
(
logRef
,
logRefSuccess
,
getRef
)
<-
runJobLog
1
logStatus
logRef
logRef
_
<-
Metrics
.
updatePie
cId
(
Just
listId
)
tabType
Nothing
_
<-
Metrics
.
updatePie
cId
(
Just
listId
)
tabType
Nothing
...
@@ -411,7 +431,7 @@ tableNgramsPostChartsAsync utn logStatus = do
...
@@ -411,7 +431,7 @@ tableNgramsPostChartsAsync utn logStatus = do
getRef
getRef
Terms
->
do
Terms
->
do
-- printDebug "[tableNgramsP
ut
] Terms, updating Metrics (Histo), cId" cId
-- printDebug "[tableNgramsP
ostChartsAsync
] Terms, updating Metrics (Histo), cId" cId
(
logRef
,
logRefSuccess
,
getRef
)
<-
runJobLog
6
logStatus
(
logRef
,
logRefSuccess
,
getRef
)
<-
runJobLog
6
logStatus
logRef
logRef
{-
{-
...
@@ -431,7 +451,7 @@ tableNgramsPostChartsAsync utn logStatus = do
...
@@ -431,7 +451,7 @@ tableNgramsPostChartsAsync utn logStatus = do
getRef
getRef
_
->
do
_
->
do
printDebug
"[tableNgramsP
ut
] no update for tabType = "
tabType
printDebug
"[tableNgramsP
ostChartsAsync
] no update for tabType = "
tabType
pure
$
jobLogFail
$
jobLogInit
1
pure
$
jobLogFail
$
jobLogInit
1
{-
{-
...
...
src/Gargantext/Core/NodeStory.hs
View file @
5af7bd5d
...
@@ -134,7 +134,8 @@ type NodeStoryDir = FilePath
...
@@ -134,7 +134,8 @@ type NodeStoryDir = FilePath
writeNodeStories
::
NodeStoryDir
->
NodeListStory
->
IO
()
writeNodeStories
::
NodeStoryDir
->
NodeListStory
->
IO
()
writeNodeStories
fp
nls
=
do
writeNodeStories
fp
nls
=
do
_
<-
mapM
(
writeNodeStory
fp
)
$
splitByNode
nls
done
<-
mapM
(
writeNodeStory
fp
)
$
splitByNode
nls
printDebug
"[writeNodeStories]"
done
pure
()
pure
()
writeNodeStory
::
NodeStoryDir
->
(
NodeId
,
NodeListStory
)
->
IO
()
writeNodeStory
::
NodeStoryDir
->
(
NodeId
,
NodeListStory
)
->
IO
()
...
@@ -145,10 +146,10 @@ splitByNode (NodeStory m) =
...
@@ -145,10 +146,10 @@ splitByNode (NodeStory m) =
List
.
map
(
\
(
n
,
a
)
->
(
n
,
NodeStory
$
Map
.
singleton
n
a
))
$
Map
.
toList
m
List
.
map
(
\
(
n
,
a
)
->
(
n
,
NodeStory
$
Map
.
singleton
n
a
))
$
Map
.
toList
m
saverAction'
::
NodeStoryDir
->
NodeId
->
Serialise
a
=
>
a
->
IO
()
saverAction'
::
Serialise
a
=>
NodeStoryDir
->
NodeId
-
>
a
->
IO
()
saverAction'
repoDir
nId
a
=
do
saverAction'
repoDir
nId
a
=
do
withTempFile
repoDir
((
cs
$
show
nId
)
<>
"-tmp-repo.cbor"
)
$
\
fp
h
->
do
withTempFile
repoDir
((
cs
$
show
nId
)
<>
"-tmp-repo.cbor"
)
$
\
fp
h
->
do
printDebug
"
repoSaverAction
"
fp
printDebug
"
[repoSaverAction]
"
fp
DBL
.
hPut
h
$
serialise
a
DBL
.
hPut
h
$
serialise
a
hClose
h
hClose
h
renameFile
fp
(
nodeStoryPath
repoDir
nId
)
renameFile
fp
(
nodeStoryPath
repoDir
nId
)
...
...
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