From 033d8386fc8451ef230d3dea7e4e382303f985e0 Mon Sep 17 00:00:00 2001 From: Abraham Tishelman-Charny Date: Wed, 31 Jan 2024 02:41:35 -0500 Subject: [PATCH 1/3] Adding protection in all_invariant_masses computation --- analyzers/dataframe/src/JetConstituentsUtils.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/analyzers/dataframe/src/JetConstituentsUtils.cc b/analyzers/dataframe/src/JetConstituentsUtils.cc index 0fead9fa72e..f339920219c 100644 --- a/analyzers/dataframe/src/JetConstituentsUtils.cc +++ b/analyzers/dataframe/src/JetConstituentsUtils.cc @@ -1269,6 +1269,8 @@ namespace FCCAnalyses rv::RVec InvariantMasses; + if(AllJets.size() < 2) return InvariantMasses; + // For each jet, take its invariant mass with the remaining jets. Stop at last jet. for(int i = 0; i < AllJets.size()-1; ++i) { From cb50159da3528880beacee8e017c0b9bdc3d03e0 Mon Sep 17 00:00:00 2001 From: Abraham Tishelman-Charny Date: Wed, 31 Jan 2024 03:47:26 -0500 Subject: [PATCH 2/3] Setting default working area for each condor job to its log directory --- python/run_analysis.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/python/run_analysis.py b/python/run_analysis.py index c65d36a69df..c8506e69555 100644 --- a/python/run_analysis.py +++ b/python/run_analysis.py @@ -102,6 +102,7 @@ def create_subjob_script(local_dir: str, process_name: str, chunk_num: int, chunk_list: list[list[str]], + log_dir: str, anapath: str) -> str: ''' Creates sub-job script to be run. @@ -114,6 +115,7 @@ def create_subjob_script(local_dir: str, scr = '#!/bin/bash\n\n' scr += 'source ' + local_dir + '/setup.sh\n\n' + scr += 'cd ' + log_dir + ' \n' # add userBatchConfig if any if user_batch_config != '': @@ -344,18 +346,15 @@ def run_rdf(rdf_module, # _____________________________________________________________________________ -def send_to_batch(rdf_module, chunk_list, process, anapath: str): +def send_to_batch(rdf_module, chunk_list, process, log_dir, anapath: str): ''' Send jobs to HTCondor batch system. ''' - local_dir = os.environ['LOCAL_DIR'] - current_date = datetime.datetime.fromtimestamp( - datetime.datetime.now().timestamp()).strftime('%Y-%m-%d_%H-%M-%S') - log_dir = os.path.join(local_dir, 'BatchOutputs', current_date, process) - if not os.path.exists(log_dir): - os.system(f'mkdir -p {log_dir}') + local_dir = os.environ['LOCAL_DIR'] + # Making sure the FCCAnalyses libraries are compiled and installed + try: subprocess.check_output(['make', 'install'], cwd=local_dir+'/build', @@ -380,6 +379,7 @@ def send_to_batch(rdf_module, chunk_list, process, anapath: str): process, ch, chunk_list, + log_dir, anapath) ofile.write(subjob_script) except IOError as e: @@ -659,11 +659,19 @@ def run_stages(args, rdf_module, anapath): if run_batch: # Sending to the batch system LOGGER.info('Running on the batch...') + if len(chunk_list) == 1: LOGGER.warning('\033[4m\033[1m\033[91mRunning on batch with ' 'only one chunk might not be optimal\033[0m') - send_to_batch(rdf_module, chunk_list, process_name, anapath) + local_dir = os.environ['LOCAL_DIR'] + current_date = datetime.datetime.fromtimestamp( + datetime.datetime.now().timestamp()).strftime('%Y-%m-%d_%H-%M-%S') + log_dir = os.path.join(local_dir, 'BatchOutputs', current_date, process_name) + if not os.path.exists(log_dir): + os.system(f'mkdir -p {log_dir}') + + send_to_batch(rdf_module, chunk_list, process_name, log_dir, anapath) else: # Running locally From 34e31094923e9920a502de6b6346e5a8dac7aed0 Mon Sep 17 00:00:00 2001 From: Abraham Tishelman-Charny Date: Wed, 31 Jan 2024 03:48:36 -0500 Subject: [PATCH 3/3] Reverting change to keep PRs with separate changes to master --- analyzers/dataframe/src/JetConstituentsUtils.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/analyzers/dataframe/src/JetConstituentsUtils.cc b/analyzers/dataframe/src/JetConstituentsUtils.cc index f339920219c..0fead9fa72e 100644 --- a/analyzers/dataframe/src/JetConstituentsUtils.cc +++ b/analyzers/dataframe/src/JetConstituentsUtils.cc @@ -1269,8 +1269,6 @@ namespace FCCAnalyses rv::RVec InvariantMasses; - if(AllJets.size() < 2) return InvariantMasses; - // For each jet, take its invariant mass with the remaining jets. Stop at last jet. for(int i = 0; i < AllJets.size()-1; ++i) {