707def testEDMList(edm_list, error_on_edmdetails = True):
708 """
709 Checks EDM list entries for serialization and configuration compliance.
710 """
711
712
713 _noAuxList = ["xAOD::" + contType for contType in ["TrigConfKeys", "BunchConfKey"]]
714
715 cgen = clidGenerator("", False)
716 return_code = 0
717 found_allow_truncation = False
718 serializable_names = []
719 serializable_names_no_label = []
720 serializable_names_no_properties = []
721
722 for i, edm in enumerate(edm_list):
723
724
725 if len(edm) < 3:
726 log.error("EDM entry too short for " + edm[0])
727 return_code = 1
728 continue
729
730 serializable_name = edm[0]
731 serializable_name_no_label = re.sub(r"\#.*", "", serializable_name)
732 serializable_name_no_properties = serializable_name.split('.')[0]
733
734 serializable_names.append(serializable_name)
735 serializable_names_no_label.append(serializable_name_no_label)
736 serializable_names_no_properties.append(serializable_name_no_properties)
737
738
739 if not isCLIDDefined(cgen,serializable_name_no_label):
740 log.error("no CLID for " + serializable_name)
741 return_code = 1
742
743
744 if "Aux" not in serializable_name and "." in serializable_name:
745 log.error("A '.' found in non-Aux container name " + serializable_name)
746 return_code = 1
747
748
749 if "Aux" in serializable_name and "Aux." not in serializable_name:
750 log.error("no final Aux. in label for " + serializable_name)
751 return_code = 1
752
753
754 if serializable_name.count("#") != 1:
755 log.error("Invalid naming structure for " + serializable_name)
756 return_code = 1
757 else:
758
759 if serializable_name.startswith("xAOD") and "Aux" not in serializable_name:
760 cont_type,cont_name = serializable_name.split("#")
761 if cont_type not in _noAuxList:
762 auxmismatch = False
763 if len(edm_list) == i+1:
764 auxmismatch = True
765 cont_to_test = "nothing"
766 else:
767 cont_to_test = edm_list[i+1][0].
split(
".")[0]+
"."
768 cont_type_short = cont_type.replace("Container","")
769 pattern = re.compile(cont_type_short+r".*Aux.*\#"+cont_name+"Aux.")
770 if not pattern.match(cont_to_test):
771
772 shallow_pattern = re.compile("xAOD::ShallowAuxContainer#"+cont_name+"Aux.")
773 if not shallow_pattern.match(cont_to_test):
774 auxmismatch = True
775 if auxmismatch:
776 log.error("Expected relevant Aux container following interface container %s, but found %s instead.",serializable_name,cont_to_test)
777 return_code = 1
778 else:
779
781 if len(edm_list[i+1]) > 1 and cont_to_test.count("#") == 1:
782 contname_to_test = cont_to_test.split("#")[1]
783 targets_to_test =
set(edm_list[i+1][1].
split())
784 if len(targets ^ targets_to_test) > 0:
785 log.error("Targets of %s (%s) and %s (%s) do not match",cont_name,targets,contname_to_test,targets_to_test)
786 return_code = 1
787
788
789 if i>0 and "Aux" in serializable_name and "Aux" in edm_list[i-1][0]:
790 log.error(f"Aux container {serializable_name} needs to folow the "
791 "associated interface container in the EDM list")
792 return_code = 1
793
794
795
796 file_types = edm[1].
split()
797 for file_type in file_types:
798 if file_type not in AllowedOutputFormats:
799 log.error("unknown file type " + file_type + " for " + serializable_name)
800 return_code = 1
801 for higher_level,required_lower_level in [('AOD','ESD'), ('SLIM','AODFULL')]:
802 if higher_level in file_type and required_lower_level not in file_types:
803 log.error("Target list for %s containing '%s' must also contain lower level target '%s'.",serializable_name,file_type,required_lower_level)
804 return_code = 1
805
806
807 tags = edm[3] if len(edm) > 3 else None
808 allow_truncation_flag = False
809 if tags:
810 allow_truncation_flag = allowTruncation in tags
811 if allow_truncation_flag:
812 found_allow_truncation = True
813
814 if found_allow_truncation and not allow_truncation_flag:
815 log.error("All instances of 'allowTruncation' need to be at the END of the EDM serialisation list")
816 return_code = 1
817
818
819
820
821
822 if not len(
set(serializable_names_no_properties)) == len(serializable_names_no_properties):
823 log.error("Duplicates in EDM list! Duplicates found:")
825 for item, count in collections.Counter(serializable_names_no_properties).items():
826 if count > 1:
827 log.error(
str(count) +
"x: " +
str(item))
828 return_code = 1
829
830
831 for EDMDetail in EDMDetailsRun3.keys():
832 if EDMDetail not in serializable_names_no_label:
833 msg = "EDMDetail for " + EDMDetail + " does not correspond to any name in TriggerList"
834 if error_on_edmdetails:
835 log.error(msg)
836 return_code = 1
837 else:
838 log.warning(msg)
839
840 return return_code