Commit 03521f08 authored by Davide Lagoa's avatar Davide Lagoa
Browse files

neo4j connection fixed

parent af61c3a0
......@@ -10,5 +10,8 @@ EXPOSE 80
RUN pip install --upgrade pip
RUN pip install neo4j
RUN pip install requests
RUN pip install Flask
RUN pip install flask-restful
CMD ["python", "/home/workersManager.py"]
......@@ -252,7 +252,7 @@ def display_msg(submissionID, isRest):
elif "500" in files:
code = 500
if isRest or code is not 200:
if isRest or code != 200:
return jsonify(
{"result": result,
"message": message}), code
......@@ -363,12 +363,17 @@ def getWorkersLogs(savePath):
@app.route('/reactions/<reactionId>')
def reactions(reactionId):
url = CONFIGURATIONS["database"]
user = CONFIGURATIONS["dbusername"]
password = CONFIGURATIONS["dbpassword"]
pattern = re.compile("^T[A-Z]\d{7}")
patternFound = bool(pattern.match(reactionId))
if patternFound:
results_dict = result_parser(reactionId)
results_dict = get_reaction_data(reactionId, url, user, password)
if results_dict:
return render_template("record.html", subId=reactionId, dictt=results_dict), 200
......@@ -380,37 +385,6 @@ def enumerate_items(*args, **kwargs):
return enumerate(*args, **kwargs)
def result_parser(id):
url = CONFIGURATIONS["database"]
user = CONFIGURATIONS["dbusername"]
password = CONFIGURATIONS["dbpassword"]
databases, tc_systems, reactionID, metaID, reaction, metabolites = get_reaction_data(id, url, user, password)
if not metabolites:
return None
tc_systems2 = {}
for tc in tc_systems:
tc_elements = tc.split('@')
if tc_elements[0] in tc_systems2:
tc_systems2[tc_elements[0]].append(tc_elements[1])
else:
tc_systems2[tc_elements[0]] = [tc_elements[1]]
res_dict = {'databases': databases,
'tc_systems': tc_systems2,
'reactionID': reactionID,
'metaID': metaID,
'reaction': reaction,
'metabolites': metabolites}
return res_dict
def countEntriesBelow(l, id):
id = int(id)
res = 0
......
......@@ -90,7 +90,7 @@ def run():
logger.info(str(workerID) + starter)
res = requests.post(workerID + starter, files = files) # request worker docker to run
if res.status_code is not 102:
if res.status_code != 102:
logger.error("An error occurred while starting the worker!")
mapping = checkSubmissionsStatus(mapping)
......
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