Пример #1
0
    if os.path.exists(path):
        os.remove(path)

form = cgi.FieldStorage()
delete_action = form["delete_action"].value
if form.has_key("run_id"):
    run_id = int(form["run_id"].value)
    my_batch,my_run = RunBatch.LoadRun(run_id)
    if ((delete_action.upper() == "ALL") or (delete_action.upper() == "TEXT")):
        remove_if_exists(RunBatch.RunTextFilePath(my_batch, my_run))

    if (delete_action.upper() == "ALL") or (delete_action.upper() == "OUTPUT"):
        remove_if_exists(RunBatch.RunOutFilePath(my_batch, my_run))

    if (delete_action.upper() == "ALL") or (delete_action.upper() == "DONE"):
        remove_if_exists(RunBatch.RunDoneFilePath(my_batch, my_run))
elif form.has_key("batch_id"):
    batch_id = int(form["batch_id"].value)
    my_batch = RunBatch.LoadBatch(batch_id)
    for my_run in my_batch["runs"]:
        if ((delete_action.upper() == "ALL") or (delete_action.upper() == "TEXT")):
            remove_if_exists(RunBatch.RunTextFilePath(my_batch, my_run))

        if (delete_action.upper() == "ALL") or (delete_action.upper() == "OUTPUT"):
            remove_if_exists(RunBatch.RunOutFilePath(my_batch, my_run))

        if (delete_action.upper() == "ALL") or (delete_action.upper() == "DONE"):
            remove_if_exists(RunBatch.RunDoneFilePath(my_batch, my_run))
    
    
url = "ViewBatch.py?batch_id=%(batch_id)d"%(my_batch)
Пример #2
0
import os

form = cgi.FieldStorage()
batch_id = int(form["batch_id"].value)
my_batch = RunBatch.LoadBatch(batch_id)
status_dir = "%(data_dir)s/status/" % (my_batch)
txt_output_dir = "%(data_dir)s/txt_output/" % (my_batch)
if os.path.exists(status_dir):
    os.chmod(status_dir, 0777)
if os.path.exists(txt_output_dir):
    os.chmod(txt_output_dir, 0777)

for run in my_batch["runs"]:
    for path in [
            RunBatch.RunTextFilePath(my_batch, run),
            RunBatch.RunDoneFilePath(my_batch, run),
            RunBatch.RunOutFilePath(my_batch, run)
    ]:
        if os.path.exists(path):
            os.chmod(path, 0644)

url = "ViewBatch.py?batch_id=%(batch_id)d" % (my_batch)
print "Content-Type: text/html"
print
print "<html><head>"
print "<meta http-equiv='refresh' content='0; URL=%(url)s' />" % (globals())
print "</head>"
print "<body>This page should be redirected to <a href='%(url)s'/>%(url)s</a></body>" % (
    globals())
print "</html>"
Пример #3
0
import os.path

print "Content-Type: text/html"
print

form = cgi.FieldStorage()
batch_id = int(form["batch_id"].value)
my_batch = RunBatch.LoadBatch(batch_id)
jobs_by_state = {}

job_ids = [run["job_id"] for run in my_batch["runs"]]
job_dictionary = RunBatch.GetJobStatus(job_ids)

for run in my_batch["runs"]:
    stat = "Unknown"
    if os.path.isfile(RunBatch.RunDoneFilePath(my_batch, run)):
        stat = "Complete"
    elif run["job_id"] == None:
        pass
    else:
        job_status = job_dictionary[run["job_id"]]
        if job_status and job_status.has_key("STAT"):
            stat = job_status["STAT"]
    run["status"] = stat
    if jobs_by_state.has_key(stat):
        jobs_by_state[stat].append(run)
    else:
        jobs_by_state[stat] = [run]

if form.has_key("submit_run"):
    print "<html><head><title>Batch # %d resubmitted</title>" % (batch_id)
Пример #4
0
import os.path

print "Content-Type: text/html"
print

form = cgi.FieldStorage()
batch_id = int(form["batch_id"].value)
my_batch = RunBatch.LoadBatch(batch_id)
jobs_by_state = {}

job_ids = [run["job_id"] for run in my_batch["runs"]]
job_dictionary = RunBatch.GetJobStatus(job_ids)

for run in my_batch["runs"]:
    stat = "Unknown"
    if os.path.isfile(RunBatch.RunDoneFilePath(my_batch, run)):
        try:
            fd = open(RunBatch.RunDoneFilePath(my_batch, run), "r")
            stat = fd.readline().strip()
            if stat.startswith("Done"):
                stat = "Complete"
            fd.close()
        except:
            stat = "Unknown"
    elif run["job_id"] == None:
        pass
    else:
        job_status = job_dictionary[run["job_id"]]
        if job_status and job_status.has_key("STAT"):
            stat = job_status["STAT"]
    run["status"] = stat