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
d9e4716d
Commit
d9e4716d
authored
Oct 03, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'testing' into romain-testing
parents
3f2b219d
4af0bade
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
9 deletions
+51
-9
settings.py
gargantext/settings.py
+1
-1
__init__.py
gargantext/util/crawlers/__init__.py
+1
-1
projects.py
gargantext/views/pages/projects.py
+3
-0
graph.py
graph/graph.py
+12
-7
mail_notification.py
graph/mail_notification.py
+34
-0
No files found.
gargantext/settings.py
View file @
d9e4716d
...
...
@@ -40,7 +40,7 @@ CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml']
CELERY_IMPORTS
=
(
"gargantext.util.toolchain"
,
"gargantext.util.crawlers"
,
"graph.
cooccurrences
"
,
"graph.
graph
"
,
"moissonneurs.pubmed"
,
"moissonneurs.istex"
,
)
...
...
gargantext/util/crawlers/__init__.py
View file @
d9e4716d
...
...
@@ -10,7 +10,7 @@ for resource in RESOURCETYPES:
try
:
name
=
resource
[
"crawler"
]
#crawler is type basename+"Crawler"
filename
=
name
.
replace
(
"Crawler"
,
""
)
.
low
er
()
filename
=
name
.
replace
(
"Crawler"
,
""
)
.
upp
er
()
module
=
base_parser
+
".
%
s"
%
(
filename
)
importlib
.
import_module
(
module
)
...
...
gargantext/views/pages/projects.py
View file @
d9e4716d
...
...
@@ -54,6 +54,9 @@ def overview(request):
# projects owned by the user's contacts
'common_users'
:
(
contact
for
contact
,
projects
in
contacts_projects
),
'common_projects'
:
sum
((
projects
for
contact
,
projects
in
contacts_projects
),
[]),
# status refreshing params (when active workflows)
'status_refresh_initial_interval'
:
PROJECT_VIEW_REFRESH_INTERVAL
,
'status_refresh_max_attempts'
:
PROJECT_VIEW_MAX_REFRESH_ATTEMPTS
,
},
)
...
...
graph/graph.py
View file @
d9e4716d
...
...
@@ -4,15 +4,16 @@ from gargantext.util.lists import WeightedMatrix, UnweightedList, Transla
from
gargantext.util.http
import
JsonHttpResponse
from
gargantext.models
import
Node
,
Ngram
,
NodeNgram
,
NodeNgramNgram
,
NodeHyperdata
from
graph.cooccurrences
import
countCooccurrences
from
graph.distances
import
clusterByDistances
from
graph.bridgeness
import
filterByBridgeness
from
graph.cooccurrences
import
countCooccurrences
from
graph.distances
import
clusterByDistances
from
graph.bridgeness
import
filterByBridgeness
from
graph.mail_notification
import
notify_owner
from
gargantext.util.scheduling
import
scheduled
from
gargantext.constants
import
graph_constraints
from
gargantext.util.scheduling
import
scheduled
from
gargantext.constants
import
graph_constraints
from
celery
import
shared_task
from
datetime
import
datetime
from
celery
import
shared_task
from
datetime
import
datetime
@
shared_task
...
...
@@ -73,6 +74,10 @@ def compute_graph( corpus_id=None , cooc_id=None
node
.
hyperdata
[
distance
][
bridgeness
]
=
data
node
.
save_hyperdata
()
session
.
commit
()
print
(
"GRAPH #
%
d ... Notify by email owner of the graph."
%
cooc_id
)
corpus
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
corpus_id
)
.
first
()
notify_owner
(
corpus
,
cooc_id
,
distance
,
bridgeness
)
print
(
"GRAPH #
%
d ... Returning data as json."
%
cooc_id
)
return
data
...
...
graph/mail_notification.py
0 → 100644
View file @
d9e4716d
from
gargantext.models.users
import
User
from
gargantext.util.db
import
session
from
django.core.mail
import
send_mail
from
gargantext.settings
import
BASE_URL
def
notify_owner
(
corpus
,
cooc_id
,
distance
,
bridgeness
):
user
=
session
.
query
(
User
)
.
filter
(
User
.
id
==
corpus
.
user_id
)
.
first
()
message
=
'''
Bonjour,
votre graph vient de se terminer dans votre corpus intitulé:
%
s
Vous pouvez accéder et renommer votre Graph à l'adresse:
http://
%
s/projects/
%
d/corpora/
%
d/explorer?cooc_id=
%
d&distance=
%
s&bridgeness=
%
d
Nous restons à votre disposition pour tout complément d'information.
Cordialement
--
L'équipe de Gargantext (CNRS)
'''
%
(
corpus
.
name
,
BASE_URL
,
corpus
.
parent_id
,
corpus
.
id
,
cooc_id
,
distance
,
bridgeness
)
if
user
.
email
!=
""
:
send_mail
(
'[Gargantext] Votre Graph est calculé'
,
message
,
'team@gargantext.org'
,
[
user
.
email
],
fail_silently
=
False
)
else
:
print
(
"User
%
s (
%
d), has no email"
%
(
user
.
username
,
user
.
id
)
)
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