stores a local copy in the reports folder

This commit is contained in:
Navan Chauhan 2020-08-30 16:45:47 +05:30
parent e64830992d
commit 4815cbde39
4 changed files with 32 additions and 4 deletions

View File

@ -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"))

View File

@ -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))

View File

@ -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{

View File

@ -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)