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
160
Issues
160
List
Board
Labels
Milestones
Merge Requests
14
Merge Requests
14
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
504b2514
Commit
504b2514
authored
Oct 28, 2024
by
Alfredo Di Napoli
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Thread old compute time in flowPhyloAPI
This allows us to collect a /history/ of computing times.
parent
7beb5d72
Pipeline
#6899
failed with stages
in 49 minutes and 22 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
13 deletions
+24
-13
Update.hs
src/Gargantext/API/Node/Update.hs
+11
-8
API.hs
src/Gargantext/Core/Viz/Phylo/API.hs
+3
-1
Tools.hs
src/Gargantext/Core/Viz/Phylo/API/Tools.hs
+10
-4
No files found.
src/Gargantext/API/Node/Update.hs
View file @
504b2514
...
@@ -9,12 +9,13 @@ Portability : POSIX
...
@@ -9,12 +9,13 @@ Portability : POSIX
-}
-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
module
Gargantext.API.Node.Update
module
Gargantext.API.Node.Update
where
where
import
Control.Lens
(
view
)
import
Control.Lens
(
view
,
(
^?
),
_Just
)
import
Data.Set
qualified
as
Set
import
Data.Set
qualified
as
Set
import
Gargantext.API.Admin.EnvTypes
(
GargJob
(
..
),
Env
)
import
Gargantext.API.Admin.EnvTypes
(
GargJob
(
..
),
Env
)
import
Gargantext.API.Admin.Orchestrator.Types
(
AsyncJobs
(
..
))
import
Gargantext.API.Admin.Orchestrator.Types
(
AsyncJobs
(
..
))
...
@@ -28,16 +29,16 @@ import Gargantext.Core.NodeStory.Types (HasNodeStory)
...
@@ -28,16 +29,16 @@ import Gargantext.Core.NodeStory.Types (HasNodeStory)
import
Gargantext.Core.Text.Ngrams
(
NgramsType
(
NgramsTerms
))
import
Gargantext.Core.Text.Ngrams
(
NgramsType
(
NgramsTerms
))
import
Gargantext.Core.Types.Main
(
ListType
(
..
))
import
Gargantext.Core.Types.Main
(
ListType
(
..
))
import
Gargantext.Core.Viz.Graph.API
(
recomputeGraph
)
import
Gargantext.Core.Viz.Graph.API
(
recomputeGraph
)
import
Gargantext.Core.Viz.Phylo
(
subConfigAPI2config
)
import
Gargantext.Core.Viz.Phylo
(
subConfigAPI2config
,
phylo_computeTime
)
import
Gargantext.Core.Viz.Phylo.API.Tools
(
flowPhyloAPI
)
import
Gargantext.Core.Viz.Phylo.API.Tools
(
flowPhyloAPI
)
import
Gargantext.Database.Action.Flow
(
reIndexWith
)
import
Gargantext.Database.Action.Flow
(
reIndexWith
)
import
Gargantext.Database.Action.Flow.Pairing
(
pairing
)
import
Gargantext.Database.Action.Flow.Pairing
(
pairing
)
import
Gargantext.Database.Action.Metrics
(
updateNgramsOccurrences
,
updateContextScore
)
import
Gargantext.Database.Action.Metrics
(
updateNgramsOccurrences
,
updateContextScore
)
import
Gargantext.Database.Admin.Types.Hyperdata.Phylo
(
HyperdataPhylo
(
HyperdataPhylo
)
)
import
Gargantext.Database.Admin.Types.Hyperdata.Phylo
(
HyperdataPhylo
(
..
),
hp_data
)
import
Gargantext.Database.Admin.Types.Node
(
NodeId
,
NodeType
(
NodeCorpus
,
NodeAnnuaire
,
NodeTexts
,
NodeGraph
,
NodePhylo
,
NodeList
)
)
import
Gargantext.Database.Admin.Types.Node
(
NodeId
,
NodeType
(
NodeCorpus
,
NodeAnnuaire
,
NodeTexts
,
NodeGraph
,
NodePhylo
,
NodeList
)
)
import
Gargantext.Database.Query.Table.Node
(
defaultList
,
getNode
,
getChildrenByType
)
import
Gargantext.Database.Query.Table.Node
(
defaultList
,
getNode
,
getChildrenByType
,
getNodeWith
)
import
Gargantext.Database.Query.Table.Node.UpdateOpaleye
(
updateHyperdata
)
import
Gargantext.Database.Query.Table.Node.UpdateOpaleye
(
updateHyperdata
)
import
Gargantext.Database.Schema.Node
(
node_parent_id
)
import
Gargantext.Database.Schema.Node
(
node_parent_id
,
node_hyperdata
)
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Gargantext.System.Logging
(
MonadLogger
)
import
Gargantext.System.Logging
(
MonadLogger
)
import
Gargantext.Utils.Jobs
(
serveJobsAPI
,
MonadJobStatus
(
..
))
import
Gargantext.Utils.Jobs
(
serveJobsAPI
,
MonadJobStatus
(
..
))
...
@@ -111,12 +112,14 @@ updateNode lId (UpdateNodeParamsList _mode) jobHandle = do
...
@@ -111,12 +112,14 @@ updateNode lId (UpdateNodeParamsList _mode) jobHandle = do
updateNode
phyloId
(
UpdateNodePhylo
config
)
jobHandle
=
do
updateNode
phyloId
(
UpdateNodePhylo
config
)
jobHandle
=
do
markStarted
3
jobHandle
markStarted
3
jobHandle
corpusId'
<-
view
node_parent_id
<$>
getNode
phyloId
oldPhylo
<-
getNodeWith
phyloId
(
Proxy
@
HyperdataPhylo
)
let
corpusId'
=
view
node_parent_id
oldPhylo
let
mbComputeHistory
=
oldPhylo
^?
node_hyperdata
.
hp_data
.
traverse
.
phylo_computeTime
.
_Just
markProgress
1
jobHandle
markProgress
1
jobHandle
let
corpusId
=
fromMaybe
(
panicTrace
"no corpus id"
)
corpusId'
let
corpusId
=
fromMaybe
(
panicTrace
"no corpus id"
)
corpusId'
phy
<-
timeMeasured
"updateNode.flowPhyloAPI"
$
flowPhyloAPI
(
subConfigAPI2config
config
)
corpusId
phy
<-
timeMeasured
"updateNode.flowPhyloAPI"
$
flowPhyloAPI
(
subConfigAPI2config
config
)
mbComputeHistory
corpusId
markProgress
2
jobHandle
markProgress
2
jobHandle
{-
{-
...
...
src/Gargantext/Core/Viz/Phylo/API.hs
View file @
504b2514
...
@@ -101,7 +101,9 @@ postPhylo phyloId = Named.PostPhylo $ \_lId -> do
...
@@ -101,7 +101,9 @@ postPhylo phyloId = Named.PostPhylo $ \_lId -> do
-- _sft = Just (Software "Gargantext" "4")
-- _sft = Just (Software "Gargantext" "4")
-- _prm = initPhyloParam vrs sft (Just q)
-- _prm = initPhyloParam vrs sft (Just q)
corpusId
<-
getClosestParentIdByType
phyloId
NodeCorpus
corpusId
<-
getClosestParentIdByType
phyloId
NodeCorpus
phy
<-
flowPhyloAPI
defaultConfig
(
fromMaybe
(
panicTrace
"[G.C.V.P.API] no corpus ID found"
)
corpusId
)
-- params
-- Being the first time we ask for the Phylo, there is no historical data
-- available about computing time, so we pass 'Nothing'.
phy
<-
flowPhyloAPI
defaultConfig
Nothing
(
fromMaybe
(
panicTrace
"[G.C.V.P.API] no corpus ID found"
)
corpusId
)
-- params
-- phyloId <- insertNodes [node NodePhylo "Phylo" (HyperdataPhylo Nothing (Just phy)) (Just corpusId) userId]
-- phyloId <- insertNodes [node NodePhylo "Phylo" (HyperdataPhylo Nothing (Just phy)) (Just corpusId) userId]
_
<-
updateHyperdata
phyloId
(
HyperdataPhylo
Nothing
(
Just
phy
))
_
<-
updateHyperdata
phyloId
(
HyperdataPhylo
Nothing
(
Just
phy
))
pure
phyloId
pure
phyloId
...
...
src/Gargantext/Core/Viz/Phylo/API/Tools.hs
View file @
504b2514
...
@@ -33,7 +33,7 @@ import Gargantext.Core.NodeStory.Types (HasNodeStory)
...
@@ -33,7 +33,7 @@ import Gargantext.Core.NodeStory.Types (HasNodeStory)
import
Gargantext.Core.Text.Ngrams
(
NgramsType
(
..
))
import
Gargantext.Core.Text.Ngrams
(
NgramsType
(
..
))
import
Gargantext.Core.Text.Terms.WithList
(
Patterns
,
buildPatterns
,
termsInText
)
import
Gargantext.Core.Text.Terms.WithList
(
Patterns
,
buildPatterns
,
termsInText
)
import
Gargantext.Core.Types.Main
(
ListType
(
MapTerm
))
import
Gargantext.Core.Types.Main
(
ListType
(
MapTerm
))
import
Gargantext.Core.Viz.Phylo
(
TimeUnit
(
..
),
Date
,
Document
(
..
),
PhyloConfig
(
..
),
Phylo
,
trackComputeTime
)
import
Gargantext.Core.Viz.Phylo
(
TimeUnit
(
..
),
Date
,
Document
(
..
),
PhyloConfig
(
..
),
Phylo
(
_phylo_computeTime
),
trackComputeTime
,
ComputeTimeHistory
)
import
Gargantext.Core.Viz.Phylo.PhyloExport
(
toPhyloExport
,
dotToFile
)
import
Gargantext.Core.Viz.Phylo.PhyloExport
(
toPhyloExport
,
dotToFile
)
import
Gargantext.Core.Viz.Phylo.PhyloMaker
(
toPhylo
,
toPhyloWithoutLink
)
import
Gargantext.Core.Viz.Phylo.PhyloMaker
(
toPhylo
,
toPhyloWithoutLink
)
import
Gargantext.Core.Viz.Phylo.PhyloTools
(
{-printIOMsg, printIOComment,-}
setConfig
)
import
Gargantext.Core.Viz.Phylo.PhyloTools
(
{-printIOMsg, printIOComment,-}
setConfig
)
...
@@ -111,8 +111,12 @@ phylo2dot phylo = do
...
@@ -111,8 +111,12 @@ phylo2dot phylo = do
flowPhyloAPI
::
(
HasNodeStory
env
err
m
,
HasNodeError
err
,
MonadLogger
m
)
flowPhyloAPI
::
(
HasNodeStory
env
err
m
,
HasNodeError
err
,
MonadLogger
m
)
=>
PhyloConfig
->
CorpusId
->
m
Phylo
=>
PhyloConfig
flowPhyloAPI
config
cId
=
do
->
Maybe
ComputeTimeHistory
-- ^ Previous compute time historical data, if any.
->
CorpusId
->
m
Phylo
flowPhyloAPI
config
mbOldComputeHistory
cId
=
do
corpus
<-
timeMeasured
"flowPhyloAPI.corpusIdtoDocuments"
$
corpusIdtoDocuments
(
timeUnit
config
)
cId
corpus
<-
timeMeasured
"flowPhyloAPI.corpusIdtoDocuments"
$
corpusIdtoDocuments
(
timeUnit
config
)
cId
-- writePhylo phyloWithCliquesFile phyloWithCliques
-- writePhylo phyloWithCliquesFile phyloWithCliques
$
(
logLocM
)
DEBUG
$
"PhyloConfig old: "
<>
show
config
$
(
logLocM
)
DEBUG
$
"PhyloConfig old: "
<>
show
config
...
@@ -121,7 +125,9 @@ flowPhyloAPI config cId = do
...
@@ -121,7 +125,9 @@ flowPhyloAPI config cId = do
(
t2
,
phyloConfigured
)
<-
timeMeasured''
DEBUG
"flowPhyloAPI.phyloConfigured"
(
pure
$!
setConfig
config
phyloWithCliques
)
(
t2
,
phyloConfigured
)
<-
timeMeasured''
DEBUG
"flowPhyloAPI.phyloConfigured"
(
pure
$!
setConfig
config
phyloWithCliques
)
(
t3
,
finalPhylo
)
<-
timeMeasured''
DEBUG
"flowPhyloAPI.toPhylo"
(
pure
$!
toPhylo
phyloConfigured
)
(
t3
,
finalPhylo
)
<-
timeMeasured''
DEBUG
"flowPhyloAPI.toPhylo"
(
pure
$!
toPhylo
phyloConfigured
)
pure
$!
trackComputeTime
(
t1
+
t2
+
t3
)
finalPhylo
-- As the phylo is computed fresh every time, without looking at the one stored (if any), we
-- have to manually propagate computing time across.
pure
$!
trackComputeTime
(
t1
+
t2
+
t3
)
(
finalPhylo
{
_phylo_computeTime
=
mbOldComputeHistory
})
--------------------------------------------------------------------
--------------------------------------------------------------------
corpusIdtoDocuments
::
(
HasNodeStory
env
err
m
,
HasNodeError
err
)
corpusIdtoDocuments
::
(
HasNodeStory
env
err
m
,
HasNodeError
err
)
...
...
Przemyslaw Kaminski
@cgenie
mentioned in commit
83c8708f
·
Nov 07, 2024
mentioned in commit
83c8708f
mentioned in commit 83c8708f08e563243a0ff361e51a46c7d7822bb7
Toggle commit list
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