示例#1
0
def run():
    """
    Main loop. Run this TA forever
    """

    logger.info("Start google_pubsub")
    metas, tasks = tacommon.get_configs(
        psconf.GooglePubSubConfig, "google_pubsub", logger)

    if not tasks:
        return

    loader = gcdl.GoogleDataLoaderManager(tasks)
    tacommon.setup_signal_handler(loader, logger)

    conf_change_handler = tacommon.get_file_change_handler(loader, logger)
    conf_monitor = tacommon.create_conf_monitor(
        conf_change_handler, [gpc.myta_data_collection_conf])
    loader.add_timer(conf_monitor, time.time(), 10)

    orphan_checker = opm.OrphanProcessChecker(loader.stop)
    loader.add_timer(orphan_checker.check_orphan, time.time(), 1)

    loader.start()
    logger.info("End google_pubsub")
def run():
    """
    Main loop. Run this TA forever
    """

    logger.info("Start google_cloud_monitor")
    metas, tasks = tacommon.get_configs(
        mconf.GoogleCloudMonitorConfig, "google_cloud_monitor", logger)

    if not tasks:
        return

    loader_mgr = dlm.create_data_loader_mgr(tasks[0])
    tacommon.setup_signal_handler(loader_mgr, logger)

    conf_change_handler = tacommon.get_file_change_handler(loader_mgr, logger)
    conf_monitor = tacommon.create_conf_monitor(
        conf_change_handler, [gmc.myta_data_collection_conf])
    loader_mgr.add_timer(conf_monitor, time.time(), 10)

    jobs = [gmdl.GoogleCloudMonitorDataLoader(task) for task in tasks]
    loader_mgr.start(jobs)
    logger.info("End google_cloud_monitor")