From d4dc9786d62c8e85e4c6e61e4f56291ec95fc034 Mon Sep 17 00:00:00 2001 From: Jake Smith <jws52@cam.ac.uk> Date: Wed, 27 Jan 2021 08:44:26 +0000 Subject: [PATCH] fix: More precise check input from NAME The tarred directory of files from the Met Office includes the NAME .txt files to use as input, as well as various log files and diagnostic plots. The number of log files changed recently but shouldn't affect the operatinal calcs. This change means the check for a complete transfer of incoming files cares only about the NAME .txt files. --- ProcessorComponents.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ProcessorComponents.py b/ProcessorComponents.py index 9f6af76..e089a14 100644 --- a/ProcessorComponents.py +++ b/ProcessorComponents.py @@ -357,8 +357,8 @@ def process_in_job_env2_0(jobPath,status,config,component): subprocess_and_log(cmd_tar,description_short, description_long) # basic check that contents are as expected for 7-day forecast - # 57 files of NAME .txt timesteps and one summary png file - if len(os.listdir(f"{jobPath}/{file_name}")) != 58: + # 57 files of NAME .txt timesteps and some number of log files + if len(glob(f"{jobPath}/{file_name}/Met_Data_C1_T*.txt")) != 57: msg = f"Insufficient contents of untarred file in directory {jobPath}/{file_name}" logger.error(msg) raise RuntimeError(msg) @@ -447,7 +447,7 @@ def process_in_job_dep(jobPath,status,config,component): # basic check that contents are as expected # 132 files of NAME .txt timesteps and one summary png file - if len(os.listdir(f"{jobPath}/{file_name}")) not in [74,133]: + if len(glob(f"{jobPath}/{file_name}/deposition_srcs_allregions_C1_T*.txt")) != 56: logger.warning(f"Insufficient contents of input tar file (are sources.txt and sourcelocations.txt missing?)") return -- GitLab