From f94c95b7f5cc59429817ce36c3ebc5cb8ddec35c Mon Sep 17 00:00:00 2001 From: fstagni Date: Fri, 20 Nov 2020 15:40:23 +0100 Subject: [PATCH] add extraOptions only when the executable is a DIRAC script --- WorkloadManagementSystem/JobWrapper/JobWrapper.py | 2 +- WorkloadManagementSystem/Utilities/Utils.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/WorkloadManagementSystem/JobWrapper/JobWrapper.py b/WorkloadManagementSystem/JobWrapper/JobWrapper.py index 52a6bc12e0a..4bec5028db3 100755 --- a/WorkloadManagementSystem/JobWrapper/JobWrapper.py +++ b/WorkloadManagementSystem/JobWrapper/JobWrapper.py @@ -215,7 +215,7 @@ def initialize(self, arguments): os.mkdir(str(self.jobID)) os.chdir(str(self.jobID)) extraOpts = self.jobArgs.get('ExtraOptions', '') - if extraOpts: + if extraOpts and '$DIRACROOT' 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) diff --git a/WorkloadManagementSystem/Utilities/Utils.py b/WorkloadManagementSystem/Utilities/Utils.py index a62f88df782..569019f83a3 100644 --- a/WorkloadManagementSystem/Utilities/Utils.py +++ b/WorkloadManagementSystem/Utilities/Utils.py @@ -5,6 +5,7 @@ import os import sys import json +import six from DIRAC import gConfig, gLogger, S_OK from DIRAC.Core.Utilities.File import mkDir @@ -17,6 +18,8 @@ def createJobWrapper(jobID, jobParams, resourceParams, optimizerParams, """ This method creates a job wrapper filled with the CE and Job parameters to execute the job. Main user is the JobAgent """ + if isinstance(extraOptions, six.string_types) and extraOptions.endswith('.cfg'): + extraOptions = '--cfg %s' % extraOptions arguments = {'Job': jobParams, 'CE': resourceParams, @@ -78,6 +81,8 @@ def createRelocatedJobWrapper(wrapperPath, rootLocation, """ This method creates a job wrapper for a specific job in wrapperPath, but assumes this has been reloated to rootLocation before running it. """ + if isinstance(extraOptions, six.string_types) and extraOptions.endswith('.cfg'): + extraOptions = '--cfg %s' % extraOptions arguments = {'Job': jobParams, 'CE': resourceParams,