Skip to content

Commit 191c572

Browse files
committed
feat: use uuid instead of makeGuid for diracstamp
1 parent b3afbae commit 191c572

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

src/DIRAC/Resources/Computing/ARCComputingElement.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@
4848
import os
4949
import stat
5050
import sys
51+
import uuid
5152

5253
import arc # Has to work if this module is called #pylint: disable=import-error
53-
from DIRAC import S_OK, S_ERROR, gConfig
54+
from DIRAC import S_OK, S_ERROR
5455
from DIRAC.Core.Utilities.Subprocess import shellCall
55-
from DIRAC.Core.Utilities.File import makeGuid
5656
from DIRAC.Core.Utilities.List import breakListIntoChunks
5757
from DIRAC.Core.Security.ProxyInfo import getVOfromProxyGroup
5858
from DIRAC.Resources.Computing.ComputingElement import ComputingElement
@@ -188,7 +188,7 @@ def _writeXRSL(self, executableFile, inputs, outputs):
188188
:param list inputs: path of the dependencies to include along with the executable
189189
:param list outputs: path of the outputs that we want to get at the end of the execution
190190
"""
191-
diracStamp = makeGuid()[:32]
191+
diracStamp = uuid.uuid4().hex
192192
# Evaluate the number of processors to allocate
193193
nProcessors = self.ceParameters.get("NumberOfProcessors", 1)
194194

src/DIRAC/Resources/Computing/HTCondorCEComputingElement.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import errno
5353
import threading
5454
import textwrap
55+
import uuid
5556

5657
from DIRAC import S_OK, S_ERROR, gConfig
5758
from DIRAC.Resources.Computing.ComputingElement import ComputingElement
@@ -60,7 +61,6 @@
6061
from DIRAC.Core.Utilities.List import breakListIntoChunks
6162
from DIRAC.WorkloadManagementSystem.Client import PilotStatus
6263
from DIRAC.WorkloadManagementSystem.Client.PilotManagerClient import PilotManagerClient
63-
from DIRAC.Core.Utilities.File import makeGuid
6464
from DIRAC.FrameworkSystem.private.authorization.utils.Tokens import writeToTokenFile
6565
from DIRAC.Core.Security.Locations import getCAsLocation
6666
from DIRAC.Resources.Computing.BatchSystems.Condor import parseCondorStatus
@@ -300,9 +300,9 @@ def submitJob(self, executableFile, proxy, numberOfJobs=1):
300300
# The submitted pilots are going to have a common part of the stamp to construct a path to retrieve results
301301
# Then they also have an individual part to make them unique
302302
jobStamps = []
303-
commonJobStampPart = makeGuid()[:3]
303+
commonJobStampPart = uuid.uuid4().hex[:3]
304304
for _i in range(numberOfJobs):
305-
jobStamp = commonJobStampPart + makeGuid()[:29]
305+
jobStamp = commonJobStampPart + uuid.uuid4().hex[:29]
306306
jobStamps.append(jobStamp)
307307

308308
# We randomize the location of the pilot output and log, because there are just too many of them

src/DIRAC/Resources/Computing/LocalComputingElement.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,14 @@
3737
import tempfile
3838
import getpass
3939
import errno
40+
import uuid
4041
from urllib.parse import urlparse
4142

4243
from DIRAC import S_OK, S_ERROR
43-
from DIRAC import gConfig
4444

4545
from DIRAC.Resources.Computing.ComputingElement import ComputingElement
4646
from DIRAC.Resources.Computing.PilotBundle import bundleProxy, writeScript
4747
from DIRAC.Core.Utilities.List import uniqueElements
48-
from DIRAC.Core.Utilities.File import makeGuid
4948
from DIRAC.Core.Utilities.Subprocess import systemCall
5049

5150

@@ -170,7 +169,7 @@ def submitJob(self, executableFile, proxy=None, numberOfJobs=1):
170169

171170
jobStamps = []
172171
for _i in range(numberOfJobs):
173-
jobStamps.append(makeGuid()[:32])
172+
jobStamps.append(uuid.uuid4().hex)
174173

175174
batchDict = {
176175
"Executable": submitFile,

src/DIRAC/Resources/Computing/SSHComputingElement.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,16 @@
6565
import errno
6666
import json
6767
import os
68-
import pexpect
6968
import shutil
7069
import stat
70+
import uuid
7171
from urllib.parse import urlparse
7272
from urllib.parse import quote
7373
from urllib.parse import unquote
7474
from shlex import quote as shlex_quote
7575

76+
import pexpect
77+
7678
import DIRAC
7779
from DIRAC import S_OK, S_ERROR
7880
from DIRAC import gLogger
@@ -81,7 +83,6 @@
8183
from DIRAC.Resources.Computing.PilotBundle import bundleProxy, writeScript
8284
from DIRAC.Resources.Computing.BatchSystems.executeBatch import executeBatchContent
8385
from DIRAC.Core.Utilities.List import uniqueElements
84-
from DIRAC.Core.Utilities.File import makeGuid
8586
from DIRAC.Core.Utilities.List import breakListIntoChunks
8687

8788

@@ -563,7 +564,7 @@ def _submitJobToHost(self, executableFile, numberOfJobs, host=None):
563564

564565
jobStamps = []
565566
for _i in range(numberOfJobs):
566-
jobStamps.append(makeGuid()[:32])
567+
jobStamps.append(uuid.uuid4().hex)
567568

568569
numberOfProcessors = self.ceParameters.get("NumberOfProcessors", 1)
569570
wholeNode = self.ceParameters.get("WholeNode", False)

src/DIRAC/Resources/Computing/test/Test_HTCondorCEComputingElement.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"""
33
tests for HTCondorCEComputingElement module
44
"""
5+
import uuid
56
import pytest
67

78
from DIRAC.Resources.Computing import HTCondorCEComputingElement as HTCE
89
from DIRAC.Resources.Computing.BatchSystems import Condor
9-
from DIRAC.Core.Utilities.File import makeGuid
1010
from DIRAC import S_OK
1111

1212
MODNAME = "DIRAC.Resources.Computing.HTCondorCEComputingElement"
@@ -127,9 +127,9 @@ def test__writeSub(mocker, localSchedd, optionsNotExpected, optionsExpected):
127127
mocker.patch(MODNAME + ".mkDir")
128128

129129
jobStamps = []
130-
commonJobStampPart = makeGuid()[:3]
130+
commonJobStampPart = uuid.uuid4().hex[:3]
131131
for _i in range(42):
132-
jobStamp = commonJobStampPart + makeGuid()[:29]
132+
jobStamp = commonJobStampPart + uuid.uuid4().hex[:29]
133133
jobStamps.append(jobStamp)
134134

135135
htce._HTCondorCEComputingElement__writeSub("dirac-install", 42, "", 1, jobStamps) # pylint: disable=E1101

0 commit comments

Comments
 (0)