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