예제 #1
0
async def core():

    process_cmd_arguments()
    prepare_loggers()

    if test_collector_path is not None:
        return await test_collector.run(test_collector_path)

    proxy_processor = Processor.get_instance()

    try:
        code = await asyncio.gather(*[
            proxy_processor.worker(),
            statistics.worker(),
            materialized_view_updater.worker(),
        ])
        BaseChecker.clean()
        return code
    except KeyboardInterrupt:
        pass
    except BaseException as ex:
        main_logger.exception(ex)
        print("critical error happened, see logs/main.log")
        return 1

    return 0
예제 #2
0
async def main():
    for line in sys.stdin:
        line = line.strip()
        groups = re.search(proxy_find_regex, line).groups()
        ip = '.'.join(groups[:4])
        port = groups[4]

        tasks.append(asyncio.ensure_future(check_task(ip, port)))

    await asyncio.gather(*tasks)
    print()
    BaseChecker.clean()