Пример #1
0
def do_run_id(run_id):
    my_run = RunBatch.BPRunBase.select(run_id)
    my_batch = RunBatch.BPBatch()
    my_batch.select(my_run.batch_id)
    file_type = BATCHPROFILER_VARIABLES[FILE_TYPE]
    if file_type == FT_TEXT_FILE:
        show_file(RunBatch.run_text_file_path(my_batch, my_run))
    elif file_type == FT_ERR_FILE:
        show_file(RunBatch.run_err_file_path(my_batch, my_run))
    elif file_type == FT_OUT_FILE:
        download_attachment(
            RunBatch.run_out_file(my_batch, my_run),
            RunBatch.run_out_file_path(my_batch, my_run))
    else:
        show_help("Unknown file type: %s" % file_type)
Пример #2
0
def do_it(batch_array_id, task_id):
    batch_array = RunBatch.BPBatchArray.select(batch_array_id)
    bat = RunBatch.BPBatchArrayTask.select_by_batch_array_and_task_id(
        batch_array, task_id)
    if bat is None:
        show_help()
        return
    run = bat.run
    my_batch = run.batch
    file_type = BATCHPROFILER_VARIABLES[FILE_TYPE]
    if file_type == FT_TEXT_FILE:
        show_file(RunBatch.batch_array_task_text_file_path(bat))
    elif file_type == FT_ERR_FILE:
        show_file(RunBatch.batch_array_task_err_file_path(bat))
    elif file_type == FT_OUT_FILE:
        download_attachment(RunBatch.run_out_file(my_batch, my_run),
                            RunBatch.run_out_file_path(my_batch, my_run))
    else:
        show_help("Unknown file type: %s" % file_type)
Пример #3
0
def do_it(batch_array_id, task_id):
    batch_array = RunBatch.BPBatchArray.select(batch_array_id)
    bat = RunBatch.BPBatchArrayTask.select_by_batch_array_and_task_id(
        batch_array, task_id)
    if bat is None:
        show_help()
        return
    run = bat.run
    my_batch = run.batch
    file_type = BATCHPROFILER_VARIABLES[FILE_TYPE]
    if file_type == FT_TEXT_FILE:
        show_file(RunBatch.batch_array_task_text_file_path(bat))
    elif file_type == FT_ERR_FILE:
        show_file(RunBatch.batch_array_task_err_file_path(bat))
    elif file_type == FT_OUT_FILE:
        download_attachment(
            RunBatch.run_out_file(my_batch, my_run),
            RunBatch.run_out_file_path(my_batch, my_run))
    else:
        show_help("Unknown file type: %s" % file_type)
