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


Python MRTwoStepJob.run_job方法代码示例

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


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

示例1: test_python_dash_v_as_python_bin

# 需要导入模块: from tests.mr_two_step_job import MRTwoStepJob [as 别名]
# 或者: from tests.mr_two_step_job.MRTwoStepJob import run_job [as 别名]
    def test_python_dash_v_as_python_bin(self):
        python_cmd = cmd_line([sys.executable or 'python', '-v'])
        mr_job = MRTwoStepJob(['--python-bin', python_cmd, '--no-conf'])
        mr_job.sandbox(stdin=['bar\n'])

        with no_handlers_for_logger():
            mr_job.run_job()

        # expect debugging messages in stderr
        assert_in('import mrjob', mr_job.stderr.getvalue())
        assert_in('#', mr_job.stderr.getvalue())

        # should still get expected results
        assert_equal(sorted(mr_job.parse_output()), [(1, None), (1, 'bar')])
开发者ID:gimlids,项目名称:LTPM,代码行数:16,代码来源:local_test.py

示例2: test_python_dash_v_as_python_bin

# 需要导入模块: from tests.mr_two_step_job import MRTwoStepJob [as 别名]
# 或者: from tests.mr_two_step_job.MRTwoStepJob import run_job [as 别名]
    def test_python_dash_v_as_python_bin(self):
        python_cmd = cmd_line([sys.executable or 'python', '-v'])
        mr_job = MRTwoStepJob(['--python-bin', python_cmd, '--no-conf',
                               '-r', 'local'])
        mr_job.sandbox(stdin=['bar\n'])

        with no_handlers_for_logger():
            mr_job.run_job()

        # expect debugging messages in stderr
        self.assertIn('import mrjob', mr_job.stderr.getvalue())
        self.assertIn('#', mr_job.stderr.getvalue())

        # should still get expected results
        self.assertItemsEqual(mr_job.stdout.getvalue().splitlines(),
                              ['1\tnull', '1\t"bar"'])
开发者ID:Python-Z,项目名称:mrjob,代码行数:18,代码来源:test_local.py

示例3: test_python_dash_v_as_python_bin

# 需要导入模块: from tests.mr_two_step_job import MRTwoStepJob [as 别名]
# 或者: from tests.mr_two_step_job.MRTwoStepJob import run_job [as 别名]
    def test_python_dash_v_as_python_bin(self):
        python_cmd = cmd_line([sys.executable or "python", "-v"])
        mr_job = MRTwoStepJob(["--python-bin", python_cmd, "--no-conf", "-r", "local"])
        mr_job.sandbox(stdin=[b"bar\n"])

        with no_handlers_for_logger():
            mr_job.run_job()

        # expect debugging messages in stderr.
        stderr = mr_job.stderr.getvalue()

        # stderr is huge, so don't use assertIn()
        self.assertTrue(b"import mrjob" in stderr or b"import 'mrjob'" in stderr)  # Python 2  # Python 3
        self.assertTrue(b"#" in stderr)

        # should still get expected results
        self.assertEqual(sorted(mr_job.stdout.getvalue().splitlines()), sorted([b"1\tnull", b'1\t"bar"']))
开发者ID:alanhdu,项目名称:mrjob,代码行数:19,代码来源:test_local.py

示例4: test_python_dash_v_as_python_bin

# 需要导入模块: from tests.mr_two_step_job import MRTwoStepJob [as 别名]
# 或者: from tests.mr_two_step_job.MRTwoStepJob import run_job [as 别名]
    def test_python_dash_v_as_python_bin(self):
        python_cmd = cmd_line([sys.executable or 'python', '-v'])
        mr_job = MRTwoStepJob(['--python-bin', python_cmd, '--no-conf',
                               '-r', 'local'])
        mr_job.sandbox(stdin=[b'bar\n'])

        with no_handlers_for_logger():
            mr_job.run_job()

        # expect debugging messages in stderr.
        stderr = mr_job.stderr.getvalue()

        # stderr is huge, so don't use assertIn()
        self.assertTrue(b'import mrjob' in stderr or     # Python 2
                        b"import 'mrjob'" in stderr)  # Python 3
        self.assertTrue(b'#' in stderr)

        # should still get expected results
        self.assertEqual(sorted(mr_job.stdout.getvalue().splitlines()),
                         sorted([b'1\tnull', b'1\t"bar"']))
开发者ID:northaviva,项目名称:mrjob,代码行数:22,代码来源:test_local.py


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