18
18
from DIRAC .Core .Utilities .List import breakListIntoChunks
19
19
from DIRAC .Core .Utilities .Dictionaries import breakDictionaryIntoChunks
20
20
from DIRAC .ConfigurationSystem .Client .Helpers .Operations import Operations
21
- from DIRAC .ConfigurationSystem .Client .Helpers .Registry import getDNForUsername , getUsernameForDN
22
21
from DIRAC .TransformationSystem .Client .FileReport import FileReport
23
22
from DIRAC .TransformationSystem .Client .WorkflowTasks import WorkflowTasks
24
23
from DIRAC .TransformationSystem .Client .TransformationClient import TransformationClient
@@ -50,7 +49,7 @@ def __init__(self, *args, **kwargs):
50
49
# credentials
51
50
self .shifterProxy = None
52
51
self .credentials = None
53
- self .credTuple = (None , None , None )
52
+ self .credTuple = (None , None )
54
53
55
54
self .pluginLocation = ""
56
55
self .bulkSubmissionFlag = False
@@ -101,17 +100,16 @@ def execute(self):
101
100
"""The execution method is transformations that need to be processed"""
102
101
103
102
# 1. determining which credentials will be used for the submission
104
- owner , ownerGroup , ownerDN = None , None , None
103
+ owner , ownerGroup = None , None
105
104
# getting the credentials for submission
106
105
resProxy = getProxyInfo (proxy = False , disableVOMS = False )
107
106
if resProxy ["OK" ]: # there is a shifterProxy
108
107
proxyInfo = resProxy ["Value" ]
109
108
owner = proxyInfo ["username" ]
110
109
ownerGroup = proxyInfo ["group" ]
111
- ownerDN = proxyInfo ["identity" ]
112
110
self .log .info (f"ShifterProxy: Tasks will be submitted with the credentials { owner } :{ ownerGroup } " )
113
111
elif self .credentials :
114
- owner , ownerGroup , ownerDN = self .credTuple
112
+ owner , ownerGroup = self .credTuple
115
113
else :
116
114
self .log .info ("Using per Transformation Credentials!" )
117
115
@@ -137,7 +135,6 @@ def execute(self):
137
135
transformations ,
138
136
owner = owner ,
139
137
ownerGroup = ownerGroup ,
140
- ownerDN = ownerDN ,
141
138
)
142
139
143
140
# 2.2. Determine whether the task files status is to be monitored and updated
@@ -159,7 +156,6 @@ def execute(self):
159
156
transformations ,
160
157
owner = owner ,
161
158
ownerGroup = ownerGroup ,
162
- ownerDN = ownerDN ,
163
159
)
164
160
165
161
# Determine whether the checking of reserved tasks is to be performed
@@ -181,7 +177,6 @@ def execute(self):
181
177
transformations ,
182
178
owner = owner ,
183
179
ownerGroup = ownerGroup ,
184
- ownerDN = ownerDN ,
185
180
)
186
181
187
182
# Determine whether the submission of tasks is to be performed
@@ -210,7 +205,6 @@ def execute(self):
210
205
transformations ,
211
206
owner = owner ,
212
207
ownerGroup = ownerGroup ,
213
- ownerDN = ownerDN ,
214
208
)
215
209
216
210
# now call _execute...
@@ -254,21 +248,21 @@ def _selectTransformations(self, transType=None, status=None, agentType=None):
254
248
255
249
#############################################################################
256
250
257
- def _getClients (self , ownerDN = None , ownerGroup = None ):
251
+ def _getClients (self , owner = None , ownerGroup = None ):
258
252
"""Returns the clients used in the threads
259
253
260
254
This is another function that should be extended.
261
255
262
256
The clients provided here are defaults, and should be adapted
263
257
264
- If ownerDN and ownerGroup are not None the clients will delegate to these credentials
258
+ If owner and ownerGroup are not None the clients will delegate to these credentials
265
259
266
- :param str ownerDN: DN of the owner of the submitted jobs
260
+ :param str owner: owner of the submitted jobs
267
261
:param str ownerGroup: group of the owner of the submitted jobs
268
262
:returns: dict of Clients
269
263
"""
270
264
threadTransformationClient = TransformationClient ()
271
- threadTaskManager = WorkflowTasks (ownerDN = ownerDN , ownerGroup = ownerGroup )
265
+ threadTaskManager = WorkflowTasks (owner = owner , ownerGroup = ownerGroup )
272
266
threadTaskManager .pluginLocation = self .pluginLocation
273
267
274
268
return {"TransformationClient" : threadTransformationClient , "TaskManager" : threadTaskManager }
@@ -279,7 +273,7 @@ def _execute(self, transDict):
279
273
clients = (
280
274
self ._getClients ()
281
275
if self .shifterProxy
282
- else self ._getClients (ownerGroup = self .credTuple [1 ], ownerDN = self .credTuple [2 ])
276
+ else self ._getClients (owner = self .credTuple [0 ], ownerGroup = self .credTuple [1 ])
283
277
if self .credentials
284
278
else None
285
279
)
@@ -293,8 +287,8 @@ def _execute(self, transDict):
293
287
transID = transDict ["TransformationID" ]
294
288
operations = transDict ["Operations" ]
295
289
if not (self .credentials or self .shifterProxy ):
296
- ownerDN , group = transDict ["OwnerDN " ], transDict ["OwnerGroup" ]
297
- clients = self ._getClients (ownerDN = ownerDN , ownerGroup = group )
290
+ owner , group = transDict ["Owner " ], transDict ["OwnerGroup" ]
291
+ clients = self ._getClients (owner = owner , ownerGroup = group )
298
292
self ._logInfo ("Start processing transformation" , method = method , transID = transID )
299
293
for operation in operations :
300
294
self ._logInfo (f"Executing { operation } " , method = method , transID = transID )
@@ -656,30 +650,28 @@ def _addOperationForTransformations(
656
650
transformations ,
657
651
owner = None ,
658
652
ownerGroup = None ,
659
- ownerDN = None ,
660
653
):
661
654
"""Fill the operationsOnTransformationDict"""
662
655
663
656
transformationIDsAndBodies = (
664
657
(
665
658
transformation ["TransformationID" ],
666
659
transformation ["Body" ],
667
- transformation ["AuthorDN " ],
660
+ transformation ["Author " ],
668
661
transformation ["AuthorGroup" ],
669
662
)
670
663
for transformation in transformations ["Value" ]
671
664
)
672
- for transID , body , t_ownerDN , t_ownerGroup in transformationIDsAndBodies :
665
+ for transID , body , t_owner , t_ownerGroup in transformationIDsAndBodies :
673
666
if transID in operationsOnTransformationDict :
674
667
operationsOnTransformationDict [transID ]["Operations" ].append (operation )
675
668
else :
676
669
operationsOnTransformationDict [transID ] = {
677
670
"TransformationID" : transID ,
678
671
"Body" : body ,
679
672
"Operations" : [operation ],
680
- "Owner" : owner if owner else getUsernameForDN ( t_ownerDN )[ "Value" ] ,
673
+ "Owner" : owner if owner else t_owner ,
681
674
"OwnerGroup" : ownerGroup if owner else t_ownerGroup ,
682
- "OwnerDN" : ownerDN if owner else t_ownerDN ,
683
675
}
684
676
685
677
def __getCredentials (self ):
@@ -696,7 +688,6 @@ def __getCredentials(self):
696
688
owner = resCred ["Value" ]["User" ]
697
689
ownerGroup = resCred ["Value" ]["Group" ]
698
690
# returns a list
699
- ownerDN = getDNForUsername (owner )["Value" ][0 ]
700
- self .credTuple = (owner , ownerGroup , ownerDN )
691
+ self .credTuple = (owner , ownerGroup )
701
692
self .log .info (f"Cred: Tasks will be submitted with the credentials { owner } :{ ownerGroup } " )
702
693
return S_OK ()
0 commit comments