From 0c7be7f4ca8843e0f0d370815195c2aefe0d37ca Mon Sep 17 00:00:00 2001 From: jws52 <jws52@cam.ac.uk> Date: Mon, 7 Nov 2022 17:00:05 +0000 Subject: [PATCH] fix: More specific check of ssh exit status codes --- coordinator/ProcessorServer.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/coordinator/ProcessorServer.py b/coordinator/ProcessorServer.py index c07349d..1ef1ceb 100644 --- a/coordinator/ProcessorServer.py +++ b/coordinator/ProcessorServer.py @@ -52,13 +52,13 @@ def process_pre_job_server_download(input_args: dict): "StrictHostKeyChecking=no", config['ServerName'], f"test -f {file_path_full} && tar -tzf {file_path_full} >/dev/null"] - + description_short = 'subprocess_ssh' description_long = f"Checking for existence of {file_path_full}" status = subprocess_and_log(cmd_ssh,description_short,description_long,check=False) - if status.returncode > 0: + if status.returncode in [1,2]: # a time check in UTC. If it's late, raise warning, if very late, raise error @@ -95,6 +95,15 @@ def process_pre_job_server_download(input_args: dict): elif status.returncode == 0: logger.info(f"Data is available for config {i+1} of {len(config_paths)}, calculation shall proceed") + # silence other return codes + # there is a known issue from tests that ssh to a blank server will + # raise error code 255. This is kept silent while we come up with a tidy + # solution. This doesn't affect production runs as the error would be + # picked up by the later scp commands. + #else: + # logger.error(f"Unexpected return code from ssh command: {status.returncode}") + # endScript(premature=False) + return True def upload(config,FilesToSend,component): -- GitLab