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