diff --git a/Pilot/pilotCommands.py b/Pilot/pilotCommands.py index 6505f2f4..2ae6fca3 100644 --- a/Pilot/pilotCommands.py +++ b/Pilot/pilotCommands.py @@ -28,7 +28,6 @@ def __init__(self, pilotParams): import sys import time from collections import Counter -from distutils.version import LooseVersion ############################ # python 2 -> 3 "hacks" @@ -640,8 +639,7 @@ def execute(self): pilotOwnerGroup = self.pp.userGroup if self.pp.localConfigFile: - if LooseVersion(self.releaseVersion) >= self.cfgOptionDIRACVersion: - self.cfg.append("--cfg") + self.cfg.append("--cfg") self.cfg.append(self.pp.localConfigFile) # this file is as input checkCmd = "dirac-admin-add-pilot %s %s %s %s --status=Running %s -d" % ( @@ -674,8 +672,7 @@ def execute(self): if self.pp.useServerCertificate: self.cfg.append("-o /DIRAC/Security/UseServerCertificate=yes") if self.pp.localConfigFile: - if LooseVersion(self.releaseVersion) >= self.cfgOptionDIRACVersion: - self.cfg.append("--cfg") + self.cfg.append("--cfg") self.cfg.append(self.pp.localConfigFile) # this file is as input # Get the resource description as defined in its configuration @@ -751,8 +748,7 @@ def execute(self): if self.pp.useServerCertificate: self.cfg.append("-o /DIRAC/Security/UseServerCertificate=yes") if self.pp.localConfigFile: - if LooseVersion(self.releaseVersion) >= self.cfgOptionDIRACVersion: - self.cfg.append("--cfg") + self.cfg.append("--cfg") self.cfg.append(self.pp.localConfigFile) # this file is as input # Get the worker node parameters checkCmd = "dirac-wms-get-wn-parameters -S %s -N %s -Q %s %s -d" % ( @@ -827,8 +823,7 @@ def execute(self): if self.pp.localConfigFile: self.cfg.append("-O %s" % self.pp.localConfigFile) # this file is as output - if LooseVersion(self.releaseVersion) >= self.cfgOptionDIRACVersion: - self.cfg.append("--cfg") + self.cfg.append("--cfg") self.cfg.append(self.pp.localConfigFile) # this file is as input if self.debugFlag: @@ -885,8 +880,7 @@ def execute(self): self.cfg.append("-FDMH") if self.pp.localConfigFile: self.cfg.append("-O %s" % self.pp.localConfigFile) - if LooseVersion(self.releaseVersion) >= self.cfgOptionDIRACVersion: - self.cfg.append("--cfg") + self.cfg.append("--cfg") self.cfg.append(self.pp.localConfigFile) if self.debugFlag: @@ -918,8 +912,7 @@ def execute(self): if self.pp.useServerCertificate: cfg.append("-o /DIRAC/Security/UseServerCertificate=yes") if self.pp.localConfigFile: - if LooseVersion(self.releaseVersion) >= self.cfgOptionDIRACVersion: - cfg.append("--cfg") + cfg.append("--cfg") cfg.append(self.pp.localConfigFile) # this file is as input architectureCmd = "%s %s -d" % (self.pp.architectureScript, " ".join(cfg)) @@ -936,8 +929,7 @@ def execute(self): cfg.append("--UseServerCertificate") if self.pp.localConfigFile: cfg.append("-O %s" % self.pp.localConfigFile) # our target file for pilots - if LooseVersion(self.releaseVersion) >= self.cfgOptionDIRACVersion: - cfg.append("--cfg") + cfg.append("--cfg") cfg.append(self.pp.localConfigFile) # this file is also an input if self.pp.debugFlag: cfg.append("-ddd") @@ -971,10 +963,7 @@ def execute(self): if self.pp.useServerCertificate: configFileArg = "-o /DIRAC/Security/UseServerCertificate=yes" if self.pp.localConfigFile: - if LooseVersion(self.releaseVersion) >= self.cfgOptionDIRACVersion: - configFileArg = "%s -R %s --cfg %s" % (configFileArg, self.pp.localConfigFile, self.pp.localConfigFile) - else: - configFileArg = "%s -R %s %s" % (configFileArg, self.pp.localConfigFile, self.pp.localConfigFile) + configFileArg = "%s -R %s --cfg %s" % (configFileArg, self.pp.localConfigFile, self.pp.localConfigFile) retCode, cpuNormalizationFactorOutput = self.executeAndGetOutput( "dirac-wms-cpu-normalization -U %s -d" % configFileArg, self.pp.installEnv ) @@ -996,10 +985,7 @@ def execute(self): configFileArg = "" if self.pp.useServerCertificate: configFileArg = "-o /DIRAC/Security/UseServerCertificate=yes" - if LooseVersion(self.releaseVersion) >= self.cfgOptionDIRACVersion: - cfgFile = "--cfg %s" % self.pp.localConfigFile - else: - cfgFile = self.pp.localConfigFile + cfgFile = "--cfg %s" % self.pp.localConfigFile retCode, cpuTimeOutput = self.executeAndGetOutput( "dirac-wms-get-queue-cpu-time --CPUNormalizationFactor=%f %s %s -d" % (cpuNormalizationFactor, configFileArg, cfgFile), @@ -1030,8 +1016,7 @@ def execute(self): cfg.append("-o /DIRAC/Security/UseServerCertificate=yes") if self.pp.localConfigFile: cfg.append("-O %s" % self.pp.localConfigFile) # our target file for pilots - if LooseVersion(self.releaseVersion) >= self.cfgOptionDIRACVersion: - cfg.append("--cfg") + cfg.append("--cfg") cfg.append(self.pp.localConfigFile) # this file is also input cfg.append("-o /LocalSite/CPUTimeLeft=%s" % str(int(self.pp.jobCPUReq))) # the only real option @@ -1103,8 +1088,7 @@ def __setInnerCEOpts(self): # The file pilot.cfg has to be created previously by ConfigureDIRAC if self.pp.localConfigFile: self.innerCEOpts.append(" -o /AgentJobRequirements/ExtraOptions=%s" % self.pp.localConfigFile) - if LooseVersion(self.releaseVersion) >= self.cfgOptionDIRACVersion: - self.innerCEOpts.append("--cfg") + self.innerCEOpts.append("--cfg") self.innerCEOpts.append(self.pp.localConfigFile) def __startJobAgent(self): @@ -1118,8 +1102,7 @@ def __startJobAgent(self): for i in os.listdir(self.pp.rootPath): cfg = os.path.join(self.pp.rootPath, i) if os.path.isfile(cfg) and cfg.endswith(".cfg") and not filecmp.cmp(self.pp.localConfigFile, cfg): - if LooseVersion(self.releaseVersion) >= self.cfgOptionDIRACVersion: - extraCFG.append("--cfg") + extraCFG.append("--cfg") extraCFG.append(cfg) if self.pp.executeCmd: @@ -1210,8 +1193,7 @@ def __setInProcessOpts(self): # The file pilot.cfg has to be created previously by ConfigureDIRAC if self.pp.localConfigFile: self.inProcessOpts.append(" -o /AgentJobRequirements/ExtraOptions=%s" % self.pp.localConfigFile) - if LooseVersion(self.releaseVersion) >= self.cfgOptionDIRACVersion: - self.inProcessOpts.append("--cfg") + self.inProcessOpts.append("--cfg") self.inProcessOpts.append(self.pp.localConfigFile) def __startJobAgent(self): diff --git a/Pilot/pilotTools.py b/Pilot/pilotTools.py index 6fd97d6a..aab42654 100644 --- a/Pilot/pilotTools.py +++ b/Pilot/pilotTools.py @@ -628,21 +628,6 @@ def __init__(self, pilotParams, dummy=""): self.log.debug("Initialized command %s" % self.__class__.__name__) self.log.debug("pilotParams option list: %s" % self.pp.optList) - self.cfgOptionDIRACVersion = self._getCFGOptionDIRACVersion() - - def _getCFGOptionDIRACVersion(self): - """Convenience method. - - Reference vanilla DIRAC version from when we ask to use --cfg for cfg files - - For extensions: the only way to know the vanilla DIRAC version - is to check releases.cfg. Not impossible, but cumbersome to do here. - Extensions could replace this function. - """ - if not self.pp.releaseProject: - return LooseVersion(parseVersion("v7r0p29", self.pp.pythonVersion == "27")) - # just a trick to always evaluate comparisons in pilotCommands to False - return LooseVersion("z") if self.pp.pythonVersion == "27" else LooseVersion("1000") def executeAndGetOutput(self, cmd, environDict=None): """Execute a command on the worker node and get the output"""