Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
775c1232
Commit
775c1232
authored
Sep 06, 2017
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Recount must be computed asynchronously.
parent
474fff2c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
main.py
gargantext/util/toolchain/main.py
+2
-1
metrics.py
gargantext/views/api/metrics.py
+2
-1
No files found.
gargantext/util/toolchain/main.py
View file @
775c1232
...
...
@@ -185,7 +185,7 @@ def parse_extract_indexhyperdata(corpus):
session
.
commit
()
@
shared_task
def
recount
(
corpus
):
def
recount
(
corpus
_id
):
"""
Recount essential metrics of the toolchain after group modifications.
...
...
@@ -203,6 +203,7 @@ def recount(corpus):
NB: no new extraction, no list change, just the metrics
"""
corpus
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
corpus_id
)
.
first
()
# 1) we'll need the new groups and mainlist as basis
group_id
=
corpus
.
children
(
"GROUPLIST"
)
.
first
()
.
id
mainlist_id
=
corpus
.
children
(
"MAINLIST"
)
.
first
()
.
id
...
...
gargantext/views/api/metrics.py
View file @
775c1232
...
...
@@ -2,6 +2,7 @@ from gargantext.util.db_cache import cache
from
gargantext.util.http
import
ValidationException
,
APIView
\
,
HttpResponse
,
JsonHttpResponse
from
gargantext.util.toolchain.main
import
recount
from
gargantext.util.scheduling
import
scheduled
from
datetime
import
datetime
class
CorpusMetrics
(
APIView
):
...
...
@@ -32,7 +33,7 @@ class CorpusMetrics(APIView):
else
:
t_before
=
datetime
.
now
()
# =============
recount
(
corpus
)
scheduled
(
recount
)(
corpus
.
id
)
# =============
t_after
=
datetime
.
now
()
...
...
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