Пример #4
0
 def build_job_table_body(self):
     with self.tag("tbody"):
         for task_status in self.tasks:
             assert isinstance(task_status, RunBatch.BPJobTaskStatus)
             task = task_status.job_task
             status = task_status.status
             assert isinstance(task, RunBatch.BPJobTask)
             run = task.batch_array_task.run
             assert isinstance(run, RunBatch.BPRun)
             job = task.job
             assert isinstance(job, RunBatch.BPJob)
             out_file = RunBatch.run_out_file(self.my_batch, run)
             out_path = RunBatch.run_out_file_path(self.my_batch, run)
             with self.tag("tr"):
                 with self.tag("td"):
                     self.text(str(run.bstart))
                 with self.tag("td"):
                     self.text(str(run.bend))
                 with self.tag("td"):
                     self.text(str(job.job_id))
                 with self.tag("td"):
                     self.text(str(task.batch_array_task.task_id))
                 if status == RunBatch.JS_DONE:
                     with self.tag("td"):
                         cpu = task_status.created - job.created
                         self.text("Complete (%.2f sec)" %
                                   (cpu.total_seconds()))
                 else:
                     with self.tag("td", style='color:red'):
                         with self.tag("div"):
                             self.text(status.lower().capitalize())
                         with self.tag("div"):
                             with self.tag("form",
                                           action="ViewBatch.py",
                                           method="POST",
                                           target="ResubmitWindow"):
                                 self.doc.input(type="hidden",
                                                name=BATCH_ID)
                                 self.doc.input(type="hidden",
                                                name=RUN_ID,
                                                value=str(run.run_id))
                                 self.doc.input(type="hidden",
                                                name=SUBMIT_RUN,
                                                value=RunBatch.JS_ONE)
                                 self.doc.stag("input",
                                               type='submit',
                                               name="Resubmit_Button",
                                               value=RESUBMIT)
                 self.build_text_file_table_cell(task)
                 if self.my_batch.wants_measurements_file:
                     with self.tag("td"):
                         if os.path.isfile(out_path):
                             with self.tag(
                                     "a",
                                     href='ViewTextFile.py?run_id=%d&%s=%s'
                                     % (run.run_id, FILE_TYPE, FT_OUT_FILE),
                                     title=out_path):
                                 self.text(out_file)
                         else:
                             with self.tag(
                                     "span",
                                     title='Output file not available'):
                                 self.text(out_file)
                 #
                 # This cell contains the form that deletes things
                 #
                 with self.tag("td"):
                     with self.tag("form",
                                   action='DeleteFile.py',
                                   method='POST'):
                         self.doc.input(type="hidden",
                                        name=RUN_ID,
                                        value=str(run.run_id))
                         text_file = os.path.basename(
                             RunBatch.batch_array_task_text_file_path(
                                 task.batch_array_task))
                         for action, filename in (
                             (A_DELETE_TEXT, text_file),
                             (A_DELETE_OUTPUT,
                              RunBatch.run_out_file(self.my_batch, run)),
                             (A_DELETE_ALL, "all files for this run")):
                             self.doc.stag(
                                 "input",
                                 type="submit",
                                 name=K_DELETE_ACTION,
                                 value=action,
                                 title='Delete file %s' % filename,
                                 onclick='return confirm("Do you really want'
                                 'to delete %s?")' % filename)
Пример #5
0
 def build_job_table_body(self):
     with self.tag("tbody"):
         for run, job, status in self.jobs:
             assert isinstance(run, RunBatch.BPRun)
             assert isinstance(job, RunBatch.BPJob)
             out_file = RunBatch.run_out_file(self.my_batch, run)
             out_path = RunBatch.run_out_file_path(self.my_batch, run)
             with self.tag("tr"):
                 with self.tag("td"):
                     self.text(str(run.bstart))
                 with self.tag("td"):
                     self.text(str(run.bend))
                 with self.tag("td"):
                     self.text(str(job.job_id))
                 if status == RunBatch.JS_DONE:
                     with self.tag("td"):
                         cpu = RunBatch.GetCPUTime(self.my_batch, run)
                         self.text("Complete (%.2f sec)"%(cpu))
                 else:
                     with self.tag("td", style='color:red'):
                         with self.tag("div"):
                             self.text(status.lower().capitalize())
                         with self.tag("div"):
                             with self.tag("form",
                                           action="ViewBatch.py",
                                           method="POST",
                                           target="ResubmitWindow"):
                                 self.doc.input(
                                     type="hidden", name=BATCH_ID)
                                 self.doc.input(
                                     type="hidden",
                                     name=RUN_ID,
                                     value=str(run.run_id))
                                 self.doc.stag(
                                     "input",
                                     type='submit',
                                     name=SUBMIT_RUN,
                                     value=RESUBMIT)
                 self.build_text_file_table_cell(run)
                 if self.my_batch.wants_measurements_file:
                     with self.tag("td"):
                         if os.path.isfile(out_path):
                             with self.tag(
                                 "a", 
                                 href='ViewTextFile.py?run_id=%d&%s=%s' % 
                                 (run.run_id, FILE_TYPE, FT_OUT_FILE),
                                 title=out_path):
                                 self.text(out_file)
                         else:
                             with self.tag("span", 
                                      title='Output file not available'):
                                 self.text(out_file)
                 #
                 # This cell contains the form that deletes things
                 #
                 with self.tag("td"):
                     with self.tag("form", action='DeleteFile.py', method='POST'):
                         self.doc.input(
                             type="hidden", name=RUN_ID,
                             value = str(run.run_id))
                         for action, filename in (
                             (A_DELETE_TEXT, RunBatch.run_text_file(run)),
                             (A_DELETE_OUTPUT, RunBatch.run_out_file(self.my_batch, run)),
                             (A_DELETE_ALL, "all files for this run")):
                             self.doc.stag(
                                 "input",
                                 type="submit", name=K_DELETE_ACTION,
                                 value=action,
                                 title='Delete file %s' % filename, 
                                 onclick='return confirm("Do you really want'
                                 'to delete %s?")' % filename)
