added job status form
This commit is contained in:
parent
f8c3891022
commit
724c8b3f4a
|
@ -30,3 +30,6 @@ class curieForm(FlaskForm):
|
|||
center_z = DecimalField('Center Z',default=0)
|
||||
|
||||
email = StringField('Email', validators=[DataRequired(), Email()])
|
||||
|
||||
class statusForm(FlaskForm):
|
||||
jobID = StringField('Job ID',validators=[DataRequired()])
|
|
@ -35,6 +35,9 @@
|
|||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('dock_upload') }}">Dock and Report</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('status') }}">Job Status</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
{% block main %}
|
||||
<h2>Curie Web Demo</h2>
|
||||
<p>The dock and report demo performs molecular docking using AutoDock Vina and then finds protein-ligand interactions using PLIP</p>
|
||||
<p>Dock and Report performs molecular docking using AutoDock Vina, generates visualisations using PyMOL and then finds protein-ligand interactions using PLIP. It then compiles all of this into a PDF report and emails it to you.</p>
|
||||
<ul>
|
||||
<li><a href="{{ url_for('dock_upload') }}">Dock and Report</a></li>
|
||||
<li><a href="{{ url_for('status')}}">Job Status</a></li>
|
||||
</ul>
|
||||
{% endblock %}
|
|
@ -0,0 +1,10 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% block main %}
|
||||
<h2>Job ID: {{ ID }}</h2>
|
||||
<b>Submitted On: </b>{{subDate}}<br>
|
||||
<b>Target Name: </b>{{pn}}<br>
|
||||
<b>Ligand Name: </b>{{ln}}<br>
|
||||
<b>Description: </b>{{desc}}<br>
|
||||
<b>Status: </b>{{status}}
|
||||
{% endblock %}
|
|
@ -0,0 +1,6 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% block main %}
|
||||
<h2>Job ID: {{ job }}</h2>
|
||||
<p>This Job ID does not exist 😠. If you think this is an error, please contact us.</p>
|
||||
{% endblock %}
|
|
@ -0,0 +1,15 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% block main %}
|
||||
<h2>Get Job Status</h2>
|
||||
<form action="{{ url_for('status') }}" method="post" enctype="multipart/form-data">
|
||||
{% include 'flash_messages.html' %}
|
||||
{{ form.csrf_token }}
|
||||
<div class="form-group">
|
||||
{{ form.jobID.label }}
|
||||
{{ form.jobID(class="form-control") }}
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary">Get Status</button>
|
||||
</form>
|
||||
{% endblock %}
|
32
app/views.py
32
app/views.py
|
@ -12,7 +12,7 @@ from string import digits, ascii_lowercase
|
|||
|
||||
# Note: that when using Flask-WTF we need to import the Form Class that we created
|
||||
# in forms.py
|
||||
from .forms import MyForm, curieForm
|
||||
from .forms import MyForm, curieForm, statusForm
|
||||
|
||||
def gen_word(N, min_N_dig, min_N_low):
|
||||
choose_from = [digits]*min_N_dig + [ascii_lowercase]*min_N_low
|
||||
|
@ -47,6 +47,36 @@ def visualise():
|
|||
"""Render visualisation page."""
|
||||
return render_template('visualise.html')
|
||||
|
||||
@app.route('/Status',methods=['GET','POST'])
|
||||
def status():
|
||||
taskStatusForm = statusForm()
|
||||
|
||||
if request.method == 'POST':
|
||||
if taskStatusForm.validate_on_submit():
|
||||
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'])
|
||||
mycursor = mycon.cursor()
|
||||
sqlQuery = 'select id, protein_name, ligand_name, date, description, done from curieweb where id="%s"' % (jobID)
|
||||
mycursor.execute(sqlQuery)
|
||||
records = mycursor.fetchall()
|
||||
if records == []:
|
||||
return render_template('job_status_error.html',job=jobID)
|
||||
else:
|
||||
r = records[0]
|
||||
protein_name = r[1]
|
||||
ligand_name = r[2]
|
||||
date = r[3]
|
||||
description = r[4]
|
||||
done = r[5]
|
||||
if done==1:
|
||||
done="Completed"
|
||||
elif done==0:
|
||||
done="Queued"
|
||||
return render_template('job_status.html',ID=jobID,pn=protein_name,ln=ligand_name,subDate=date,desc=description,status=done)
|
||||
flash_errors(taskStatusForm)
|
||||
return render_template('job_status_form.html',form=taskStatusForm)
|
||||
|
||||
|
||||
@app.route('/basic-form', methods=['GET', 'POST'])
|
||||
def basic_form():
|
||||
|
|
Loading…
Reference in New Issue