From a2465d0d0e1951009633983c5a92eb37ac4839d2 Mon Sep 17 00:00:00 2001 From: Anfeng Li <37955849+laf070810@users.noreply.github.com> Date: Tue, 23 Apr 2024 19:45:31 +0800 Subject: [PATCH] Fix apptainer call in GaudiExec (#2329) * fix apptainer call --------- Co-authored-by: Anfeng Li Co-authored-by: Ulrik Egede --- ganga/GangaLHCb/Lib/Applications/GaudiExec.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ganga/GangaLHCb/Lib/Applications/GaudiExec.py b/ganga/GangaLHCb/Lib/Applications/GaudiExec.py index b453dcd9df..aae0a544f6 100755 --- a/ganga/GangaLHCb/Lib/Applications/GaudiExec.py +++ b/ganga/GangaLHCb/Lib/Applications/GaudiExec.py @@ -195,8 +195,8 @@ 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', + '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, @@ -569,10 +569,10 @@ def execCmd(self, cmd): 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 '\ + cmd_to_run = 'source /cvmfs/lhcb.cern.ch/lib/LbEnv && 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: + 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')