Пример #1
0
 def build_text_file_table_cell(self, run):
     '''Build a table cell containing links to the stdout/err output'''
     text_file = RunBatch.run_text_file(run)
     text_path = RunBatch.run_text_file_path(self.my_batch, run)
     err_file = RunBatch.run_err_file(run)
     err_path = RunBatch.run_err_file_path(self.my_batch, run)
     with self.tag("td", style="text-align: left"):
         for ft, path, filename in (
             (FT_TEXT_FILE, text_path, text_file),
             (FT_ERR_FILE, err_path, err_file)):
             with self.tag("div"):
                 if os.path.isfile(path):
                     with self.tag(
                         "a", style="text-align: left",
                         href='ViewTextFile.py?run_id=%d&%s=%s' % 
                         (run.run_id, FILE_TYPE, ft),
                         title=path):
                         self.text(filename)
                 else:
                     with self.tag(
                         "span", 
                         style="text-align: left",
                         title='Text file not available'):
                         self.text(filename)
Пример #2
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)