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
78f36d52
Commit
78f36d52
authored
Apr 24, 2015
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CLEAN] celery file, processing steps cleaner with sqlalchemy.
parent
5981ec9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
35 deletions
+7
-35
celery.py
gargantext_web/celery.py
+7
-35
No files found.
gargantext_web/celery.py
View file @
78f36d52
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#import os
#import djcelery
#
#from celery import Celery
#
#from django.conf import settings
#
## set the default Django settings module for the 'celery' program.
#os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'gargantext_web.settings')
#
#app = Celery('gargantext_web')
#
#
#app.conf.update(
# CELERY_RESULT_BACKEND='djcelery.backends.database:DatabaseBackend',
#)
#
#
#app.conf.update(
# CELERY_RESULT_BACKEND='djcelery.backends.cache:CacheBackend',
#)
#
## Using a string here means the worker will not have to
## pickle the object when using Windows.
##app.config_from_object('django.conf:settings')
#app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
#
from
celery
import
shared_task
from
celery
import
shared_task
from
node
import
models
from
node
import
models
...
@@ -49,27 +22,26 @@ from admin.utils import PrintException
...
@@ -49,27 +22,26 @@ from admin.utils import PrintException
def
update_processing
(
corpus
,
step
=
0
):
def
update_processing
(
corpus
,
step
=
0
):
try
:
try
:
corpus
.
hyperdata
[
'Processing'
]
=
step
corpus
.
hyperdata
.
update
({
'Processing'
:
step
})
corpus
.
save
()
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
corpus
.
id
)
.
update
({
'hyperdata'
:
corpus
.
hyperdata
})
session
.
commit
()
except
:
except
:
PrintException
()
PrintException
()
@
shared_task
@
shared_task
def
apply_workflow
(
corpus_id
):
def
apply_workflow
(
corpus_id
):
corpus
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
corpus_id
)
.
first
()
corpus
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
corpus_id
)
.
first
()
corpus_django
=
models
.
Node
.
objects
.
get
(
id
=
corpus_id
)
update_processing
(
corpus
_django
,
1
)
update_processing
(
corpus
,
1
)
parse_resources
(
corpus
)
parse_resources
(
corpus
)
update_processing
(
corpus
_django
,
2
)
update_processing
(
corpus
,
2
)
extract_ngrams
(
corpus
,
[
'title'
,
'abstract'
])
extract_ngrams
(
corpus
,
[
'title'
,
'abstract'
])
update_processing
(
corpus
_django
,
3
)
update_processing
(
corpus
,
3
)
compute_tfidf
(
corpus
)
compute_tfidf
(
corpus
)
update_processing
(
corpus
_django
,
0
)
update_processing
(
corpus
,
0
)
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