コード例 #1
0
ファイル: main.py プロジェクト: pranavs18/python-agent
def main():
    if Config.setup_logger():
        _setup_logger()
    else:
        logging.basicConfig(level=logging.INFO)

    args = _args()

    Config.set_access_key(args.access_key)
    Config.set_secret_key(args.secret_key)
    Config.set_api_url(args.url)

    process_manager.init()

    plugins.load()

    log.info('API URL %s', Config.api_url())

    client = EventClient(Config.api_url(), auth=Config.api_auth(),
                         workers=args.workers, agent_id=args.agent_id)
    events = _gather_events()

    log.info("Subscribing to %s", events)

    for startup in get_type_list(LIFECYCLE):
        startup.on_startup()

    client.run(events)
    sys.exit(0)
コード例 #2
0
def main():
    if Config.setup_logger():
        _setup_logger()
    else:
        logging.basicConfig(level=logging.INFO)

    args = _args()

    Config.set_access_key(args.access_key)
    Config.set_secret_key(args.secret_key)
    Config.set_api_url(args.url)

    process_manager.init()

    plugins.load()

    log.info('API URL %s', Config.api_url())

    client = EventClient(Config.api_url(),
                         auth=Config.api_auth(),
                         workers=args.workers,
                         agent_id=args.agent_id)
    events = _gather_events()

    log.info("Subscribing to %s", events)

    for startup in get_type_list(LIFECYCLE):
        startup.on_startup()

    client.run(events)
    sys.exit(0)
コード例 #3
0
def run_agent_connect():
    client = EventClient("http://localhost:8080/v1", workers=1)
    client.run(["*agent*"])