From d67bcda935dc77abc1706d0e51012574ed3a133e Mon Sep 17 00:00:00 2001 From: sgaiser Date: Mon, 21 Nov 2022 12:49:18 -0800 Subject: [PATCH 1/2] fix fieldmaps issue Conflicts: python/hpsmc/tools.py --- python/hpsmc/tools.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/python/hpsmc/tools.py b/python/hpsmc/tools.py index 38d11428a..2e5e3ddf8 100644 --- a/python/hpsmc/tools.py +++ b/python/hpsmc/tools.py @@ -936,6 +936,24 @@ def cmd_args(self): args.append(self.java_class) return args + def config(self, parser): + super.config(parser) + if self.hps_fieldmaps_dir is None: + self.hps_fieldmaps_dir = "{}/share/fieldmap".format(self.hpsmc_dir) + if not os.path.isdir(self.hps_fieldmaps_dir): + raise Exception("The fieldmaps dir does not exist: {}".format(self.hps_fieldmaps_dir)) + logger.debug("Using fieldmap dir from install: {}".format(self.hps_fieldmaps_dir)) + else: + logger.debug("Using fieldmap dir from config: {}".format(self.hps_fieldmaps_dir)) + + def setup(self): + logger.debug('Creating sym link to fieldmap dir: {}'.format(self.hps_fieldmaps_dir)) + if not os.path.islink(os.getcwd() + os.path.sep + "fieldmap"): + os.symlink(self.hps_fieldmaps_dir, "fieldmap") + else: + logger.warning('Link to fieldmap dir already exists!') + + class EvioToLcio(JavaTool): """! Convert EVIO events to LCIO using the hps-java EvioToLcio command line tool. @@ -985,6 +1003,7 @@ def optional_parameters(self): def setup(self): """! Setup EvioToLcio component.""" + super.setup() if self.steering not in self.steering_files: raise Exception("Steering '%s' not found in: %s" % (self.steering, self.steering_files)) self.steering_file = self.steering_files[self.steering] From 74cac4f3da5342027414a2fc1963a9b3ad8a9666 Mon Sep 17 00:00:00 2001 From: sgaiser Date: Mon, 28 Nov 2022 16:36:53 -0800 Subject: [PATCH 2/2] add fieldmap link setup to JobManager Conflicts: python/hpsmc/tools.py --- python/hpsmc/tools.py | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/python/hpsmc/tools.py b/python/hpsmc/tools.py index 2e5e3ddf8..550825763 100644 --- a/python/hpsmc/tools.py +++ b/python/hpsmc/tools.py @@ -235,15 +235,22 @@ def config(self, parser): if os.getenv("CONDITIONS_URL", None) is not None: self.conditions_url = os.getenv("CONDITIONS_URL", None) logger.debug('Set CONDITIONS_URL from environment: {}'.format(self.hps_java_bin_jar)) + if self.hps_fieldmaps_dir is None: + self.hps_fieldmaps_dir = "{}/share/fieldmap".format(self.hpsmc_dir) + if not os.path.isdir(self.hps_fieldmaps_dir): + raise Exception("The fieldmaps dir does not exist: {}".format(self.hps_fieldmaps_dir)) + logger.debug("Using fieldmap dir from install: {}".format(self.hps_fieldmaps_dir)) + else: + logger.debug("Using fieldmap dir from config: {}".format(self.hps_fieldmaps_dir)) def required_config(self): """! Return list of required configurations. - - Required configurations are: hps_java_bin_jar + + Required configurations are: **hps_java_bin_jar**, **hps_fieldmaps_dir** @retun list of required configurations. """ - return ['hps_java_bin_jar'] + return ['hps_java_bin_jar', 'hps_fieldmaps_dir'] def setup(self): """! Setup JobManager component.""" @@ -254,6 +261,12 @@ def setup(self): raise Exception("Steering '%s' not found in: %s" % (self.steering, self.steering_files)) self.steering_file = self.steering_files[self.steering] + logger.debug('Creating sym link to fieldmap dir: {}'.format(self.hps_fieldmaps_dir)) + if not os.path.islink(os.getcwd() + os.path.sep + "fieldmap"): + os.symlink(self.hps_fieldmaps_dir, "fieldmap") + else: + logger.warning('Link to fieldmap dir already exists!') + def cmd_args(self): """! Setup command arguments. @@ -913,11 +926,11 @@ def __init__(self, name, java_class, **kwargs): def required_config(self): """! Return list of required config. - - Required config are: **hps_java_bin_jar** + + Required config are: **hps_java_bin_jar**, **hps_fieldmaps_dir** @return list of required config """ - return ['hps_java_bin_jar'] + return ['hps_java_bin_jar', 'hps_fieldmaps_dir'] def cmd_args(self): """! @@ -937,7 +950,7 @@ def cmd_args(self): return args def config(self, parser): - super.config(parser) + super().config(parser) if self.hps_fieldmaps_dir is None: self.hps_fieldmaps_dir = "{}/share/fieldmap".format(self.hpsmc_dir) if not os.path.isdir(self.hps_fieldmaps_dir): @@ -1003,7 +1016,7 @@ def optional_parameters(self): def setup(self): """! Setup EvioToLcio component.""" - super.setup() + super().setup() if self.steering not in self.steering_files: raise Exception("Steering '%s' not found in: %s" % (self.steering, self.steering_files)) self.steering_file = self.steering_files[self.steering]