Skip to content

Commit

Permalink
feat: PilotManager can interact with ElasticPilotParameters
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni committed Apr 23, 2024
1 parent 578b1be commit 0d8b501
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/DIRAC/WorkloadManagementSystem/Service/PilotManagerHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ def initializeHandler(cls, serviceInfoDict):
defaultOption, defaultClass = "DownloadPlugin", "FileCacheDownloadPlugin"
cls.configValue = getServiceOption(serviceInfoDict, defaultOption, defaultClass)
cls.loggingPlugin = None
cls.elasticPilotParametersDB = None
try:
result = ObjectLoader().loadObject(
"WorkloadManagementSystem.DB.ElasticPilotParametersDB", "ElasticPilotParametersDB"
)
if not result["OK"]:
return result
cls.elasticPilotParametersDB = result["Value"]()
except RuntimeError as excp:
return S_ERROR(f"Can't connect to DB: {excp}")

return S_OK()

##############################################################################
Expand Down Expand Up @@ -479,3 +490,15 @@ def export_deletePilots(cls, pilotIDs):
@classmethod
def export_clearPilots(cls, interval=30, aborted_interval=7):
return cls.pilotAgentsDB.clearPilots(interval, aborted_interval)

#### ElasticPilotParameters

types_setPilotParameters = [int, str, str]

@classmethod
def export_setPilotParameter(cls, pilotID, key, value):
"""Set Pilot parameters"""
if cls.elasticPilotParametersDB:
return cls.elasticPilotParametersDB.setPilotParameter(pilotID, key, value)

return S_OK()

0 comments on commit 0d8b501

Please sign in to comment.