Skip to content

Commit 108c25f

Browse files
committed
fix: WMS Utilities and scripts to py3
1 parent d64e975 commit 108c25f

14 files changed

+8
-101
lines changed

src/DIRAC/WorkloadManagementSystem/Utilities/JobParameters.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
""" DIRAC Workload Management System utility module to get available memory and processors from mjf
22
"""
3-
from __future__ import absolute_import
4-
from __future__ import division
5-
from __future__ import print_function
6-
7-
__RCSID__ = "$Id$"
8-
93
import os
104
import multiprocessing
115
from urllib.request import urlopen

src/DIRAC/WorkloadManagementSystem/Utilities/ParametricJob.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@
44
getParameterVectorLength() - to get the total size of the bunch of parametric jobs
55
generateParametricJobs() - to get a list of expanded descriptions of all the jobs
66
"""
7-
from __future__ import absolute_import
8-
from __future__ import division
9-
from __future__ import print_function
10-
11-
__RCSID__ = "$Id$"
12-
13-
import six
147
import re
158

169
from DIRAC.Core.Utilities.ClassAd.ClassAdLight import ClassAd
@@ -178,7 +171,7 @@ def generateParametricJobs(jobClassAd):
178171
attribute = "Parameter"
179172
else:
180173
attribute = "Parameter.%s" % seqID
181-
if isinstance(parameter, six.string_types) and parameter.startswith("{"):
174+
if isinstance(parameter, str) and parameter.startswith("{"):
182175
newClassAd.insertAttributeInt(attribute, str(parameter))
183176
else:
184177
newClassAd.insertAttributeString(attribute, str(parameter))

src/DIRAC/WorkloadManagementSystem/Utilities/PilotCStoJSONSynchronizer.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44
these are incorporated to the file.
55
The module uploads to a web server the latest version of the pilot scripts.
66
"""
7-
8-
from __future__ import print_function
9-
from __future__ import absolute_import
10-
from __future__ import division
11-
12-
13-
__RCSID__ = "$Id$"
14-
157
import os
168
import glob
179
import shutil
@@ -34,7 +26,6 @@ class PilotCStoJSONSynchronizer(object):
3426
- It updates a JSON file with the values on the CS which can be used by Pilot3 pilots
3527
- It updates the pilot 3 files
3628
This synchronizer can be triggered at any time via PilotCStoJSONSynchronizer().sync().
37-
As it is today, this is triggered every time there is a successful write on the CS.
3829
"""
3930

4031
def __init__(self):

src/DIRAC/WorkloadManagementSystem/Utilities/QueueUtilities.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
"""Utilities to help Computing Element Queues manipulation
22
"""
3-
4-
from __future__ import absolute_import
5-
from __future__ import division
6-
from __future__ import print_function
7-
8-
import six
93
import os
104
import hashlib
115

@@ -18,8 +12,6 @@
1812
from DIRAC.Core.Utilities.File import mkDir
1913
from DIRAC.Resources.Computing.ComputingElementFactory import ComputingElementFactory
2014

21-
__RCSID__ = "$Id$"
22-
2315

2416
def getQueuesResolved(
2517
siteDict, queueCECache, gridEnv=None, setup=None, workingDir="", checkPlatform=False, instantiateCEs=False
@@ -119,10 +111,10 @@ def resolveTags(ceDict, queueDict):
119111
"""
120112
for tagFieldName in ("Tag", "RequiredTag"):
121113
ceTags = ceDict.get(tagFieldName, [])
122-
if isinstance(ceTags, six.string_types):
114+
if isinstance(ceTags, str):
123115
ceTags = fromChar(ceTags)
124116
queueTags = queueDict.get(tagFieldName, [])
125-
if isinstance(queueTags, six.string_types):
117+
if isinstance(queueTags, str):
126118
queueTags = fromChar(queueTags)
127119
queueDict[tagFieldName] = list(set(ceTags) | set(queueTags))
128120

src/DIRAC/WorkloadManagementSystem/Utilities/Utils.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
""" Utilities for WMS
22
"""
3-
from __future__ import absolute_import
4-
from __future__ import division
5-
from __future__ import print_function
6-
73
import io
84
import os
95
import sys
106
import json
11-
import six
127

