stats_client.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:sawtooth-validator 作者: hyperledger-archives 项目源码 文件源码
def run_stats(url,
              stats_update_frequency=3,
              endpoint_update_frequency=30,
              csv_enable_summary=False,
              csv_enable_validator=False
              ):
    try:
        # initialize globals when we are read for stats display. This keeps
        # curses from messing up the status prints prior to stats start up.
        epm = EndpointManager()
        sm = StatsManager()  # sm assumes epm is created!

        # initialize csv stats file generation
        print "initializing csv"
        sm.csv_init(csv_enable_summary, csv_enable_validator)

        # prevent curses import from modifying normal terminal operation
        # (suppression of cr-lf) during display of help screen, config settings
        if curses_imported:
            curses.endwin()

        # discover validator endpoints; if successful, continue with startup()
        epm.initialize_endpoint_discovery(
            url,
            startup,
            {
                'loop_times': {
                    "stats": stats_update_frequency,
                    'endpoint': endpoint_update_frequency},
                'stats_man': sm,
                'ep_man': epm
            })

        reactor.run()

        sm.stats_stop()
    except Exception as e:
        if curses_imported:
            curses.endwin()
        sys.stderr.write(e)
        raise
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号