本文整理汇总了Python中snakebite.client.Client.stat方法的典型用法代码示例。如果您正苦于以下问题:Python Client.stat方法的具体用法?Python Client.stat怎么用?Python Client.stat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类snakebite.client.Client
的用法示例。
在下文中一共展示了Client.stat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: signature
# 需要导入模块: from snakebite.client import Client [as 别名]
# 或者: from snakebite.client.Client import stat [as 别名]
def signature(self):
client = Client(self._host, self._port, effective_user=self._user, use_trash=False)
stats = client.stat([self._partial])
if stats['file_type'] == 'f':
return "modification_time:{}".format(stats['modification_time'])
else:
return stats['file_type']
示例2: HDFSTextLoader
# 需要导入模块: from snakebite.client import Client [as 别名]
# 或者: from snakebite.client.Client import stat [as 别名]
class HDFSTextLoader(Unit, TriviallyDistributable):
def __init__(self, workflow, **kwargs):
super(HDFSTextLoader, self).__init__(workflow, **kwargs)
self.file_name = kwargs["file"]
self.chunk_lines_number = kwargs.get("chunk", 1000)
client_kwargs = dict(kwargs)
del client_kwargs["file"]
if "chunk" in kwargs:
del client_kwargs["chunk"]
self.hdfs_client = Client(**client_kwargs)
self.output = [""] * self.chunk_lines_number
self.finished = Bool()
def initialize(self):
self.debug("Opened %s", self.hdfs_client.stat([self.file_name]))
self._generator = self.hdfs_client.text([self.file_name])
def run(self):
assert not self.finished
try:
for i in range(self.chunk_lines_number):
self.output[i] = next(self._generator)
except StopIteration:
self.finished <<= True