From 8fae6f95b8730068456ebdeb0881535faef62d2b Mon Sep 17 00:00:00 2001 From: Jo Basevi Date: Thu, 22 Aug 2024 11:38:23 +1000 Subject: [PATCH] Manifest reproduce logs note missing or new files --- payu/manifest.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/payu/manifest.py b/payu/manifest.py index bc46788c..cd6ebc4d 100644 --- a/payu/manifest.py +++ b/payu/manifest.py @@ -97,16 +97,25 @@ def check_reproduce(self, previous_manifest): hash = self.get(filepath, hashfn) previous_hash = previous_manifest.get(filepath, hashfn) - if hash != previous_hash: + if hash is None: + differences.append( + f" {filepath}: Missing file (file not in " + + "calculated manifest)" + ) + elif previous_hash is None: + differences.append( + f" {filepath}: New file (file not in stored manifest)" + ) + elif hash != previous_hash: differences.append( - f"{filepath}: {hashfn}: {previous_hash} != {hash}" + f" {filepath}: {hashfn}: {previous_hash} != {hash}" ) if len(differences) != 0: sys.stderr.write( f'Run cannot reproduce: manifest {self.path} is not correct\n' ) - print("Manifest path: hash != calculated hash") + print(f"Manifest path: stored hash != calculated hash") for row in differences: print(row)