Пример #1
0
                         title='Delete all files for this batch' 
                         onclick='return confirm("Do you really want to delete all files for this batch?")'/>
    </form>
    </div>""" % (my_batch)
    print "</div></th>"
    print "</tr></thead>"
    print "<tbody>"
    for run in my_batch["runs"]:
        x = my_batch.copy()
        x.update(run)
        x["text_file"] = RunBatch.RunTextFile(run)
        x["text_path"] = RunBatch.RunTextFilePath(my_batch, run)
        x["done_file"] = RunBatch.RunDoneFile(run)
        x["done_path"] = RunBatch.RunDoneFilePath(my_batch, run)
        x["out_file"] = RunBatch.RunOutFile(run)
        x["out_path"] = RunBatch.RunOutFilePath(my_batch, run)
        print "<tr>"
        print "<td>%(start)d</td><td>%(end)d</td><td>%(job_id)s</td>" % (x)
        if run["status"] == "Complete":
            cpu = RunBatch.GetCPUTime(my_batch, run)
            print "<td style='color:green'>"
            if cpu:
                print "Complete (%.2f sec)" % (cpu)
            else:
                print "Complete"
            stat = "Complete"
            print "</td>"
        else:
            print """
<td style='color:red'>%s<br/>
    <form action='ViewBatch.py' method='POST' target='ResubmitWindow'>
Пример #2
0
import os.path

def remove_if_exists(path):
    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))
Пример #3
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>"