From b1a972d53081b18ce8b62dd6ca276a4f0af64d75 Mon Sep 17 00:00:00 2001
From: Jake Smith <jws52@cam.ac.uk>
Date: Tue, 13 Sep 2022 12:55:00 +0100
Subject: [PATCH] fix: Epi pre-job check is more robust.

The pre-job is meant to exit quietly if the prerequisite data is not
available yet. However, the epi pre-job check was raising an error
if AlternativeSuccessFileTemplate was missing from the config for
either Deposition or Environment. This is now handled quietly too.
CAUTION: This means the epi component will never raise an error
for missing input data, i.e., no email will ever say epi has failed to
run.
---
 ProcessorUtils.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ProcessorUtils.py b/ProcessorUtils.py
index 1a8707d..7078fbd 100644
--- a/ProcessorUtils.py
+++ b/ProcessorUtils.py
@@ -236,6 +236,11 @@ def query_past_successes(input_args):
         try:
             query_proceed(dep_success_file,'deposition')
         except:
+            
+            if 'AlternativeSuccessFileTemplate' not in config_i[component]['Deposition']:
+                logger.exception(f"No AlternativeSuccessFileTemplate to check fors")
+                endScript(premature=True)
+
             dep_success_file_alt = Template(config_i[component]['Deposition']['AlternativeSuccessFileTemplate']).substitute(**config_i)
             query_proceed(dep_success_file_alt,'deposition')
 
@@ -244,6 +249,11 @@ def query_past_successes(input_args):
         try:
             query_proceed(env_success_file,'environment')
         except:
+
+            if 'AlternativeSuccessFileTemplate' not in config_i[component]['Environment']:
+                logger.exception(f"No AlternativeSuccessFileTemplate to check fors")
+                endScript(premature=True)
+
             env_success_file_alt = Template(config_i[component]['Environment']['AlternativeSuccessFileTemplate']).substitute(**config_i)
             query_proceed(env_success_file_alt,'environment')
 
-- 
GitLab