當前位置: 首頁>>代碼示例>>Python>>正文


Python ServiceController.cleanupServices方法代碼示例

本文整理匯總了Python中agent.controllers.service.ServiceController.cleanupServices方法的典型用法代碼示例。如果您正苦於以下問題:Python ServiceController.cleanupServices方法的具體用法?Python ServiceController.cleanupServices怎麽用?Python ServiceController.cleanupServices使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在agent.controllers.service.ServiceController的用法示例。


在下文中一共展示了ServiceController.cleanupServices方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: startAgentGlobals

# 需要導入模塊: from agent.controllers.service import ServiceController [as 別名]
# 或者: from agent.controllers.service.ServiceController import cleanupServices [as 別名]
def startAgentGlobals(startThreadMgr = True, startPackageMgr = True, startAgentMonitor = True):
    """
    Create and start the global objects
    """
    # cleanup incomplete manifests
    from agent.controllers.service import ServiceController
    ServiceController.cleanupServices()

    # stop the existing agents
    stopAgentGlobals()
    
    appGlobal = pylons.config['pylons.app_globals']

    # load config override from agent .metadata.json
    configutil.loadPylonConfig(pylons.config)
    configutil.loadConfigOverrides()
    configutil.loadSecureConfigOverrides()
    LOG.info("Complete loading config overrides")

    # build in memory security token cache
    appGlobal.authztoken = str(uuid.uuid4())
    appGlobal.encryptedtokens = {}
    agentauth.buildTokenCache(appGlobal.authztoken)
    LOG.info("Complete building security token cache")

    # agent health
    appGlobal.agentHealth = 'True'
    appGlobal.agentHealthFactor = None
    from datetime import datetime
    appGlobal.agentInfo = {'version': agenthealth.loadVersion(),
                           'startup': str(datetime.now())}

    appGlobal.osInfo = agenthealth.getOsInfo()
    appGlobal.diskOk = True
    LOG.info("Agent health initialized")

    # start thread mgr
    appGlobal.threadMgr = ThreadMgr(garbageFreq = pylons.config['threadMgr_garbage_freq'],
                                    maxThreadAge = pylons.config['threadMgr_thread_age'])
    if startThreadMgr:
        appGlobal.threadMgr.start()
    LOG.info("Agent thread manager started")

    # start package mgr
    appGlobal.packageMgr = PackageMgr(garbageFreq = pylons.config['packageMgr_garbage_freq'],
                                      maxPackageAge = pylons.config['packageMgr_package_age'])
    if startPackageMgr:
        appGlobal.packageMgr.start()
    LOG.info("Agent package manager started")

    #start monitor manager
    from agent.lib.monitors.monitor import AgentMonitor
    appGlobal.agentMonitor = AgentMonitor()
    if startAgentMonitor:
        appGlobal.agentMonitor.start()
    LOG.info("Agent monitor started")
    
    # Declare dictionary for storing dynamic controllers
    appGlobal.dynacontrollers = dict()

    # metrix manager initialization
    from agent.lib.monitors.metrix_manager import MetrixManager
    from agent.lib.monitors.system_monitor import SystemMonitor
    appGlobal.metrixManager = MetrixManager()
    appGlobal.systemMonitor = SystemMonitor()

    appGlobal.metrixManager.register('Configuration', validate_internals.getConfigFileFiltered, 6)
    appGlobal.metrixManager.register('Configuration Overrides', configutil.getConfigOverrides, 7)
    appGlobal.metrixManager.register(AGENT_HEALTH_VI_KEY, lambda : appGlobal.agentHealth, 1)
    appGlobal.metrixManager.register(AGENT_HEALTH_FACTOR_VI_KEY, lambda : appGlobal.agentHealthFactor, 1)
    appGlobal.metrixManager.register(OS_INFO_KEY, lambda : appGlobal.osInfo, 3)
    appGlobal.metrixManager.register(AGENT_INFO_KEY, lambda : appGlobal.agentInfo, 2)
    LOG.info("Agent health metrics registered")
    
    # start all agent modules
    modulestartthread = threading.Thread(target = ModuleController.loadModuleOnAgentStartup)
    modulestartthread.start()
    LOG.info("Local modules started")

    # start all services with active manifest, and load dynamic controllers
    servicestartthread = threading.Thread(target = ServiceController.startServicesOnAgentStartup)
    servicestartthread.start()
    LOG.info("Local services started")

    appGlobal.sdutil = shutdownAgent
開發者ID:cronuspaas,項目名稱:cronusagent,代碼行數:87,代碼來源:agent_globals.py


注:本文中的agent.controllers.service.ServiceController.cleanupServices方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。