aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2020-08-30 16:45:47 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2020-08-30 16:45:47 +0530
commit4815cbde39d6b18d482c33fa22816ecc8e755d37 (patch)
tree777bb20f423d602cfbcaa45435db5754305f3014 /app
parente64830992db27939840bc68364de3f47441c154f (diff)
stores a local copy in the reports folder
Diffstat (limited to 'app')
-rw-r--r--app/dock-single.py4
-rw-r--r--app/dock_docker.py4
-rw-r--r--app/templates/job_status.html19
-rw-r--r--app/views.py9
4 files changed, 32 insertions, 4 deletions
diff --git a/app/dock-single.py b/app/dock-single.py
index be623f7..af6c4c4 100644
--- a/app/dock-single.py
+++ b/app/dock-single.py
@@ -202,11 +202,12 @@ date = records[6]
import os
cd = os.getcwd()
f = os.path.join(cd,"static/uploads")
+reportDirectory = os.path.join(f,"reports")
#t = os.path.join(f,"receptor",target)
#r = os.path.join(f,"ligands",ligand)
#c = os.path.join(f,"configs",config)
import tempfile
-from shutil import make_archive
+from shutil import make_archive, copyfile
import time
with tempfile.TemporaryDirectory() as directory:
@@ -228,6 +229,7 @@ with tempfile.TemporaryDirectory() as directory:
z = "Curie_Web_Result_"+str(jobID)
zi = os.path.join(f,z)
make_archive(zi, 'zip', directory)
+ copyfile("report.pdf",os.path.join(reportDirectory,(str(jobID)+".pdf")))
#copy(("Curie_Web_Result_"+str(jobID)),f)
email(zi)
#print((str(zi) + ".zip"))
diff --git a/app/dock_docker.py b/app/dock_docker.py
index 34cb809..1c60a3b 100644
--- a/app/dock_docker.py
+++ b/app/dock_docker.py
@@ -67,12 +67,13 @@ if r[9] is not None:
import os
cd = os.getcwd()
f = os.path.join(cd,"static/uploads")
+reportDirectory = os.path.join(f,"reports")
#t = os.path.join(f,"receptor",target)
#r = os.path.join(f,"ligands",ligand)
#c = os.path.join(f,"configs",config)
print(f)
import tempfile
-from shutil import make_archive
+from shutil import make_archive, copyfile
with tempfile.TemporaryDirectory() as directory:
print('The created temporary directory is %s' % directory)
@@ -92,6 +93,7 @@ with tempfile.TemporaryDirectory() as directory:
zi = os.path.join(f,z)
make_archive(zi, 'zip', directory)
#copy(("Curie_Web_Result_"+str(jobID)),f)
+ copyfile("report.pdf",os.path.join(reportDirectory,(str(jobID)+".pdf")))
email(zi)
#print((str(zi) + ".zip"))
mycursor.execute('UPDATE curieweb set done=1 where id="%s"' % (jobID))
diff --git a/app/templates/job_status.html b/app/templates/job_status.html
index 896d49a..89d2d55 100644
--- a/app/templates/job_status.html
+++ b/app/templates/job_status.html
@@ -8,6 +8,25 @@
<b>Description: </b>{{desc}}<br>
<b>Status: </b>{{status}}
+{% if status == 'Completed' %}
+
+ <style>
+ iframe {
+ width: 100%;
+ height: 550px;
+ border: none;
+ overflow: hidden;
+ }
+ </style>
+
+ <p>A detailed zip file containing this PDF, along with all supporting files (configuration, pictures, protein-ligands e.t.c) to your email.</p>
+ <h3>PDF Report</h3>
+ <section>
+ <iframe src={{PDFReport}} id="report"></iframe>
+ </section>
+
+{% endif %}
+
<section>
<style>
#growth{
diff --git a/app/views.py b/app/views.py
index b1aa800..2266f40 100644
--- a/app/views.py
+++ b/app/views.py
@@ -85,7 +85,7 @@ def status():
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)
+ sqlQuery = 'select id, protein_name, ligand_name, date, description, done, pdb from curieweb where id="%s"' % (jobID)
mycursor.execute(sqlQuery)
records = mycursor.fetchall()
if records == []:
@@ -100,7 +100,12 @@ def status():
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)
+ if protein_name == None:
+ protein_name = r[6]
+
+ PDFReport = "/static/uploads/reports/" + str(jobID) + ".pdf"
+
+ return render_template('job_status.html',ID=jobID,pn=protein_name,ln=ligand_name,subDate=date,desc=description,status=done,PDFReport=PDFReport)
flash_errors(taskStatusForm)
return render_template('job_status_form.html',form=taskStatusForm)