本文整理匯總了Python中DIRAC.WorkloadManagementSystem.DB.PilotAgentsDB.PilotAgentsDB.clearPilots方法的典型用法代碼示例。如果您正苦於以下問題:Python PilotAgentsDB.clearPilots方法的具體用法?Python PilotAgentsDB.clearPilots怎麽用?Python PilotAgentsDB.clearPilots使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DIRAC.WorkloadManagementSystem.DB.PilotAgentsDB.PilotAgentsDB
的用法示例。
在下文中一共展示了PilotAgentsDB.clearPilots方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: PilotMonitorAgent
# 需要導入模塊: from DIRAC.WorkloadManagementSystem.DB.PilotAgentsDB import PilotAgentsDB [as 別名]
# 或者: from DIRAC.WorkloadManagementSystem.DB.PilotAgentsDB.PilotAgentsDB import clearPilots [as 別名]
class PilotMonitorAgent( AgentModule ):
"""
The specific agents must provide the following methods:
- initialize() for initial settings
- beginExecution()
- execute() - the main method called in the agent cycle
- endExecution()
- finalize() - the graceful exit of the method, this one is usually used
for the agent restart
"""
#############################################################################
def initialize( self ):
"""Sets defaults
"""
self.am_setOption( 'PollingTime', 120 )
self.clearPilotsDelay = self.am_getOption( 'ClearPilotsDelay', 30 )
self.clearAbortedDelay = self.am_getOption( 'ClearAbortedPilotsDelay', 7 )
self.pilotDB = PilotAgentsDB()
return S_OK()
#############################################################################
def execute( self ):
"""
Remove from PilotDB pilots that:
- are older than self.clearPilotsDelay
- are Aborted and older than self.clearAbortedDelay
"""
result = self.pilotDB.clearPilots( self.clearPilotsDelay, self.clearAbortedDelay )
if not result['OK']:
self.log.warn( 'Failed to clear old pilots in the PilotAgentsDB' )
return S_OK( 'Monitoring cycle complete.' )