Commit bb3cf34c authored by David Mendez's avatar David Mendez
Browse files

Status Daemon: only write to log output and error of script if there was an error

parent 2bf11658
......@@ -154,12 +154,6 @@ def get_status_script_output(job_id, checker_name, script_path):
delayed_job_models.append_to_lsf_check_log(job_id, checker_name, check_msg)
status_check_process = subprocess.run(run_command.split(' '), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
check_msg = f'Output: \n {status_check_process.stdout}'
delayed_job_models.append_to_lsf_check_log(job_id, checker_name, check_msg)
check_msg = f'Error: \n {status_check_process.stderr}'
delayed_job_models.append_to_lsf_check_log(job_id, checker_name, check_msg)
return_code = status_check_process.returncode
check_msg = f'script return code was: {return_code}'
delayed_job_models.append_to_lsf_check_log(job_id, checker_name, check_msg)
......@@ -180,6 +174,12 @@ def get_status_script_output(job_id, checker_name, script_path):
check_msg = f'There was an error when running the job status script! Check the directory {script_path} for logs!'
delayed_job_models.append_to_lsf_check_log(job_id, checker_name, check_msg)
check_msg = f'Output: \n {status_check_process.stdout}'
delayed_job_models.append_to_lsf_check_log(job_id, checker_name, check_msg)
check_msg = f'Error: \n {status_check_process.stderr}'
delayed_job_models.append_to_lsf_check_log(job_id, checker_name, check_msg)
raise JobStatusDaemonError('There was an error when running the job status script! Please check the logs')
else:
return status_check_process.stdout.decode()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment