stream.py 文件源码

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

项目:fastscore-cli 作者: opendatagroup 项目源码 文件源码
def inspect(connect, slot=None, verbose=False, asjson=False, **kwargs):
    n = parse_slot(slot)
    engine = connect.lookup('engine')
    if slot == None:
        if asjson:
            doc = map(lambda x: x.to_dict(), engine.active_streams.values())
            print json.dumps(doc, indent=2)
        else:
            t = [ [x.slot,x.name,transport(x.descriptor),str(x.eof)]
                        for x in engine.active_streams.values() ]
            print tabulate(t, headers=["Slot","Name","Transport","EOF"])
    elif n in engine.active_streams:
        info = engine.active_streams[n]
        if asjson:
            print json.dumps(info.to_dict(), indent=2)
        else:
            t = [[info.slot,info.name,transport(info.descriptor),str(info.eof)]]
            print tabulate(t, headers=["Slot","Name","Transport","EOF"])
    else:
        if asjson:
            print "null"
        else:
            print "No stream attached to slot %s" % slot
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号