added failed to connect to db error
This commit is contained in:
parent
d102cf38a1
commit
92b2da20a1
|
@ -7,6 +7,7 @@ OD03 = Failed to write the converted PDBQT file
|
||||||
PL02 = Failed to import PLIP, please ensure that you have correctly installed PLIP
|
PL02 = Failed to import PLIP, please ensure that you have correctly installed PLIP
|
||||||
PL01 = Failed to fetch the PDB, please check the PDB Code
|
PL01 = Failed to fetch the PDB, please check the PDB Code
|
||||||
|
|
||||||
|
DB00 = Failed to connect to the database.
|
||||||
DB01 = This Job ID does not exist 😠. If you think this is an error, please contact us.
|
DB01 = This Job ID does not exist 😠. If you think this is an error, please contact us.
|
||||||
|
|
||||||
CW01 = Looks like an invalid PDB ID
|
CW01 = Looks like an invalid PDB ID
|
||||||
|
|
28
app/views.py
28
app/views.py
|
@ -14,6 +14,9 @@ from datetime import datetime,date
|
||||||
import json
|
import json
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
import mysql.connector as con
|
||||||
|
from mysql.connector.errors import InterfaceError
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
@ -123,9 +126,12 @@ def status():
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
if taskStatusForm.validate_on_submit():
|
if taskStatusForm.validate_on_submit():
|
||||||
jobID = taskStatusForm.jobID.data
|
jobID = taskStatusForm.jobID.data
|
||||||
import mysql.connector as con
|
|
||||||
mycon = con.connect(host=app.config['DB_HOST'],user=app.config['DB_USER'],password=app.config['DB_PASSWORD'],port=app.config['DB_PORT'],database=app.config['DB_NAME'])
|
try:
|
||||||
mycursor = mycon.cursor()
|
mycon = con.connect(host=app.config['DB_HOST'],user=app.config['DB_USER'],password=app.config['DB_PASSWORD'],port=app.config['DB_PORT'],database=app.config['DB_NAME'])
|
||||||
|
mycursor = mycon.cursor()
|
||||||
|
except InterfaceError:
|
||||||
|
return render_template('error.html',code="DB00",description=errors['DB00'])
|
||||||
sqlQuery = 'select id, protein_name, ligand_name, date, description, done, pdb from curieweb where id="%s"' % (jobID)
|
sqlQuery = 'select id, protein_name, ligand_name, date, description, done, pdb from curieweb where id="%s"' % (jobID)
|
||||||
mycursor.execute(sqlQuery)
|
mycursor.execute(sqlQuery)
|
||||||
records = mycursor.fetchall()
|
records = mycursor.fetchall()
|
||||||
|
@ -286,9 +292,11 @@ def dock_manual():
|
||||||
sx,sy,sz = str(form.size_x.data), str(form.size_y.data), str(form.size_z.data)
|
sx,sy,sz = str(form.size_x.data), str(form.size_y.data), str(form.size_z.data)
|
||||||
email = form.email.data
|
email = form.email.data
|
||||||
|
|
||||||
import mysql.connector as con
|
try:
|
||||||
mycon = con.connect(host=app.config['DB_HOST'],user=app.config['DB_USER'],password=app.config['DB_PASSWORD'],port=app.config['DB_PORT'],database=app.config['DB_NAME'])
|
mycon = con.connect(host=app.config['DB_HOST'],user=app.config['DB_USER'],password=app.config['DB_PASSWORD'],port=app.config['DB_PORT'],database=app.config['DB_NAME'])
|
||||||
mycursor = mycon.cursor()
|
mycursor = mycon.cursor()
|
||||||
|
except InterfaceError:
|
||||||
|
return render_template("error.html",code="DB00",description=errors['DB00'])
|
||||||
|
|
||||||
import tempfile
|
import tempfile
|
||||||
with tempfile.TemporaryDirectory() as directory:
|
with tempfile.TemporaryDirectory() as directory:
|
||||||
|
@ -334,9 +342,11 @@ def dock_automatic():
|
||||||
if len(pdb) != 4:
|
if len(pdb) != 4:
|
||||||
return render_template("error.html",code="CW01",description=errors['CW01'])
|
return render_template("error.html",code="CW01",description=errors['CW01'])
|
||||||
|
|
||||||
import mysql.connector as con
|
try:
|
||||||
mycon = con.connect(host=app.config['DB_HOST'],user=app.config['DB_USER'],password=app.config['DB_PASSWORD'],port=app.config['DB_PORT'],database=app.config['DB_NAME'])
|
mycon = con.connect(host=app.config['DB_HOST'],user=app.config['DB_USER'],password=app.config['DB_PASSWORD'],port=app.config['DB_PORT'],database=app.config['DB_NAME'])
|
||||||
mycursor = mycon.cursor()
|
mycursor = mycon.cursor()
|
||||||
|
except InterfaceError:
|
||||||
|
return render_template('error.html',code="DB00",description=errors['DB00'])
|
||||||
|
|
||||||
sqlQuery = "insert into curieweb (id, email, pdb, ligand_smile, ligand_name, date, description) values (%s,%s,%s,%s,%s,CURDATE(),%s) "
|
sqlQuery = "insert into curieweb (id, email, pdb, ligand_smile, ligand_name, date, description) values (%s,%s,%s,%s,%s,CURDATE(),%s) "
|
||||||
jobID = gen_word(16, 1, 1)
|
jobID = gen_word(16, 1, 1)
|
||||||
|
|
Loading…
Reference in New Issue