Skip to content

Commit 6c317ce

Browse files
committed
style: ran pycodestyle plus added minor style fixes
1 parent 62bf296 commit 6c317ce

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

src/DIRAC/Resources/Computing/ARC6ComputingElement.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(self, ceUniqueID):
2727
self.computingInfoEndpoint = "org.nordugrid.ldapglue2"
2828

2929
def _reset(self):
30-
super(ARC6ComputingElement, self)._reset()
30+
super()._reset()
3131
# ComputingInfoEndpoint to get information about queues
3232
# https://www.nordugrid.org/arc/arc6/users/client_tools.html?#arcinfo
3333
# Expected values are: [

src/DIRAC/Resources/Computing/ARCComputingElement.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
import sys
4141

4242
import arc # Has to work if this module is called #pylint: disable=import-error
43-
from DIRAC import S_OK, S_ERROR, gConfig
44-
from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getCESiteMapping
43+
from DIRAC import S_OK, S_ERROR
4544
from DIRAC.Core.Utilities.Subprocess import shellCall
4645
from DIRAC.Core.Utilities.File import makeGuid
4746
from DIRAC.Core.Utilities.List import breakListIntoChunks
@@ -113,14 +112,14 @@ def _getARCJob(self, jobID):
113112
j.JobStatusURL = arc.URL(str(statURL))
114113
j.JobStatusInterfaceName = "org.nordugrid.ldapng"
115114

116-
mangURL = "gsiftp://%s:2811/jobs/" % (self.ceHost)
115+
mangURL = f"gsiftp://{self.ceHost}:2811/jobs/"
117116
j.JobManagementURL = arc.URL(str(mangURL))
118117
j.JobManagementInterfaceName = "org.nordugrid.gridftpjob"
119118

120119
j.ServiceInformationURL = j.JobManagementURL
121120
j.ServiceInformationInterfaceName = "org.nordugrid.ldapng"
122121
else:
123-
commonURL = "https://%s:8443/arex" % self.ceHost
122+
commonURL = f"https://{self.ceHost}:8443/arex"
124123
j.JobStatusURL = arc.URL(str(commonURL))
125124
j.JobStatusInterfaceName = "org.ogf.glue.emies.activitymanagement"
126125

@@ -191,7 +190,7 @@ def _writeXRSL(self, executableFile, inputs=None, outputs=None, executables=None
191190
if not isinstance(outputs, list):
192191
outputs = [outputs]
193192
for outputFile in outputs:
194-
xrslOutputs += '(%s "")' % (outputFile)
193+
xrslOutputs += f'({outputFile} "")'
195194

196195
xrsl = """
197196
&(executable="{executable}")
@@ -250,7 +249,7 @@ def _reset(self):
250249
if logLevel:
251250
arc.Logger_getRootLogger().removeDestinations()
252251
if logLevel not in self._arcLevels:
253-
self.log.warn("ARCLogLevel input is not known:", "%s not in %s" % (logLevel, self._arcLevels))
252+
self.log.warn("ARCLogLevel input is not known:", f"{logLevel} not in {self._arcLevels}")
254253
else:
255254
logstdout = arc.LogStream(sys.stdout)
256255
logstdout.setFormat(arc.ShortFormat)
@@ -272,7 +271,7 @@ def submitJob(self, executableFile, proxy, numberOfJobs=1, inputs=None, outputs=
272271
return result
273272
self.usercfg.ProxyPath(os.environ["X509_USER_PROXY"])
274273

275-
self.log.verbose("Executable file path: %s" % executableFile)
274+
self.log.verbose(f"Executable file path: {executableFile}")
276275
if not os.access(executableFile, 5):
277276
os.chmod(executableFile, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH + stat.S_IXOTH)
278277

@@ -299,8 +298,8 @@ def submitJob(self, executableFile, proxy, numberOfJobs=1, inputs=None, outputs=
299298
jobdescs = arc.JobDescriptionList()
300299
# Get the job into the ARC way
301300
xrslString, diracStamp = self._writeXRSL(executableFile, inputs, outputs, executables)
302-
self.log.debug("XRSL string submitted : %s" % xrslString)
303-
self.log.debug("DIRAC stamp for job : %s" % diracStamp)
301+
self.log.debug(f"XRSL string submitted : {xrslString}")
302+
self.log.debug(f"DIRAC stamp for job : {diracStamp}")
304303
# The arc bindings don't accept unicode objects in Python 2 so xrslString must be explicitly cast
305304
result = arc.JobDescription.Parse(str(xrslString), jobdescs)
306305
if not result:

src/DIRAC/Resources/Computing/AREXComputingElement.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
language is used in both cases. So, we retain the xrslExtraString and xrslMPExtraString strings.
55
"""
66

7-
8-
__RCSID__ = "$Id$"
9-
107
import os
118
import json
129
import requests
@@ -59,7 +56,7 @@ def _reset(self):
5956
Note : This is not run from __init__ as the design of DIRAC means that ceParameters is
6057
filled with CEDefaults only at the time this class is initialised for the given CE
6158
"""
62-
super(AREXComputingElement, self)._reset()
59+
super()._reset()
6360
self.log.debug("Testing if the REST interface is available", "for %s" % self.ceName)
6461

6562
# Get options from the ceParameters dictionary
@@ -431,10 +428,10 @@ def getCEStatus(self):
431428
result["SubmittedJobs"] = 0
432429

433430
magic = self.queue + "_" + vo.lower()
434-
for i in range(len(queueInfo)):
435-
if queueInfo[i]["ID"].endswith(magic):
436-
result["RunningJobs"] = queueInfo[i]["RunningJobs"]
437-
result["WaitingJobs"] = queueInfo[i]["WaitingJobs"]
431+
for _, qi in enumerate(queueInfo):
432+
if qi["ID"].endswith(magic):
433+
result["RunningJobs"] = qi["RunningJobs"]
434+
result["WaitingJobs"] = qi["WaitingJobs"]
438435
break # Pick the first (should be only ...) matching queue + VO
439436

440437
return result

0 commit comments

Comments
 (0)