Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
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": []})
Ejemplo n.º 4
0
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": []})
Ejemplo n.º 5
0
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": []})
Ejemplo n.º 6
0
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)
Ejemplo n.º 7
0
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": []})
Ejemplo n.º 8
0
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)
Ejemplo n.º 9
0
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)
Ejemplo n.º 10
0
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)
Ejemplo n.º 11
0
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"
Ejemplo n.º 12
0
 def act_jobstatus(self):
     if self.jobid and routines.checkresult(self.jobid):
         return routines.getjobstatus(self.jobid)
     return {"data": []}
Ejemplo n.º 13
0
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)