Commit d9e4716d authored by Romain Loth's avatar Romain Loth

Merge branch 'testing' into romain-testing

parents 3f2b219d 4af0bade
...@@ -40,7 +40,7 @@ CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml'] ...@@ -40,7 +40,7 @@ CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml']
CELERY_IMPORTS = ( CELERY_IMPORTS = (
"gargantext.util.toolchain", "gargantext.util.toolchain",
"gargantext.util.crawlers", "gargantext.util.crawlers",
"graph.cooccurrences", "graph.graph",
"moissonneurs.pubmed", "moissonneurs.pubmed",
"moissonneurs.istex", "moissonneurs.istex",
) )
......
...@@ -10,7 +10,7 @@ for resource in RESOURCETYPES: ...@@ -10,7 +10,7 @@ for resource in RESOURCETYPES:
try: try:
name =resource["crawler"] name =resource["crawler"]
#crawler is type basename+"Crawler" #crawler is type basename+"Crawler"
filename = name.replace("Crawler", "").lower() filename = name.replace("Crawler", "").upper()
module = base_parser+".%s" %(filename) module = base_parser+".%s" %(filename)
importlib.import_module(module) importlib.import_module(module)
......
...@@ -54,6 +54,9 @@ def overview(request): ...@@ -54,6 +54,9 @@ def overview(request):
# projects owned by the user's contacts # projects owned by the user's contacts
'common_users': (contact for contact, projects in contacts_projects), 'common_users': (contact for contact, projects in contacts_projects),
'common_projects': sum((projects 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,
}, },
) )
......
...@@ -7,6 +7,7 @@ from gargantext.models import Node, Ngram, NodeNgram, NodeNgramNgram, ...@@ -7,6 +7,7 @@ from gargantext.models import Node, Ngram, NodeNgram, NodeNgramNgram,
from graph.cooccurrences import countCooccurrences from graph.cooccurrences import countCooccurrences
from graph.distances import clusterByDistances from graph.distances import clusterByDistances
from graph.bridgeness import filterByBridgeness from graph.bridgeness import filterByBridgeness
from graph.mail_notification import notify_owner
from gargantext.util.scheduling import scheduled from gargantext.util.scheduling import scheduled
from gargantext.constants import graph_constraints from gargantext.constants import graph_constraints
...@@ -74,6 +75,10 @@ def compute_graph( corpus_id=None , cooc_id=None ...@@ -74,6 +75,10 @@ def compute_graph( corpus_id=None , cooc_id=None
node.save_hyperdata() node.save_hyperdata()
session.commit() 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) print("GRAPH #%d ... Returning data as json." % cooc_id)
return data return data
......
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) )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment