当前位置: 首页>>代码示例>>Python>>正文


Python InlineMRJobRunner._output_dir方法代码示例

本文整理汇总了Python中mrjob.inline.InlineMRJobRunner._output_dir方法的典型用法代码示例。如果您正苦于以下问题:Python InlineMRJobRunner._output_dir方法的具体用法?Python InlineMRJobRunner._output_dir怎么用?Python InlineMRJobRunner._output_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mrjob.inline.InlineMRJobRunner的用法示例。


在下文中一共展示了InlineMRJobRunner._output_dir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_stream_output

# 需要导入模块: from mrjob.inline import InlineMRJobRunner [as 别名]
# 或者: from mrjob.inline.InlineMRJobRunner import _output_dir [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 = InlineMRJobRunner(conf_paths=[])
        runner._output_dir = self.tmp_dir
        self.assertEqual(sorted(runner.stream_output()),
                         ['A', 'B', 'C'])
开发者ID:nyccto,项目名称:mrjob,代码行数:35,代码来源:test_runner.py

示例2: test_stream_output

# 需要导入模块: from mrjob.inline import InlineMRJobRunner [as 别名]
# 或者: from mrjob.inline.InlineMRJobRunner import _output_dir [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 = InlineMRJobRunner(conf_paths=[])
        runner._output_dir = self.tmp_dir
        self.assertEqual(sorted(runner.stream_output()), ["A", "B", "C"])
开发者ID:superyesh,项目名称:mrjob,代码行数:34,代码来源:test_runner.py


注:本文中的mrjob.inline.InlineMRJobRunner._output_dir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。