def getxlfile(jobid): if jobid and routines.checkresult(jobid): tpath = os.path.join(app.config["RESULTS_FOLDER"], jobid, "tables") xlfile = routines.makexltable(tpath) if xlfile: return send_from_directory(tpath, xlfile) return abort(404)
def getresultfile(self, fname): rf = os.path.join(self.rd, "tables", fname) if self.jobid and routines.checkresult( self.jobid) and os.path.exists(rf): return rf else: return False
def summarytab(jobid): rd = os.path.join(app.config["RESULTS_FOLDER"], jobid) if jobid and routines.checkresult(jobid) and os.path.exists( os.path.join(rd, "arts-query.log")): st = routines.formatsumtab(jobid) return jsonify(st) return jsonify({"data": []})
def bgctable(jobid): rd = os.path.join(app.config['RESULTS_FOLDER'], jobid) if jobid and routines.checkresult(jobid) and os.path.exists( os.path.join(rd, "resultsummary.json")): return jsonify(routines.getbgctable(rd)) else: return jsonify({"data": []})
def krtab(jobid): rd = os.path.join(app.config['RESULTS_FOLDER'], jobid) if jobid and routines.checkresult(jobid) and os.path.exists( os.path.join(rd, "knownhits.json")): return send_from_directory(rd, "knownhits.json") else: return jsonify({"data": []})
def getarchive(jobfile): jobid = os.path.splitext(jobfile)[0] rd = os.path.join(app.config["RESULTS_FOLDER"], jobid) ad = os.path.join(app.config.get("ARCHIVE_FOLDER", "/tmp")) if os.path.exists(os.path.join(ad, jobfile)): return send_from_directory(ad, jobfile) elif jobid and routines.checkresult(jobid): shutil.make_archive(os.path.join(ad, str(jobid)), "zip", rd) return send_from_directory(ad, jobfile) return abort(404)
def jobstatus(jobid): if jobid and routines.checkresult(jobid): #rd = os.path.join(app.config["RESULTS_FOLDER"],jobid) # statuscache = os.path.join(rd,"jobstatus.json") # if not os.path.exists(statuscache) or os.path.getmtime(statuscache) < os.path.getmtime(os.path.join(rd,"arts-query.log")): status = routines.getjobstatus(jobid) return jsonify(status) # else: # return send_from_directory(rd,"jobstatus.json") return jsonify({"data": []})
def showresult(jobid): if jobid and routines.checkresult(jobid): resp = make_response(render_template("showresult.html", resid=jobid)) lastresult = request.cookies.get('arts.lastresult') if lastresult and jobid not in lastresult: lastresult += ";%s" % jobid elif not lastresult: lastresult = jobid resp.set_cookie('arts.lastresult', lastresult) return resp return abort(404)
def showresult(jobid): if jobid and routines.checkresult(jobid): # resp = make_response(render_template("showresult.html",resid=jobid)) # saverun = request.form.get('saverun',False) # if saverun and saverun.lower() != "false": # lastresult = request.cookies.get('arts.lastresult') # if lastresult and jobid not in lastresult: # lastresult += ";%s"%jobid # elif not lastresult: # lastresult = jobid # resp.set_cookie('arts.lastresult',lastresult) # return resp return render_template("showresult.html", jobid=jobid) return abort(404)
def exportfile(jobid, expfil): rd = os.path.join(app.config["RESULTS_FOLDER"], jobid) if jobid and routines.checkresult(jobid) and os.path.exists( os.path.join(rd, expfil)): return send_from_directory(rd, expfil) return abort(404)
def joblog(jobid): rd = os.path.join(app.config["RESULTS_FOLDER"], jobid) if jobid and routines.checkresult(jobid) and os.path.exists( os.path.join(rd, "arts-query.log")): return send_from_directory(rd, "arts-query.log", mimetype="text/plain") return "No log found"
def act_jobstatus(self): if self.jobid and routines.checkresult(self.jobid): return routines.getjobstatus(self.jobid) return {"data": []}
def joblog(jobid): if jobid and routines.checkresult(jobid): rd = os.path.join(app.config["RESULTS_FOLDER"], jobid) return send_from_directory(rd, "arts-query.log", mimetype="text/plain") return abort(404)