Commit 7fe1e4fe authored by delanoe's avatar delanoe

[FIX] Scraper Pubmed ok en asynchrone. Istex: KO

parent d5e31196
...@@ -117,9 +117,6 @@ def save(request , project_id): ...@@ -117,9 +117,6 @@ def save(request , project_id):
) )
session.add(corpus)
session.commit()
corpus_id = corpus.id
print("NEW CORPUS", corpus_id) print("NEW CORPUS", corpus_id)
tasks = Scraper() tasks = Scraper()
...@@ -137,13 +134,15 @@ def save(request , project_id): ...@@ -137,13 +134,15 @@ def save(request , project_id):
if filename!=False: if filename!=False:
# add the uploaded resource to the corpus # add the uploaded resource to the corpus
corpus.add_resource( corpus.add_resource(
type = 8 # cf. constants.RESOURCETYPES type = int(8) # cf. constants.RESOURCETYPES
, path = filename , path = filename
) )
dwnldsOK+=1 dwnldsOK+=1
session.add(corpus)
session.commit() session.commit()
corpus_id = corpus.id
if dwnldsOK == 0 : if dwnldsOK == 0 :
return JsonHttpResponse(["fail"]) return JsonHttpResponse(["fail"])
########################### ###########################
......
...@@ -111,9 +111,6 @@ def save( request , project_id ) : ...@@ -111,9 +111,6 @@ def save( request , project_id ) :
, typename = "CORPUS" , typename = "CORPUS"
) )
session.add(corpus)
session.commit()
corpus_id = corpus.id
# """ # """
# urlreqs: List of urls to query. # urlreqs: List of urls to query.
# - Then, to each url in urlreqs you do: # - Then, to each url in urlreqs you do:
...@@ -137,16 +134,21 @@ def save( request , project_id ) : ...@@ -137,16 +134,21 @@ def save( request , project_id ) :
print(filename) print(filename)
if filename != False: if filename != False:
# add the uploaded resource to the corpus # add the uploaded resource to the corpus
corpus.add_resource( corpus.add_resource( type = int(3)
type = 3
, path = filename , path = filename
, url = None
) )
print("Adding the resource")
dwnldsOK+=1 dwnldsOK+=1
#session.commit()
session.add(corpus)
session.commit()
corpus_id = corpus.id
if dwnldsOK == 0 : if dwnldsOK == 0 :
return JsonHttpResponse(["fail"]) return JsonHttpResponse(["fail"])
try: try:
scheduled(parse_extract_indexhyperdata(corpus_id)) scheduled(parse_extract_indexhyperdata)(corpus_id)
except Exception as error: except Exception as error:
print('WORKFLOW ERROR') print('WORKFLOW ERROR')
print(error) print(error)
......
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