Пример #6
0
 def build_job_table_body(self):
     with self.tag("tbody"):
         for task_status in self.tasks:
             assert isinstance(task_status, RunBatch.BPJobTaskStatus)
             task = task_status.job_task
             status = task_status.status
             assert isinstance(task, RunBatch.BPJobTask)
             run = task.batch_array_task.run
             assert isinstance(run, RunBatch.BPRun)
             job = task.job
             assert isinstance(job, RunBatch.BPJob)
             out_file = RunBatch.run_out_file(self.my_batch, run)
             out_path = RunBatch.run_out_file_path(self.my_batch, run)
             with self.tag("tr"):
                 with self.tag("td"):
                     self.text(str(run.bstart))
                 with self.tag("td"):
                     self.text(str(run.bend))
                 with self.tag("td"):
                     self.text(str(job.job_id))
                 with self.tag("td"):
                     self.text(str(task.batch_array_task.task_id))
                 if status == RunBatch.JS_DONE:
                     with self.tag("td"):
                         cpu = task.get_runtime()
                         if cpu is not None:
                             with self.tag("div", **{
                                 "class":"success_message"}):                            
                                 self.text("Complete (%.2f sec)" % cpu)
                         else:
                             with self.tag("div", **{
                                 "class":"error_message"}):
                                 self.text("Error: see log")
                             with self.tag("div"):
                                 self.build_resubmit_run_form(run)
                 else:
                     with self.tag("td", style='color:red'):
                         with self.tag("div"):
                             self.text(status.lower().capitalize())
                         with self.tag("div"):
                             self.build_resubmit_run_form(run)
                 self.build_text_file_table_cell(task)
                 if self.my_batch.wants_measurements_file:
                     with self.tag("td"):
                         if os.path.isfile(out_path):
                             with self.tag(
                                 "a", 
                                 href='ViewTextFile.py?run_id=%d&%s=%s' % 
                                 (run.run_id, FILE_TYPE, FT_OUT_FILE),
                                 title=out_path):
                                 self.text(out_file)
                         else:
                             with self.tag("span", 
                                      title='Output file not available'):
                                 self.text(out_file)
                 #
                 # This cell contains the form that deletes things
                 #
                 with self.tag("td"):
                     with self.tag("form", action='DeleteFile.py', method='POST'):
                         self.doc.input(
                             type="hidden", name=RUN_ID,
                             value = str(run.run_id))
                         text_file = os.path.basename(
                             RunBatch.batch_array_task_text_file_path(
                                 task.batch_array_task))
                         for action, filename in (
                             (A_DELETE_TEXT, text_file),
                             (A_DELETE_OUTPUT, RunBatch.run_out_file(self.my_batch, run)),
                             (A_DELETE_ALL, "all files for this run")):
                             self.doc.stag(
                                 "input",
                                 type="submit", name=K_DELETE_ACTION,
                                 value=action,
                                 title='Delete file %s' % filename, 
                                 onclick='return confirm("Do you really want'
                                 'to delete %s?")' % filename)