in app/source/dragen/src/dragen_qs.py [0:0]
def run_job(self):
# Check if FPGA image download is needed
if not os.path.isfile(self.FPGA_DOWNLOAD_STATUS_FILE):
self.download_dragen_fpga()
# If board is in bad state, run dragen_reset before next process starts
self.check_board_state()
# Setup unique output directory
self.create_output_dir()
# Add some internally defined parameters
self.new_args.extend(
['--output_status_file', self.output_dir + '/job-speedometer.log']
)
self.new_args.extend(
['--intermediate-results-dir', self.CLOUD_SPILL_FOLDER]
)
self.new_args.extend(
['--lic-no-print']
)
# expand the Dragen args to construct the full command
dragen_opts = ' '.join(self.new_args)
# Construct the 'main' Dragen command
dragen_cmd = "%s %s " % (self.DRAGEN_PATH, dragen_opts)
# Save the Dragen output to a file instead of stdout
output_log_path = self.output_dir + '/' + self.DRAGEN_LOG_FILE_NAME % round(time.time())
redirect_cmd = self.REDIRECT_OUTPUT_CMD_SUFFIX % output_log_path
dragen_cmd = "%s %s" % (dragen_cmd, redirect_cmd)
# Run the Dragen process
self.process_start_time = datetime.datetime.utcnow()
exit_code = exec_cmd(dragen_cmd)
# Upload the results to S3 output bucket
self.upload_job_outputs()
# Delete the output results directory, i.e. /staging/<uuid4>
# NOTE: Do not delete the reference directory enable re-use with another job
rm_out_path = self.output_dir
printf("Removing Output dir %s" % rm_out_path)
shutil.rmtree(rm_out_path, ignore_errors=True)
# Handle error code
if exit_code:
self.copy_var_log_dragen_files()
self.global_exit_code = exit_code
if self.global_exit_code > 128 or self.global_exit_code < 0:
if self.global_exit_code > 128:
signum = self.global_exit_code - 128
else:
signum = -self.global_exit_code
printf("Job terminated due to signal %s" % signum)
self.process_end_time = datetime.datetime.utcnow()
return