138
from DIRAC import gConfig, gLogger, S_OK, S_ERROR
149
from DIRAC.Core.Utilities.File import mkDir
@@ -30,7 +25,7 @@ def createJobWrapper(
3025
"""This method creates a job wrapper filled with the CE and Job parameters to execute the job.
3126
Main user is the JobAgent
3227
"""
33-
if isinstance(extraOptions, six.string_types) and extraOptions.endswith(".cfg"):
28+
if isinstance(extraOptions, str) and extraOptions.endswith(".cfg"):
3429
extraOptions = "--cfg %s" % extraOptions
3530

3631
arguments = {"Job": jobParams, "CE": resourceParams, "Optimizer": optimizerParams}
@@ -67,7 +62,7 @@ def createJobWrapper(
6762

6863
jobWrapperJsonFile = jobWrapperFile + ".json"
6964
with io.open(jobWrapperJsonFile, "w", encoding="utf8") as jsonFile:
70-
json.dump(six.text_type(arguments), jsonFile, ensure_ascii=False)
65+
json.dump(str(arguments), jsonFile, ensure_ascii=False)
7166

7267
with open(jobWrapperFile, "w") as wrapper:
7368
wrapper.write(wrapperTemplate)
@@ -102,7 +97,7 @@ def createRelocatedJobWrapper(
10297
"""This method creates a job wrapper for a specific job in wrapperPath,
10398
but assumes this has been reloated to rootLocation before running it.
10499
"""
105-
if isinstance(extraOptions, six.string_types) and extraOptions.endswith(".cfg") and "--cfg" not in extraOptions:
100+
if isinstance(extraOptions, str) and extraOptions.endswith(".cfg") and "--cfg" not in extraOptions:
106101
extraOptions = "--cfg %s" % extraOptions
107102

108103
arguments = {"Job": jobParams, "CE": resourceParams, "Optimizer": optimizerParams}
@@ -129,7 +124,7 @@ def createRelocatedJobWrapper(
129124

130125
jobWrapperJsonFile = jobWrapperFile + ".json"
131126
with io.open(jobWrapperJsonFile, "w", encoding="utf8") as jsonFile:
132-
json.dump(six.text_type(arguments), jsonFile, ensure_ascii=False)
127+
json.dump(str(arguments), jsonFile, ensure_ascii=False)
133128

134129
with open(jobWrapperFile, "w") as wrapper:
135130
wrapper.write(wrapperTemplate)

src/DIRAC/WorkloadManagementSystem/scripts/dirac_admin_kill_pilot.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
"""
77
Kill the specified pilot
88
"""
9-
from __future__ import absolute_import
10-
from __future__ import division
11-
from __future__ import print_function
12-
13-
__RCSID__ = "$Id$"
14-
159
import DIRAC
1610
from DIRAC.Core.Utilities.DIRACScript import DIRACScript as Script
1711

src/DIRAC/WorkloadManagementSystem/scripts/dirac_admin_pilot_logging_info.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
55
WARNING: Only one option (either uuid or jobid) should be used.
66
"""
7-
from __future__ import print_function
8-
from __future__ import absolute_import
9-
from __future__ import division
10-
11-
__RCSID__ = "$Id$"
12-
137
import DIRAC
148
from DIRAC import S_OK, gLogger
159
from DIRAC.Core.Utilities.DIRACScript import DIRACScript as Script

src/DIRAC/WorkloadManagementSystem/scripts/dirac_admin_sync_pilot.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
This is a simple script that can be used for synchronizing pilot files
44
to the current directory.
55
"""
6-
from __future__ import absolute_import
7-
from __future__ import division
8-
from __future__ import print_function
9-
10-
__RCSID__ = "$Id$"
11-
126
import os
137
import json
148
import hashlib

src/DIRAC/WorkloadManagementSystem/scripts/dirac_vm_cli.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
#!/usr/bin/env python
2-
from __future__ import print_function
3-
from __future__ import division
4-
from __future__ import absolute_import
5-
62
from DIRAC.Core.Base import Script
73
from DIRAC.Core.Utilities.DIRACScript import DIRACScript
84

src/DIRAC/WorkloadManagementSystem/scripts/dirac_vm_endpoint_status.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22
"""
33
Get VM instances available in the configured cloud sites
44
"""
5-
6-
from __future__ import print_function
7-
from __future__ import division
8-
from __future__ import absolute_import
9-
10-
__RCSID__ = "$Id$"
11-
125
from DIRAC import gLogger, exit as DIRACExit
136
from DIRAC.Core.Utilities.DIRACScript import DIRACScript as Script
147

0 commit comments

Comments
 (0)