File indexing completed on 2025-03-14 23:36:19
0001
0002
0003 import xml.etree.ElementTree as ET
0004
0005 quantities = ["Name", "ReducedConfigurationID", "ParameterSetID"]
0006
0007 def parsexml(fname):
0008 root = ET.parse(fname)
0009 process = root.find("Process")
0010 return {q: process.find(q).text for q in quantities}
0011
0012 def parselog(fname):
0013 ret = {}
0014 with open(fname) as f:
0015 for line in f:
0016 s = line.rstrip().split(":")
0017 if len(s) == 2:
0018 ret[s[0]] = s[1]
0019 return ret
0020
0021 def main(jobreport, log):
0022 xmldata = parsexml(jobreport)
0023 logdata = parselog(log)
0024
0025 ret = 0
0026 for q in quantities:
0027 if xmldata[q] != logdata[q]:
0028 print(f"Quantity {q}: job report '{xmldata[q]}' != log '{logdata[q]}'")
0029 ret = 1
0030 return ret
0031
0032 if __name__ == "__main__":
0033 import sys
0034 sys.exit(main(sys.argv[1], sys.argv[2]))