From 1fb3e5062cbaca19b7ffe696ef89e573c64da028 Mon Sep 17 00:00:00 2001 From: Chris Burr Date: Thu, 3 Jun 2021 11:28:37 +0200 Subject: [PATCH] Improve backwards compatibility for running jobs submitted with v7r2 --- WorkloadManagementSystem/JobWrapper/JobWrapper.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/WorkloadManagementSystem/JobWrapper/JobWrapper.py b/WorkloadManagementSystem/JobWrapper/JobWrapper.py index 3d1d1dba608..710fe98d38b 100755 --- a/WorkloadManagementSystem/JobWrapper/JobWrapper.py +++ b/WorkloadManagementSystem/JobWrapper/JobWrapper.py @@ -225,7 +225,7 @@ def initialize(self, arguments): os.mkdir(str(self.jobID)) os.chdir(str(self.jobID)) extraOpts = self.jobArgs.get('ExtraOptions', '') - if extraOpts and '$DIRACROOT' in self.jobArgs.get('Executable', '').strip(): + if extraOpts and 'dirac-jobexec' in self.jobArgs.get('Executable', '').strip(): if os.path.exists('%s/%s' % (self.root, extraOpts)): shutil.copyfile('%s/%s' % (self.root, extraOpts), extraOpts) self.__loadLocalCFGFiles(self.localSiteRoot) @@ -331,6 +331,14 @@ def execute(self): # the argument should include the jobDescription.xml file jobArguments = self.jobArgs.get('Arguments', '') + # This is a workaround for Python 2 style installations + if six.PY3 and executable == "$DIRACROOT/scripts/dirac-jobexec": + self.log.warn( + 'Replaced job executable "$DIRACROOT/scripts/dirac-jobexec" with ' + '"dirac-jobexec". Please fix your submission script!' + ) + executable = "dirac-jobexec" + executable = os.path.expandvars(executable) exeThread = None spObject = None