@@ -69,14 +69,6 @@ def export_getCurrentPilotCounters(cls, attrDict={}):
69
69
70
70
return S_OK (resultDict )
71
71
72
- ##########################################################################################
73
- types_addPilotReferences = [list , str ]
74
-
75
- @classmethod
76
- def export_addPilotReferences (cls , pilotRef , VO , gridType = "DIRAC" , pilotStampDict = {}):
77
- """Add a new pilot job reference"""
78
- return cls .pilotAgentsDB .addPilotReferences (pilotRef , VO , gridType , pilotStampDict )
79
-
80
72
##############################################################################
81
73
types_getPilotOutput = [str ]
82
74
@@ -205,17 +197,11 @@ def _getRemotePilotOutput(self, pilotReference, pilotDict):
205
197
# return res, correct or not
206
198
return res
207
199
208
- ##############################################################################
209
- types_getPilotInfo = [[list , str ]]
210
-
211
- @classmethod
212
- def export_getPilotInfo (cls , pilotReference ):
213
- """Get the info about a given pilot job reference"""
214
- return cls .pilotAgentsDB .getPilotInfo (pilotReference )
215
200
216
201
##############################################################################
217
202
types_selectPilots = [dict ]
218
203
204
+ # Won't be moved to DiracX: not used at all anywhere.
219
205
@classmethod
220
206
def export_selectPilots (cls , condDict ):
221
207
"""Select pilots given the selection conditions"""
@@ -291,21 +277,35 @@ def export_getGroupedPilotSummary(cls, columnList):
291
277
"""
292
278
return cls .pilotAgentsDB .getGroupedPilotSummary (columnList )
293
279
294
- ##############################################################################
295
- types_getPilots = [[ str , int ] ]
280
+
281
+ types_countPilots = [dict ]
296
282
297
283
@classmethod
298
- def export_getPilots (cls , jobID ):
299
- """Get pilots executing/having executed the Job"""
300
- result = cls .pilotAgentsDB .getPilotsForJobID (int (jobID ))
301
- if not result ["OK" ] or not result ["Value" ]:
302
- return S_ERROR (f"Failed to get pilot for Job { int (jobID )} : { result .get ('Message' , '' )} " )
284
+ def export_countPilots (cls , condDict , older = None , newer = None , timeStamp = "SubmissionTime" ):
285
+ """Set the pilot agent status"""
303
286
304
- return cls .pilotAgentsDB .getPilotInfo ( pilotID = result [ "Value" ] )
287
+ return cls .pilotAgentsDB .countPilots ( condDict , older , newer , timeStamp )
305
288
306
- ##############################################################################
307
- types_setJobForPilot = [[str , int ], str ]
308
289
290
+ # --------------- Moved to DiracX ---------------
291
+
292
+ #############################################
293
+ types_addPilotReferences = [list , str ]
294
+
295
+ # Moved to DiracX
296
+ @classmethod
297
+ def export_addPilotReferences (cls , pilotStamps , VO , gridType = "DIRAC" , pilotRefDict = {}):
298
+ """Add a new pilot job reference"""
299
+ pilot_references = pilotRefDict .values ()
300
+ pilot_stamp_dict = dict (zip (pilotStamps , pilot_references ))
301
+
302
+
303
+ return cls .pilotAgentsDB .addPilotReferences (pilot_references , VO , gridType , pilot_stamp_dict )
304
+
305
+
306
+ #############################################
307
+ types_setJobForPilot = [[str , int ], str ]
308
+
309
309
@classmethod
310
310
def export_setJobForPilot (cls , jobID , pilotRef , destination = None ):
311
311
"""Report the DIRAC job ID which is executed by the given pilot job"""
@@ -321,23 +321,24 @@ def export_setJobForPilot(cls, jobID, pilotRef, destination=None):
321
321
322
322
return result
323
323
324
- ##########################################################################################
324
+ #############################################
325
325
types_setPilotBenchmark = [str , float ]
326
326
327
327
@classmethod
328
328
def export_setPilotBenchmark (cls , pilotRef , mark ):
329
329
"""Set the pilot agent benchmark"""
330
330
return cls .pilotAgentsDB .setPilotBenchmark (pilotRef , mark )
331
331
332
- ##########################################################################################
332
+ #############################################
333
333
types_setAccountingFlag = [str ]
334
334
335
335
@classmethod
336
336
def export_setAccountingFlag (cls , pilotRef , mark = "True" ):
337
337
"""Set the pilot AccountingSent flag"""
338
338
return cls .pilotAgentsDB .setAccountingFlag (pilotRef , mark )
339
339
340
- ##########################################################################################
340
+
341
+ #############################################
341
342
types_setPilotStatus = [str , str ]
342
343
343
344
@classmethod
@@ -348,22 +349,16 @@ def export_setPilotStatus(cls, pilotRef, status, destination=None, reason=None,
348
349
pilotRef , status , destination = destination , statusReason = reason , gridSite = gridSite , queue = queue
349
350
)
350
351
351
- ##########################################################################################
352
- types_countPilots = [dict ]
353
-
354
- @classmethod
355
- def export_countPilots (cls , condDict , older = None , newer = None , timeStamp = "SubmissionTime" ):
356
- """Set the pilot agent status"""
357
-
358
- return cls .pilotAgentsDB .countPilots (condDict , older , newer , timeStamp )
359
-
360
- ##########################################################################################
352
+ #############################################
361
353
types_deletePilots = [[list , str , int ]]
362
-
354
+
363
355
@classmethod
364
356
def export_deletePilots (cls , pilotIDs ):
365
357
if isinstance (pilotIDs , str ):
366
358
return cls .pilotAgentsDB .deletePilot (pilotIDs )
359
+
360
+ # And list[str]????
361
+ # pilot_id>>>S<<<
367
362
368
363
if isinstance (pilotIDs , int ):
369
364
pilotIDs = [
@@ -376,9 +371,29 @@ def export_deletePilots(cls, pilotIDs):
376
371
377
372
return S_OK ()
378
373
379
- ##############################################################################
374
+ #############################################
380
375
types_clearPilots = [int , int ]
381
376
382
377
@classmethod
383
378
def export_clearPilots (cls , interval = 30 , aborted_interval = 7 ):
384
379
return cls .pilotAgentsDB .clearPilots (interval , aborted_interval )
380
+
381
+ ##############################################################################
382
+ types_getPilots = [[str , int ]]
383
+
384
+ @classmethod
385
+ def export_getPilots (cls , jobID ):
386
+ """Get pilots executing/having executed the Job"""
387
+ result = cls .pilotAgentsDB .getPilotsForJobID (int (jobID ))
388
+ if not result ["OK" ] or not result ["Value" ]:
389
+ return S_ERROR (f"Failed to get pilot for Job { int (jobID )} : { result .get ('Message' , '' )} " )
390
+
391
+ return cls .pilotAgentsDB .getPilotInfo (pilotID = result ["Value" ])
392
+
393
+ ##############################################################################
394
+ types_getPilotInfo = [[list , str ]]
395
+
396
+ @classmethod
397
+ def export_getPilotInfo (cls , pilotReference ):
398
+ """Get the info about a given pilot job reference"""
399
+ return cls .pilotAgentsDB .getPilotInfo (pilotReference )
0 commit comments