def delete_run(my_batch, my_run): if delete_action in (A_DELETE_ALL, A_DELETE_TEXT): remove_if_exists(RunBatch.run_text_file_path(my_batch, my_run)) remove_if_exists(RunBatch.run_err_file_path(my_batch, my_run)) if delete_action in (A_DELETE_ALL, A_DELETE_OUTPUT): remove_if_exists(RunBatch.run_out_file_path(my_batch, my_run))
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)
def handle_post(): batch_id = BATCHPROFILER_DEFAULTS[BATCH_ID] my_batch = RunBatch.BPBatch() my_batch.select(batch_id) txt_output_dir = RunBatch.text_file_directory(my_batch) job_script_dir = RunBatch.script_file_directory(my_batch) what_i_did = {} maybe_chmod(txt_output_dir, 0777, what_i_did) maybe_chmod(job_script_dir, 0777, what_i_did) for run in my_batch.select_runs(): for path in [RunBatch.run_text_file_path(my_batch, run), RunBatch.run_out_file_path(my_batch, run), RunBatch.run_err_file_path(my_batch, run)]: maybe_chmod(path, 0644, what_i_did) print "Content-Type: application/json" print print json.dumps(what_i_did)
def handle_post(): batch_id = BATCHPROFILER_DEFAULTS[BATCH_ID] my_batch = RunBatch.BPBatch() my_batch.select(batch_id) txt_output_dir = RunBatch.text_file_directory(my_batch) job_script_dir = RunBatch.script_file_directory(my_batch) what_i_did = {} maybe_chmod(txt_output_dir, 0777, what_i_did) maybe_chmod(job_script_dir, 0777, what_i_did) for run in my_batch.select_runs(): for path in [ RunBatch.run_text_file_path(my_batch, run), RunBatch.run_out_file_path(my_batch, run), RunBatch.run_err_file_path(my_batch, run) ]: maybe_chmod(path, 0644, what_i_did) print "Content-Type: application/json" print print json.dumps(what_i_did)
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)