Commit 276ef8dc authored by David Mendez's avatar David Mendez
Browse files

Merge branch 'staging' into 'master'

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

See merge request !75
parents 33812c18 bb3cf34c
...@@ -154,12 +154,6 @@ def get_status_script_output(job_id, checker_name, script_path): ...@@ -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) 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) 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 return_code = status_check_process.returncode
check_msg = f'script return code was: {return_code}' check_msg = f'script return code was: {return_code}'
delayed_job_models.append_to_lsf_check_log(job_id, checker_name, check_msg) 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): ...@@ -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!' 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) 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') raise JobStatusDaemonError('There was an error when running the job status script! Please check the logs')
else: else:
return status_check_process.stdout.decode() 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