From f9fecdfa7a56f7a0db03f66612d60b90caf077a0 Mon Sep 17 00:00:00 2001 From: Xanthe Hoad <xanthe.hoad@cern.ch> Date: Fri, 28 Apr 2017 13:16:57 +0200 Subject: [PATCH] MaM updates: improve behaviour for TrigHLTMon_tf, new button for GUI Former-commit-id: 16a454586f4569f84cafdc00e6c9797e93e979fd --- .../java/GUI/TrigMaMGUI.java | 15 +- .../java/TrigMaMGUI_TRIGGERDBREPR.sh | 1 + .../TrigHLTMonitoring/python/HLTMonFlags.py | 35 +++-- .../python/MenuAwareMonitoring.py | 33 ----- .../python/MenuAwareMonitoringStandalone.py | 123 +++++++--------- .../TrigHLTMonitoring/run/TrigHLTMon_tf.py | 14 +- .../TrigHLTMonitoring/share/runMaM.py | 132 ++++++++++-------- 7 files changed, 166 insertions(+), 187 deletions(-) diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/java/GUI/TrigMaMGUI.java b/Trigger/TrigMonitoring/TrigHLTMonitoring/java/GUI/TrigMaMGUI.java index 33ca3c0224c..5f500336389 100644 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/java/GUI/TrigMaMGUI.java +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/java/GUI/TrigMaMGUI.java @@ -91,10 +91,10 @@ public class TrigMaMGUI extends JFrame { JScrollPane scrollPane = new JScrollPane(linkComment); scrollPane.setPreferredSize(new Dimension(200, 30)); SMK_MCK_link_subpanel_1.add(scrollPane); - JButton SMK_MCK_link_button = new JButton("Make SMK-MCK link"); JPanel SMK_MCK_link_subpanel_2 = new JPanel(new FlowLayout(FlowLayout.CENTER,1,1)); SMK_MCK_link_panel.add(SMK_MCK_link_subpanel_2); + JButton SMK_MCK_link_button = new JButton("Make SMK-MCK link"); SMK_MCK_link_subpanel_2.add(SMK_MCK_link_button); final JCheckBox force_link_checkbox = new JCheckBox("Force link upload (only tick if you are certain you want to do this)"); SMK_MCK_link_subpanel_2.add(force_link_checkbox); @@ -369,6 +369,11 @@ public class TrigMaMGUI extends JFrame { JButton ViewSMCKbutton = new JButton("View SMCK"); View_keys_subpanel_2.add(ViewSMCKbutton); + JPanel View_keys_subpanel_3 = new JPanel(new FlowLayout(FlowLayout.CENTER,1,1)); + View_keys_panel.add(View_keys_subpanel_3); + JButton ViewLinksButton = new JButton("View all SMK-MCK links"); + View_keys_subpanel_3.add(ViewLinksButton); + ViewSMKbutton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //Get the selected SMK info @@ -395,6 +400,14 @@ public class TrigMaMGUI extends JFrame { RunProcess(viewSMCKcommand); } }); + + ViewLinksButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + //Get the selected MCK info + String viewLinksCommand = "from TrigHLTMonitoring.MenuAwareMonitoringStandalone import MenuAwareMonitoringStandalone;ms = MenuAwareMonitoringStandalone('"+dbalias+"');ms.print_all_mck_to_smk_links();"; + RunProcess(viewLinksCommand); + } + }); } //Setting up the tabbed pane diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/java/TrigMaMGUI_TRIGGERDBREPR.sh b/Trigger/TrigMonitoring/TrigHLTMonitoring/java/TrigMaMGUI_TRIGGERDBREPR.sh index 45717a8c6fd..451c6719bde 100755 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/java/TrigMaMGUI_TRIGGERDBREPR.sh +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/java/TrigMaMGUI_TRIGGERDBREPR.sh @@ -26,6 +26,7 @@ fi SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" TARGETDIR="/tmp/${USER}/MaMGUI" +mkdir -p $TARGETDIR javac $SCRIPTDIR/../java/TrigMaMGUI.java -d $TARGETDIR java -cp $TARGETDIR: TrigMaMGUI TRIGGERDBREPR diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/HLTMonFlags.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/HLTMonFlags.py index 0832eac34a2..a4fabdf9f51 100644 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/HLTMonFlags.py +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/HLTMonFlags.py @@ -29,20 +29,6 @@ class doMaM(JobProperty): StoredValue=True list+=[doMaM] -class doMaM_ExtractAndDumpConfigs(JobProperty): - """ Switch for menu-aware monitoring: exctraction of tool configurations, and output to a json file """ - statusOn=True - allowedTypes=['bool'] - StoredValue=False -list+=[doMaM_ExtractAndDumpConfigs] - -class MaM_OutputJSON(JobProperty): - """ Output json file for dumping monitoring tool configurations, for menu-aware monitoring """ - statusOn=True - allowedTypes=['str'] - StoredValue='mam_configs.json' -list+=[MaM_OutputJSON] - class doMaM_ApplyMCK(JobProperty): """ Switch for menu-aware monitoring: applying configurations defined by an MCK """ statusOn=True @@ -57,6 +43,27 @@ class MCK(JobProperty): StoredValue=-1 list+=[MCK] +class doMaM_UseReproDB(JobProperty): + """ Switch for menu-aware monitoring: use MCKs in TRIGGERDBREPR, don't query COOL """ + statusOn=True + allowedTypes=['bool'] + StoredValue=False +list+=[doMaM_UseReproDB] + +class doMaM_ExtractAndDumpConfigs(JobProperty): + """ Switch for menu-aware monitoring: extraction of tool configurations, and output to a json file """ + statusOn=True + allowedTypes=['bool'] + StoredValue=False +list+=[doMaM_ExtractAndDumpConfigs] + +class MaM_OutputJSON(JobProperty): + """ Output json file for dumping monitoring tool configurations, for menu-aware monitoring """ + statusOn=True + allowedTypes=['str'] + StoredValue='mam_configs.json' +list+=[MaM_OutputJSON] + class doEgamma(JobProperty): """ Egamma switch for monitoring """ statusOn=True diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/MenuAwareMonitoring.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/MenuAwareMonitoring.py index a210a113632..8fdbaada385 100644 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/MenuAwareMonitoring.py +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/MenuAwareMonitoring.py @@ -1081,39 +1081,6 @@ class MenuAwareMonitoring: return 0 - def dump_mck_to_json(self,mck_id,output_json_filename=""): - "Dump the contents of an MCK to a json file, including the contents of linked SMCKs" - - if not self.__is_input_an_mck__(mck_id): - print "MCK",mck_id,"has not been recognised as a valid MCK." - return - - if output_json_filename == "": - output_json_filename = "MCK_"+str(mck_id)+".json" - - output_file = open( output_json_filename, "w" ) - - mck_info = self.ms.oi.read_mck_info_from_db(mck_id) - smck_ids = self.ms.oi.read_mck_links_from_db(mck_id) - - mck_dump_info = {} - # datetime.datetime objects are not JSON serializable - # seeing as this info is not used later, we replace with the ctime - mck_info['MCK_CREATION_DATE'] = mck_info['MCK_CREATION_DATE'].ctime() - mck_dump_info['MCK'] = mck_info - - # combine rest of the MCK info in the MONITORING_TOOL_DICT - mck_dump_info['MONITORING_TOOL_DICT'] = {} - for smck_id in smck_ids: - smck_info = self.ms.oi.read_smck_info_from_db(smck_id) - smck_info['SMCK_CREATION_DATE'] = smck_info['SMCK_CREATION_DATE'].ctime() - tool_type = smck_info['SMCK_TOOL_TYPE'] - mck_dump_info['MONITORING_TOOL_DICT'][tool_type] = smck_info - - json.dump(mck_dump_info, output_file, ensure_ascii=True, sort_keys=True) - output_file.close() - - def dump_local_config_to_json(self,output_json_filename="mam_configs.json",processing_step="",processing_stream="",comment="",default=""): "All locally read-in trigger monitoring tool configurations are output to a file." diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/MenuAwareMonitoringStandalone.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/MenuAwareMonitoringStandalone.py index 23386e049a9..b717fe8ee3e 100644 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/MenuAwareMonitoringStandalone.py +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/MenuAwareMonitoringStandalone.py @@ -456,9 +456,12 @@ class MenuAwareMonitoringStandalone: if len(active_smk_to_mck_link_search_results) > 0: # we have found an active link. Upload should not proceed for safety. - print "SMK",input_smk,"is already linked to MCK",active_smk_to_mck_link_search_results[0][0],". Will now print full link details." + print "SMK",input_smk,"is already linked to MCK",active_smk_to_mck_link_search_results[0][0] + print "Will now print full link details:" print active_smk_to_mck_link_search_results - print "Deactivate this link first if you want to create a new link. You can use force_deactivate_all_links_for_smk(smk) (or tick the force upload box if using the GUI), but be sure this is what you want to do." + print "Deactivate this link first if you want to create a new link." + print "You can use force_deactivate_all_links_for_smk(smk) (or tick the force upload box if using the GUI)." + print "You should make sure this is what you really want to do first before proceeding!" return # get the current user for the creator @@ -493,23 +496,26 @@ class MenuAwareMonitoringStandalone: active_smk_to_mck_link_search_results = self.oi.find_active_smk_to_mck_link(input_smk) if len(active_smk_to_mck_link_search_results) > 0: - print "SMK",input_smk,"is already linked to MCK",active_smk_to_mck_link_search_results[0][0],". Will now print full link details." + print "SMK",input_smk,"is already linked to MCK",active_smk_to_mck_link_search_results[0][0] + print "Will now print full link details." print active_smk_to_mck_link_search_results + + if GUI is False: + print "Requested force deactivate all links for SMK",input_smk + print "Do you really want to do this?" + user_input = raw_input("y/n: ") + if user_input != 'y': + print "Aborted." + return + + print "Force deactivating all links for SMK",input_smk,"..." + self.oi.deactivate_all_links_for_given_smk(input_smk) + print "All links deactivated." + else: print "SMK",input_smk,"is not linked to any MCK." return - if GUI is False: - print "Will force deactivate all links for SMK",input_smk,". Do you really want to do this?" - user_input = raw_input("y/n: ") - if user_input != 'y': - print "Aborted." - return - - print "Force deactivating all links for SMK",input_smk,"..." - self.oi.deactivate_all_links_for_given_smk(input_smk) - print "All links deactivated." - def print_all_mck_to_smk_links(self,print_deactivated_links=False): """Print MCK to SMK links. By default prints only active links. @@ -937,60 +943,6 @@ class MenuAwareMonitoringStandalone: return mck_id, smck_ids - def get_default_mck_id_from_db(self,input_athena_version=""): - """Get the MCK number (MCK_ID) of the default for this Athena version. - If input_athena_version=='', the current Athena version is used.""" - - if self.connected_to_oracle == False: - print "MaM is not connected to the database, so this function is not available." - return - - # if no input Athena version is provided, then use the current version - if input_athena_version == "": - input_athena_version = self.current_athena_version - - # search for default mck - return self.oi.read_default_mck_id_from_db(input_athena_version) - - - def get_default_from_db(self,input_athena_version="",print_output_here=""): - """Prints default MCK number (MCK_ID) for an Athena version. - If no Athena version is specified, the current Athena version being run in is used. - All default information is made available in the <ThisVariable>.default_global_info dictionary.""" - - if self.connected_to_oracle == False: - print "MaM is not connected to the database, so this function is not available." - return - - # check for empty print_output_here - # if it is found, use self.print_output - if print_output_here == "": - print_output_here = self.print_output - - if print_output_here: - print "Attempting to get default tool configuration from database" - - # if no input Athena version is provided, then use the current version - if input_athena_version == "": - input_athena_version = self.current_athena_version - - # search for default mck - default_mck = self.get_default_mck_id_from_db(input_athena_version) - - # if a valid default mck exists - if default_mck >= 0: - if print_output_here: - print "Default MCK for Athena version "+input_athena_version+" is",default_mck - - # fill self.default_global_info - self.default_global_info = self.get_global_info_from_db(default_mck) - - # if there is no default for this Athena version - else: - if print_output_here: - print "No default for Athena version "+self.current_athena_version+" has been uploaded" - - def get_global_info_from_db(self,mck_id): "For an input MCK number (MCK_ID), get all related MCK and SMCK info, and return it as a dictionary." @@ -1038,6 +990,39 @@ class MenuAwareMonitoringStandalone: input_file.close() + def dump_mck_to_json(self,mck_id,output_json_filename=""): + "Dump the contents of an MCK to a json file, including the contents of linked SMCKs" + + mck_info = self.oi.read_mck_info_from_db(mck_id) + if mck_info == -1: + print "MCK",mck_id,"has not been recognised as a valid MCK." + return + + smck_ids = self.oi.read_mck_links_from_db(mck_id) + + if output_json_filename == "": + output_json_filename = "MCK_"+str(mck_id)+".json" + + output_file = open( output_json_filename, "w" ) + + mck_dump_info = {} + # datetime.datetime objects are not JSON serializable + # seeing as this info is not used later, we replace with the ctime + mck_info['MCK_CREATION_DATE'] = mck_info['MCK_CREATION_DATE'].ctime() + mck_dump_info['MCK'] = mck_info + + # combine rest of the MCK info in the MONITORING_TOOL_DICT + mck_dump_info['MONITORING_TOOL_DICT'] = {} + for smck_id in smck_ids: + smck_info = self.oi.read_smck_info_from_db(smck_id) + smck_info['SMCK_CREATION_DATE'] = smck_info['SMCK_CREATION_DATE'].ctime() + tool_type = smck_info['SMCK_TOOL_TYPE'] + mck_dump_info['MONITORING_TOOL_DICT'][tool_type] = smck_info + + json.dump(mck_dump_info, output_file, ensure_ascii=True, sort_keys=True) + output_file.close() + + def search(self,flag1="",input1="",print_output_here=""): """Search the Oracle database for something. input1 is is what is to be searched for. @@ -1307,7 +1292,7 @@ class MenuAwareMonitoringStandalone: def create_sqlite_file_to_copy_to_cool(self,mck,run,runend="",info="",project="",version=""): - """Create ad sqlite file which can be used to manually add data to COOL""" + """Create an sqlite file which can be used to manually add data to COOL""" # this way https://twiki.cern.ch/twiki/bin/view/AtlasComputing/CoolPublishing#Updating_data_on_the_online_data if runend and run >= runend: diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/run/TrigHLTMon_tf.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/run/TrigHLTMon_tf.py index 9f7b4ac30f4..adeda8a6a01 100755 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/run/TrigHLTMon_tf.py +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/run/TrigHLTMon_tf.py @@ -15,14 +15,14 @@ if __name__ == '__main__': executorSet = set() executorSet.add(athenaExecutor(name = 'HLTMon', skeletonFile = 'TrigHLTMonitoring/skeleton.HLTMon_tf.py', substep = 'r2a', inData = ['BS','AOD'], outData = ['HIST'])) - - trf = transform(executor = executorSet) + + trf = transform(executor = executorSet) addAthenaArguments(trf.parser) - trf.parser.defineArgGroup('TrigHLTMon', 'HLT Monitoring transform arguments') + trf.parser.defineArgGroup('TrigHLTMon args', 'HLT Monitoring transform arguments') trf.parser.add_argument('--inputBSFile', nargs='+', type=trfArgClasses.argFactory(trfArgClasses.argBSFile, io='input'), help='Input bytestream file', group='TrigHLTMon args') - + trf.parser.add_argument('--inputAODFile', nargs='+', type=trfArgClasses.argFactory(trfArgClasses.argPOOLFile, io='input'), help='Input pool file', group='TrigHLTMon args') @@ -33,11 +33,9 @@ if __name__ == '__main__': trf.parser.add_argument('--useDB',type=trfArgClasses.argFactory(trfArgClasses.argBool),help='Use TrigConfigSvc',) - trf.parser.defineArgGroup('Monitoring Args', 'Monitoring options') + trf.parser.defineArgGroup('Monitoring args', 'Monitoring options') trf.parser.add_argument('--monFlags', nargs='+',type=trfArgClasses.argFactory(trfArgClasses.argList), - help='TrigHLTMon histogram switches', group='TrigHLTMon args') + help='TrigHLTMon histogram switches', group='Monitoring args') trf.parseCmdLineArgs(sys.argv[1:]) trf.execute() trf.generateReport() - - diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/share/runMaM.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/share/runMaM.py index 80569d6fcf8..05ed5574aaf 100644 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/share/runMaM.py +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/share/runMaM.py @@ -8,16 +8,21 @@ log = logging.getLogger( 'TrigHLTMonitoring/MenuAwareMonitoring' ) if HLTMonFlags.doMaM == True: - # MaM needs to check whether it is running in a Trigger reprocessing job or not, and start an instance of MaM connected to the correct database accordingly - trigger_reco_tf_job = False - - if hasattr(runArgs, "DBserver") and runArgs.DBserver == "TRIGGERDBREPR": - trigger_reco_tf_job = True - elif hasattr(runArgs, "triggerConfig") and "TRIGGERDBREPR" in runArgs.triggerConfig: - trigger_reco_tf_job = True - + # check whether we are running in a trigger reprocessing job or not + checkSMKrepr = True; + for arg in sys.argv: + if 'HLTMon_tf' in arg: + HLTMonFlags.doMaM_UseReproDB.set_Value_and_Lock( True ) + checkSMKrepr = False + if HLTMonFlags.doMaM_UseReproDB.get_Value() == False: + if hasattr(runArgs, "DBserver") and runArgs.DBserver == "TRIGGERDBREPR": + HLTMonFlags.doMaM_UseReproDB.set_Value_and_Lock( True ) + elif hasattr(runArgs, "triggerConfig") and "TRIGGERDBREPR" in runArgs.triggerConfig: + HLTMonFlags.doMaM_UseReproDB.set_Value_and_Lock( True ) + + # start an instance of MaM connected to the correct database accordingly from TrigHLTMonitoring.MenuAwareMonitoring import MenuAwareMonitoring - if trigger_reco_tf_job: + if HLTMonFlags.doMaM_UseReproDB.get_Value() == True: log.info("Will attempt to doMaM with TRIGGERDBREPR") mam = MenuAwareMonitoring("TRIGGERDBREPR_R") else: @@ -28,57 +33,60 @@ if HLTMonFlags.doMaM == True: log.error("Cannot doMaM without database connection") else: # if a specific Monitoring Configuration Key (MCK) has been set, then use it - if HLTMonFlags.MCK.StoredValue > 0: - if mam.ms.oi.check_if_mck_id_exists(HLTMonFlags.MCK.StoredValue): - if mam.does_mck_athena_version_match_current_athena_version(HLTMonFlags.MCK.StoredValue): - log.info("MCK found via transform %d" % HLTMonFlags.MCK.StoredValue) + if HLTMonFlags.MCK.get_Value() > 0: + if mam.ms.oi.check_if_mck_id_exists( HLTMonFlags.MCK.get_Value() ): + if mam.does_mck_athena_version_match_current_athena_version( HLTMonFlags.MCK.get_Value() ): + log.info("MCK found via transform %d" % HLTMonFlags.MCK.get_Value()) # if we are applying configurations to tools according to an MCK, then do that here if HLTMonFlags.doMaM_ApplyMCK: - log.info("Applying MCK %d" % HLTMonFlags.MCK.StoredValue) - mam.apply_mck(HLTMonFlags.MCK.StoredValue) + log.info("Applying MCK %d" % HLTMonFlags.MCK.get_Value()) + mam.apply_mck( HLTMonFlags.MCK.get_Value() ) else: - log.error("MCK for a different release found via transform: %d" % HLTMonFlags.MCK.StoredValue ) + log.error("MCK for a different release found via transform: %d" % HLTMonFlags.MCK.get_Value() ) else: - log.error("MCK found via transform (%d) is not a valid MCK" % HLTMonFlags.MCK.StoredValue ) + log.error("MCK found via transform (%d) is not a valid MCK" % HLTMonFlags.MCK.get_Value() ) # if HLTMonFlags.MCK is -1 (the default) we try to determine the MCK automatically, as long as this is not MC - is_not_sim = True + isNotSIM = True from RecExConfig.InputFilePeeker import inputFileSummary if inputFileSummary.__contains__('evt_type'): if 'IS_SIMULATION' in inputFileSummary['evt_type']: log.info("Will not try to get MCK automatically as we are running on MC") - is_not_sim = False - - if HLTMonFlags.MCK.StoredValue == -1 and is_not_sim: - if trigger_reco_tf_job: - - # for trigger repro jobs, need to check the transform arguments and get the SMK from there, then use the linked MCK. - # no COOL interaction in these jobs - SMKrepr = None - if hasattr(runArgs, "DBsmkey") and runArgs.DBsmkey!="NONE": - SMKrepr = int(runArgs.DBsmkey) - elif hasattr(runArgs, "triggerConfig") and runArgs.triggerConfig!="NONE": - SMKrepr = int(runArgs.triggerConfig.split(":")[-1].split(",")[0]) + isNotSIM = False + + if HLTMonFlags.MCK.get_Value() == -1 and isNotSIM: + if HLTMonFlags.doMaM_UseReproDB.get_Value() == True: + if checkSMKrepr == True: + # for Trig_reco_tf, check the transform arguments and get the SMK from there, then use the linked MCK + # don't check via SMK for TrigHLTMon_tf + # no COOL interaction in these jobs + SMKrepr = None + if hasattr(runArgs, "DBsmkey") and runArgs.DBsmkey!="NONE": + SMKrepr = int(runArgs.DBsmkey) + elif hasattr(runArgs, "triggerConfig") and runArgs.triggerConfig!="NONE": + SMKrepr = int(runArgs.triggerConfig.split(":")[-1].split(",")[0]) + else: + log.info("Could not get SMK from DBsmkey or triggerConfig runArgs") + + if SMKrepr is not None: + log.info("SMK from runArgs %d" % SMKrepr) + # we now have the required input info. Use MaM to get the appropriate MCK + MCKfromSMKrepr = mam.get_mck_id_from_smk( SMKrepr ) + # if the MCK is > 0 and is from the right release then apply it, otherwise use the default tool configurations + if MCKfromSMKrepr > 0: + if mam.does_mck_athena_version_match_current_athena_version( MCKfromSMKrepr ): + HLTMonFlags.MCK.set_Value_and_Lock( MCKfromSMKrepr ) + log.info("MCK %d found via SMK link" % HLTMonFlags.MCK.get_Value()) + if HLTMonFlags.doMaM_ApplyMCK: + log.info("Applying MCK %d" % HLTMonFlags.MCK.get_Value()) + mam.apply_mck( HLTMonFlags.MCK.get_Value() ) + else: + log.info("MCK %d found via SMK link is not valid in this release -> no MCK will be applied" % HLTMonFlags.MCK.get_Value()) + elif MCKfromSMKrepr == 0: + HLTMonFlags.MCK.set_Value_and_Lock( MCKfromSMKrepr ) + log.info("MCK 0 found via SMK link -> no MCK will be applied") else: - log.error("Could not get SMK from DBsmkey or triggerConfig runArgs") - - if SMKrepr is not None: - log.info("SMK from runArgs %d" % SMKrepr) - # we now have the required input info. Use MaM to get the appropriate MCK - MCKfromSMKrepr = mam.get_mck_id_from_smk(SMKrepr) - # if the MCK is > 0 and is from the right release then apply it, otherwise use the default tool configurations - if MCKfromSMKrepr > 0: - if mam.does_mck_athena_version_match_current_athena_version(MCKfromSMKrepr): - HLTMonFlags.MCK.StoredValue = MCKfromSMKrepr - log.info("MCK %d found via SMK link" % HLTMonFlags.MCK.StoredValue) - if HLTMonFlags.doMaM_ApplyMCK: - log.info("Applying MCK %d" % HLTMonFlags.MCK.StoredValue) - mam.apply_mck( HLTMonFlags.MCK.StoredValue ) - else: - log.info("MCK %d found via SMK link is not valid in this release -> no MCK will be applied" % HLTMonFlags.MCK.StoredValue) - elif MCKfromSMKrepr == 0: - HLTMonFlags.MCK.StoredValue = MCKfromSMKrepr - log.info("MCK 0 found via SMK link -> no MCK will be applied") + log.info("Not checking for MCK via SMK link (TrigHLTMon_tf mode)") else: # try to get the MCK from COOL @@ -111,30 +119,30 @@ if HLTMonFlags.doMaM == True: retrieved_payload=retrieved_obj.payload() retrieved_format=retrieved_payload['MonConfigKey'] MonitoringConfigurationKey = int(retrieved_format) - HLTMonFlags.MCK.StoredValue = MonitoringConfigurationKey + HLTMonFlags.MCK.set_Value_and_Lock( MonitoringConfigurationKey ) coolDB.closeDatabase() - if HLTMonFlags.MCK.StoredValue == 0: + if HLTMonFlags.MCK.get_Value() == 0: log.info("MCK 0 found in COOL folder %s for release %s -> no MCK will be applied" % (foldername,mam.ms.current_athena_version)) except: log.info("No MCK in COOL folder %s for release %s -> no MCK will be applied" % (foldername,mam.ms.current_athena_version)) - if HLTMonFlags.MCK.StoredValue > 0: - if mam.ms.oi.check_if_mck_id_exists(HLTMonFlags.MCK.StoredValue): - if mam.does_mck_athena_version_match_current_athena_version(HLTMonFlags.MCK.StoredValue): - log.info("MCK %d found in COOL folder %s for release %s" % (HLTMonFlags.MCK.StoredValue,foldername,release_tag)) + if HLTMonFlags.MCK.get_Value() > 0: + if mam.ms.oi.check_if_mck_id_exists(HLTMonFlags.MCK.get_Value()): + if mam.does_mck_athena_version_match_current_athena_version(HLTMonFlags.MCK.get_Value()): + log.info("MCK %d found in COOL folder %s for release %s" % (HLTMonFlags.MCK.get_Value(),foldername,release_tag)) if HLTMonFlags.doMaM_ApplyMCK: - log.info("Applying MCK %d" % HLTMonFlags.MCK.StoredValue) - mam.apply_mck(HLTMonFlags.MCK.StoredValue) + log.info("Applying MCK %d" % HLTMonFlags.MCK.get_Value()) + mam.apply_mck(HLTMonFlags.MCK.get_Value()) else: - log.error("MCK %d found in COOL folder %s with tag %s is not a valid in this release" % (HLTMonFlags.MCK.StoredValue,foldername,release_tag)) + log.error("MCK %d found in COOL folder %s with tag %s is not a valid in this release" % (HLTMonFlags.MCK.get_Value(),foldername,release_tag)) else: - log.error("MCK %d found in COOL folder %s with tag %s is not a valid MCK" % (HLTMonFlags.MCK.StoredValue,foldername,release_tag)) + log.error("MCK %d found in COOL folder %s with tag %s is not a valid MCK" % (HLTMonFlags.MCK.get_Value(),foldername,release_tag)) else: log.error("Unable to get run number from metadata") # if dumping the tool configurations (as a .json file) has been requested, then do that here if HLTMonFlags.doMaM_ExtractAndDumpConfigs == True: - log.info("Will attempt to extract final trigger monitoring tool configurations and dump them to %s" % (HLTMonFlags.MaM_OutputJSON.StoredValue)) - # get updated configs for all tools, and dump them to HLTMonFlags.MaM_OutputJSON.StoredValue + log.info("Will attempt to extract final trigger monitoring tool configurations and dump them to %s" % (HLTMonFlags.MaM_OutputJSON.get_Value())) + # get updated configs for all tools, and dump them to HLTMonFlags.MaM_OutputJSON.get_Value() mam.get_current_local_info(print_output_here=False) - mam.make_default_json(HLTMonFlags.MaM_OutputJSON.StoredValue,comment="Final job config") + mam.make_default_json(HLTMonFlags.MaM_OutputJSON.get_Value(),comment="Final job config") -- GitLab