本文整理汇总了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.' )