From 4815cbde39d6b18d482c33fa22816ecc8e755d37 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Sun, 30 Aug 2020 16:45:47 +0530 Subject: stores a local copy in the reports folder --- app/dock-single.py | 4 +++- app/dock_docker.py | 4 +++- app/templates/job_status.html | 19 +++++++++++++++++++ app/views.py | 9 +++++++-- 4 files changed, 32 insertions(+), 4 deletions(-) (limited to 'app') 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 @@ Description: {{desc}}
Status: {{status}} +{% if status == 'Completed' %} + + + +

A detailed zip file containing this PDF, along with all supporting files (configuration, pictures, protein-ligands e.t.c) to your email.

+

PDF Report

+
+ +
+ +{% endif %} +