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
8e38ad36
Commit
8e38ad36
authored
Apr 24, 2015
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] Adding steps of processing.
parent
36fc9f74
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
25 deletions
+15
-25
celery.py
gargantext_web/celery.py
+15
-24
db.py
gargantext_web/db.py
+0
-1
No files found.
gargantext_web/celery.py
View file @
8e38ad36
# -*- coding: utf-8 -*-
#import os
#import djcelery
#
...
...
@@ -46,39 +45,31 @@ def apply_sum(x, y):
from
parsing.corpustools
import
add_resource
,
parse_resources
,
extract_ngrams
,
compute_tfidf
from
admin.utils
import
PrintException
def
update_processing
(
corpus
,
step
=
0
):
try
:
corpus
.
metadata
[
'Processing'
]
=
step
corpus
.
save
()
except
:
PrintException
()
@
shared_task
def
apply_workflow
(
corpus_id
):
corpus
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
corpus_id
)
.
first
()
corpus_django
=
models
.
Node
.
objects
.
get
(
id
=
corpus_id
)
update_processing
(
corpus_django
,
1
)
parse_resources
(
corpus
)
try
:
print
(
"-"
*
60
)
# With Django ORM
corpus_django
=
models
.
Node
.
objects
.
get
(
id
=
corpus_id
)
corpus_django
.
metadata
[
'Processing'
]
=
"2"
corpus_django
.
save
()
print
(
"-"
*
60
)
#TODO With SLA ORM (KO why?)
# corpus.metadata['Processing'] = 0
# session.add(corpus)
# session.flush()
except
Exception
as
error
:
print
(
error
)
update_processing
(
corpus_django
,
2
)
extract_ngrams
(
corpus
,
[
'title'
,
'abstract'
])
update_processing
(
corpus_django
,
3
)
compute_tfidf
(
corpus
)
try
:
corpus_django
.
metadata
[
'Processing'
]
=
0
corpus_django
.
save
()
except
Exception
as
error
:
print
(
error
)
update_processing
(
corpus_django
,
0
)
gargantext_web/db.py
View file @
8e38ad36
...
...
@@ -2,7 +2,6 @@ from gargantext_web import settings
from
node
import
models
__all__
=
[
'literalquery'
,
'session'
,
'cache'
,
'Session'
,
'bulk_insert'
,
'engine'
,
'get_cursor'
]
...
...
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