Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Przemyslaw Kaminski
haskell-gargantext
Commits
48a8c59d
Commit
48a8c59d
authored
Apr 04, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Async] back (corpus input test) but still needs work.
parent
005d8dcc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
17 deletions
+30
-17
New.hs
src/Gargantext/API/Corpus/New.hs
+10
-9
API.hs
src/Gargantext/Viz/Graph/API.hs
+20
-8
No files found.
src/Gargantext/API/Corpus/New.hs
View file @
48a8c59d
...
@@ -257,11 +257,11 @@ addToCorpusWithForm cid (WithForm ft d l _n) logStatus = do
...
@@ -257,11 +257,11 @@ addToCorpusWithForm cid (WithForm ft d l _n) logStatus = do
PresseRIS
->
Parser
.
parseFormat
Parser
.
RisPresse
PresseRIS
->
Parser
.
parseFormat
Parser
.
RisPresse
newDocs
<-
liftIO
newEmptyMVar
newDocs
<-
liftIO
newEmptyMVar
docs
<-
liftIO
_
<-
liftIO
$
forkIO
$
splitEvery
500
<$>
putMVar
newDocs
<$>
splitEvery
500
<$>
take
1000000
<$>
take
1000000
<$>
parse
(
cs
d
)
<$>
parse
(
cs
d
)
_
<-
liftIO
$
forkIO
$
putMVar
newDocs
docs
logStatus
ScraperStatus
{
_scst_succeeded
=
Just
1
logStatus
ScraperStatus
{
_scst_succeeded
=
Just
1
,
_scst_failed
=
Just
0
,
_scst_failed
=
Just
0
...
@@ -269,13 +269,14 @@ addToCorpusWithForm cid (WithForm ft d l _n) logStatus = do
...
@@ -269,13 +269,14 @@ addToCorpusWithForm cid (WithForm ft d l _n) logStatus = do
,
_scst_events
=
Just
[]
,
_scst_events
=
Just
[]
}
}
docs'
<-
liftIO
$
takeMVar
newDocs
docs'
<-
liftIO
$
takeMVar
newDocs
newCid
<-
liftIO
newEmptyMVar
newCid
<-
liftIO
newEmptyMVar
cid'
<-
flowCorpus
"user1"
_
<-
forkIO
<$>
putMVar
newCid
(
Right
[
cid
])
<$>
flowCorpus
"user1"
(
Multi
$
fromMaybe
EN
l
)
(
Right
[
cid
]
)
(
map
(
map
toHyperdataDocument
)
docs'
)
(
Multi
$
fromMaybe
EN
l
)
_
<-
liftIO
$
forkIO
$
putMVar
newCid
cid'
(
map
(
map
toHyperdataDocument
)
docs'
)
cid''
<-
liftIO
$
takeMVar
newCid
cid''
<-
liftIO
$
takeMVar
newCid
printDebug
"cid'"
cid''
printDebug
"cid'"
cid''
...
...
src/Gargantext/Viz/Graph/API.hs
View file @
48a8c59d
...
@@ -158,25 +158,37 @@ recomputeGraph uId nId = do
...
@@ -158,25 +158,37 @@ recomputeGraph uId nId = do
g
<-
case
graph
of
g
<-
case
graph
of
Nothing
->
do
Nothing
->
do
graph'
<-
computeGraph
cId
NgramsTerms
repo
graph'
<-
computeGraph
Async
cId
NgramsTerms
repo
_
<-
insertGraph
cId
uId'
(
HyperdataGraph
$
Just
graph'
)
_
<-
insertGraph
cId
uId'
(
HyperdataGraph
$
Just
graph'
)
pure
$
trace
"[recomputeGraph] Graph empty, computing"
$
graph'
pure
$
trace
"[recomputeGraph] Graph empty, computing"
$
graph'
Just
graph'
->
if
listVersion
==
Just
v
Just
graph'
->
if
listVersion
==
Just
v
then
pure
graph'
then
pure
graph'
else
do
else
do
graph''
<-
computeGraph
cId
NgramsTerms
repo
graph''
<-
computeGraph
Async
cId
NgramsTerms
repo
_
<-
updateHyperdata
nId
(
HyperdataGraph
$
Just
graph''
)
_
<-
updateHyperdata
nId
(
HyperdataGraph
$
Just
graph''
)
pure
$
trace
"[recomputeGraph] Graph exists, recomputing"
$
graph''
pure
$
trace
"[recomputeGraph] Graph exists, recomputing"
$
graph''
newGraph
<-
liftIO
newEmptyMVar
pure
g
_
<-
liftIO
$
forkIO
$
putMVar
newGraph
g
g'
<-
liftIO
$
takeMVar
newGraph
computeGraphAsync
::
HasNodeError
err
=>
CorpusId
->
NgramsType
->
NgramsRepo
->
Cmd
err
Graph
computeGraphAsync
cId
nt
repo
=
do
g
<-
liftIO
newEmptyMVar
_
<-
forkIO
<$>
putMVar
g
<$>
computeGraph
cId
nt
repo
g'
<-
liftIO
$
takeMVar
g
pure
g'
pure
g'
-- TODO use Database Monad only here ?
-- TODO use Database Monad only here ?
computeGraph
::
HasNodeError
err
=>
CorpusId
->
NgramsType
->
NgramsRepo
->
Cmd
err
Graph
computeGraph
::
HasNodeError
err
=>
CorpusId
->
NgramsType
->
NgramsRepo
->
Cmd
err
Graph
computeGraph
cId
nt
repo
=
do
computeGraph
cId
nt
repo
=
do
lId
<-
defaultList
cId
lId
<-
defaultList
cId
...
@@ -190,12 +202,12 @@ computeGraph cId nt repo = do
...
@@ -190,12 +202,12 @@ computeGraph cId nt repo = do
lIds
<-
selectNodesWithUsername
NodeList
userMaster
lIds
<-
selectNodesWithUsername
NodeList
userMaster
let
ngs
=
filterListWithRoot
GraphTerm
$
mapTermListRoot
[
lId
]
nt
repo
let
ngs
=
filterListWithRoot
GraphTerm
$
mapTermListRoot
[
lId
]
nt
repo
myCooc
<-
inMVarIO
$
Map
.
filter
(
>
1
)
myCooc
<-
Map
.
filter
(
>
1
)
<$>
getCoocByNgrams
(
Diagonal
False
)
<$>
getCoocByNgrams
(
Diagonal
False
)
<$>
groupNodesByNgrams
ngs
<$>
groupNodesByNgrams
ngs
<$>
getNodesByNgramsOnlyUser
cId
(
lIds
<>
[
lId
])
nt
(
Map
.
keys
ngs
)
<$>
getNodesByNgramsOnlyUser
cId
(
lIds
<>
[
lId
])
nt
(
Map
.
keys
ngs
)
graph
<-
liftIO
$
inMVar
$
cooc2graph
0
myCooc
let
graph
=
cooc2graph
0
myCooc
let
graph'
=
set
graph_metadata
(
Just
metadata
)
graph
let
graph'
=
set
graph_metadata
(
Just
metadata
)
graph
pure
graph'
pure
graph'
...
...
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