Commit 86bf928f authored by delanoe's avatar delanoe

[FIX] sessions + default nb of documents for scrapping.

parent c331b01a
...@@ -47,13 +47,15 @@ def apply_workflow(corpus_id): ...@@ -47,13 +47,15 @@ def apply_workflow(corpus_id):
print("End of the Workflow for corpus %d" % (corpus_id)) print("End of the Workflow for corpus %d" % (corpus_id))
update_state.processing_(int(corpus_id), "0") update_state.processing_(int(corpus_id), "0")
mysession.close() #mysession.close()
get_session.remove() #get_session.remove()
mysession.remove()
except Exception as error: except Exception as error:
print(error) print(error)
PrintException() PrintException()
mysession.close() #mysession.close()
get_session.remove() #get_session.remove()
mysession.remove()
@shared_task @shared_task
def empty_trash(corpus_id): def empty_trash(corpus_id):
......
...@@ -131,24 +131,24 @@ def literalquery(statement, dialect=None): ...@@ -131,24 +131,24 @@ def literalquery(statement, dialect=None):
return LiteralCompiler(dialect, statement) return LiteralCompiler(dialect, statement)
#
def get_sessionmaker(): def get_sessionmaker():
from sqlalchemy.orm import sessionmaker from sqlalchemy.orm import sessionmaker
return sessionmaker(bind=engine) return sessionmaker(bind=engine)
#def get_session(): def get_session():
# session_factory = get_sessionmaker() session_factory = get_sessionmaker()
# return scoped_session(session_factory) return scoped_session(session_factory)
# get_session à importer, plus pratique pour les remove # get_session à importer, plus pratique pour les remove
session_factory = get_sessionmaker() #session_factory = get_sessionmaker()
get_session = scoped_session(session_factory) #get_session = scoped_session(session_factory)
# the global session ------------ # the global session ------------
# pour les modules qui importent # pour les modules qui importent
# directement session # directement session
session = get_session() session = get_session()()
# ------------------------------- # -------------------------------
......
...@@ -46,7 +46,8 @@ def getGlobalStats(request ): ...@@ -46,7 +46,8 @@ def getGlobalStats(request ):
alist = ["bar","foo"] alist = ["bar","foo"]
if request.method == "POST": if request.method == "POST":
N = 1000 #N = 1000
N = 300
query = request.POST["query"] query = request.POST["query"]
print ("LOG::TIME:_ "+datetime.datetime.now().isoformat()+" query =", query ) print ("LOG::TIME:_ "+datetime.datetime.now().isoformat()+" query =", query )
print ("LOG::TIME:_ "+datetime.datetime.now().isoformat()+" N =", N ) print ("LOG::TIME:_ "+datetime.datetime.now().isoformat()+" N =", N )
......
...@@ -299,7 +299,7 @@ ...@@ -299,7 +299,7 @@
var origQuery = $("#id_name").val() var origQuery = $("#id_name").val()
console.log("printing the results:") console.log("printing the results:")
console.log(origQuery) console.log(origQuery)
testISTEX(origQuery.replace(" ","+"),1000) testISTEX(origQuery.replace(" ","+"),300)
} }
} }
else { else {
...@@ -349,7 +349,7 @@ ...@@ -349,7 +349,7 @@
console.log("enabling "+"#"+value.id) console.log("enabling "+"#"+value.id)
$("#"+value.id).attr('onclick','getGlobalResults(this);'); $("#"+value.id).attr('onclick','getGlobalResults(this);');
// $("#submit_thing").prop('disabled' , false) // $("#submit_thing").prop('disabled' , false)
$("#submit_thing").html("Process a 1000 sample!") $("#submit_thing").html("Process a 300 sample!")
thequeries = data thequeries = data
var N=0,k=0; var N=0,k=0;
...@@ -388,7 +388,7 @@ ...@@ -388,7 +388,7 @@
console.log("enabling "+"#"+value.id) console.log("enabling "+"#"+value.id)
$("#"+value.id).attr('onclick','getGlobalResults(this);'); $("#"+value.id).attr('onclick','getGlobalResults(this);');
// $("#submit_thing").prop('disabled' , false) // $("#submit_thing").prop('disabled' , false)
$("#submit_thing").html("Process a 1000 sample!") $("#submit_thing").html("Process a 300 sample!")
thequeries = data thequeries = data
var N=data.length,k=0; var N=data.length,k=0;
......
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