Пример #1
0
form = cgi.FieldStorage()
if form.has_key("job_id"):
    import subprocess
    job_id = int(form["job_id"].value)
    run = {"job_id":job_id}
    RunBatch.KillOne(run)
    print"""
    <html><head><title>Job %(job_id)d killed</title></head>
    <body>Job %(job_id)d killed
    </body>
    </html>
"""%(globals())
elif form.has_key("batch_id"):
    batch_id = int(form["batch_id"].value)
    RunBatch.KillBatch(batch_id)
    
    url = "ViewBatch.py?batch_id=%d"%(batch_id)
    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>"
else:
    print """<html><head><title>Kill jobs</title></head>
    <body>
    <h1>Kill jobs started by the imageweb webserver</h1>
    <form action='KillJobs.py' method='POST'>
    Job ID:<input type='text' name='job_id' />
    <input type='submit' value='Kill'/>
    </form>