本文整理汇总了Python中mrjob.local.LocalMRJobRunner.stream_output方法的典型用法代码示例。如果您正苦于以下问题:Python LocalMRJobRunner.stream_output方法的具体用法?Python LocalMRJobRunner.stream_output怎么用?Python LocalMRJobRunner.stream_output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mrjob.local.LocalMRJobRunner
的用法示例。
在下文中一共展示了LocalMRJobRunner.stream_output方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_stream_output
# 需要导入模块: from mrjob.local import LocalMRJobRunner [as 别名]
# 或者: from mrjob.local.LocalMRJobRunner import stream_output [as 别名]
def test_stream_output(self):
a_dir_path = os.path.join(self.tmp_dir, 'a')
b_dir_path = os.path.join(self.tmp_dir, 'b')
l_dir_path = os.path.join(self.tmp_dir, '_logs')
os.mkdir(a_dir_path)
os.mkdir(b_dir_path)
os.mkdir(l_dir_path)
a_file_path = os.path.join(a_dir_path, 'part-00000')
b_file_path = os.path.join(b_dir_path, 'part-00001')
c_file_path = os.path.join(self.tmp_dir, 'part-00002')
x_file_path = os.path.join(l_dir_path, 'log.xml')
y_file_path = os.path.join(self.tmp_dir, '_SUCCESS')
with open(a_file_path, 'w') as f:
f.write('A')
with open(b_file_path, 'w') as f:
f.write('B')
with open(c_file_path, 'w') as f:
f.write('C')
with open(x_file_path, 'w') as f:
f.write('<XML XML XML/>')
with open(y_file_path, 'w') as f:
f.write('I win')
runner = LocalMRJobRunner()
runner._output_dir = self.tmp_dir
assert_equal(sorted(runner.stream_output()),
['A', 'B', 'C'])