Skip to content

Commit 363c1f3

Browse files
committed
style: mostly f-string fixes
1 parent 1cd1173 commit 363c1f3

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/DIRAC/WorkloadManagementSystem/Service/JobManagerHandler.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
from DIRAC.FrameworkSystem.Client.ProxyManagerClient import gProxyManager
2525
from DIRAC.StorageManagementSystem.Client.StorageManagerClient import StorageManagerClient
2626
from DIRAC.WorkloadManagementSystem.Client import JobStatus
27-
from DIRAC.WorkloadManagementSystem.Utilities.JobModel import JobDescriptionModel
28-
from DIRAC.WorkloadManagementSystem.Utilities.ParametricJob import generateParametricJobs, getParameterVectorLength
29-
3027
from DIRAC.WorkloadManagementSystem.Service.JobPolicy import (
3128
RIGHT_DELETE,
3229
RIGHT_KILL,
@@ -35,6 +32,7 @@
3532
RIGHT_SUBMIT,
3633
JobPolicy,
3734
)
35+
from DIRAC.WorkloadManagementSystem.Utilities.JobModel import JobDescriptionModel
3836
from DIRAC.WorkloadManagementSystem.Utilities.ParametricJob import generateParametricJobs, getParameterVectorLength
3937

4038
MAX_PARAMETRIC_JOBS = 20
@@ -160,9 +158,9 @@ def export_submitJob(self, jobDesc):
160158
if nJobs > self.maxParametricJobs:
161159
self.log.error(
162160
"Maximum of parametric jobs exceeded:",
163-
"limit %d smaller than number of jobs %d" % (self.maxParametricJobs, nJobs),
161+
f"limit {self.maxParametricJobs} smaller than number of jobs {nJobs}",
164162
)
165-
return S_ERROR(EWMSJDL, "Number of parametric jobs exceeds the limit of %d" % self.maxParametricJobs)
163+
return S_ERROR(EWMSJDL, f"Number of parametric jobs exceeds the limit of {self.maxParametricJobs}")
166164
result = generateParametricJobs(jobClassAd)
167165
if not result["OK"]:
168166
return result
@@ -407,18 +405,18 @@ def export_removeJob(self, jobIDs):
407405
for jobID in validJobList:
408406
resultTQ = self.taskQueueDB.deleteJob(jobID)
409407
if not resultTQ["OK"]:
410-
self.log.warn("Failed to remove job from TaskQueueDB", "(%d): %s" % (jobID, resultTQ["Message"]))
408+
self.log.warn("Failed to remove job from TaskQueueDB", f"({jobID}): {resultTQ['Message']}")
411409
error_count += 1
412410
else:
413411
count += 1
414412

415-
if not (result := self.jobLoggingDB.deleteJob(validJobList))["OK"]:
413+
if not self.jobLoggingDB.deleteJob(validJobList)["OK"]:
416414
self.log.error("Failed to remove jobs from JobLoggingDB", f"(n={len(validJobList)})")
417415
else:
418416
self.log.info("Removed jobs from JobLoggingDB", f"(n={len(validJobList)})")
419417

420418
if count > 0 or error_count > 0:
421-
self.log.info("Removed jobs from DB", "(%d jobs with %d errors)" % (count, error_count))
419+
self.log.info("Removed jobs from DB", f"({count} jobs with {error_count} errors)")
422420

423421
if invalidJobList or nonauthJobList:
424422
self.log.error(
@@ -522,7 +520,7 @@ def __kill_delete_jobs(self, jobIDList, right):
522520
deleteJobList = []
523521
markKilledJobList = []
524522
stagingJobList = []
525-
for jobID, sDict in result["Value"].items(): # can be an iterator
523+
for jobID, sDict in result["Value"].items():
526524
if sDict["Status"] in (JobStatus.RUNNING, JobStatus.MATCHED, JobStatus.STALLED):
527525
killJobList.append(jobID)
528526
elif sDict["Status"] in (

0 commit comments

Comments
 (0)