本文整理汇总了Python中snakebite.client.Client.cat方法的典型用法代码示例。如果您正苦于以下问题:Python Client.cat方法的具体用法?Python Client.cat怎么用?Python Client.cat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类snakebite.client.Client
的用法示例。
在下文中一共展示了Client.cat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from snakebite.client import Client [as 别名]
# 或者: from snakebite.client.Client import cat [as 别名]
def test():
"""
"""
client = Client("192.168.99.100", 9000)
for f in client.ls(['/files']):
print f
for line in client.cat([f.get('path')]):
for l in line:
print l
示例2: Client
# 需要导入模块: from snakebite.client import Client [as 别名]
# 或者: from snakebite.client.Client import cat [as 别名]
# hdfs_host='100.127.6.35'
hdfs_host='100.127.13.16'
# hdfs_port=9820
hdfs_port=8020
client = Client(host=hdfs_host, port= hdfs_port, use_trash=False, effective_user='hadoop')
if len(sys.argv) < 2:
print 'inf_verification.py path'
sys.exit(0)
input_dir=sys.argv[1]
input_files=[]
for clip in client.ls([input_dir]):
if clip['file_type'] == 'd':
input_files.append(clip['path'])
for folder in sorted(input_files):
for inf in client.cat([getInf(folder)]):
for content in inf:
start=None
end=None
for aline in content.split('\n'):
if aline.startswith('startTime'):
start=aline.strip()
elif aline.startswith('endTime'):
end=aline.strip()
print '{}\t{}\t{}'.format(os.path.basename(folder),start, end)
示例3: Client
# 需要导入模块: from snakebite.client import Client [as 别名]
# 或者: from snakebite.client.Client import cat [as 别名]
#!/usr/bin/env python
from snakebite.client import Client
import time
import os
host='100.127.13.16'
port=8020
client = Client(host, port, use_trash=False)
path='/data/landing/mobileye/20180604T202528Z/BTYS7524024D1P9DGN/0197/20180406_Run2_ES8VB21_301127_Day_Rainy_CA_AEB_Collection_'
def getInf(path):
result=[]
for x in client.ls([path]):
result.append(x)
ordered=sorted(result, key=lambda x: x['path'])
for f in ordered:
if f['file_type'] == 'd':
yield os.path.join(f['path'],'EMP.inf')
for inf in getInf(path):
print inf
for content in client.cat([inf]):
for line in content:
print line