From 4c6fee078fdaced12c3b3c0e1b6e74677a63e57f Mon Sep 17 00:00:00 2001 From: mesmith75 Date: Fri, 12 Apr 2024 08:33:50 +0000 Subject: [PATCH] autopep8 action fixes --- ganga/GangaLHCb/Lib/Applications/GaudiExec.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ganga/GangaLHCb/Lib/Applications/GaudiExec.py b/ganga/GangaLHCb/Lib/Applications/GaudiExec.py index d00c5d54bd..10f3f207e2 100755 --- a/ganga/GangaLHCb/Lib/Applications/GaudiExec.py +++ b/ganga/GangaLHCb/Lib/Applications/GaudiExec.py @@ -195,7 +195,9 @@ class GaudiExec(IPrepareApp): 'nMakeCores': SimpleItem(defvalue=1, doc='Number of cores to be provided via the "-j" option to the "make" command'\ 'when building the ganga-input-sandbox'), - + 'apptainerBuild': SimpleItem(defvalue=False, doc="Run the build command in apptainer"), + 'containerLocation': SimpleItem(defvalue='/cvmfs/cernvm-prod.cern.ch/cvm4', + doc='Where is the container to use for the build located'), # Prepared job object 'is_prepared': SimpleItem(defvalue=None, strict_sequence=0, visitable=1, copyable=1, hidden=0, typelist=[None, ShareDir], protected=0, comparable=1, @@ -564,7 +566,18 @@ def execCmd(self, cmd): if cmd != 'make': rc, stdout, stderr = _exec_cmd(cmd_file.name, self.directory) else: - rc, stdout, stderr = _exec_cmd(cmd_file.name, self.directory) + if self.apptainerBuild or 'slc6' in self.platform: + try: + logger.info('Building inside apptainer: %s' % self.containerLocation) + cmd_to_run = 'apptainer exec --env "PATH=$PATH" --bind $PWD --bind /cvmfs:/cvmfs:ro '\ + + self.containerLocation + ' ' + cmd_file.name + rc, stdout, stderr = _exec_cmd(cmd_to_run, self.directory) + except BaseException: + logger.error('Failed to build the application inside a container. ' + 'Perhaps the specified container location is not accessible.') + raise GangaException('Failed to execute make command') + else: + rc, stdout, stderr = _exec_cmd(cmd_file.name, self.directory) if rc != 0: logger.error("Failed to execute command: %s" % cmd_file.name) logger.error("Tried to execute command in: %s" % self.directory)