本文整理汇总了Python中mrjob.launch.MRJobLauncher.make_runner方法的典型用法代码示例。如果您正苦于以下问题:Python MRJobLauncher.make_runner方法的具体用法?Python MRJobLauncher.make_runner怎么用?Python MRJobLauncher.make_runner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mrjob.launch.MRJobLauncher
的用法示例。
在下文中一共展示了MRJobLauncher.make_runner方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_hadoop_runner
# 需要导入模块: from mrjob.launch import MRJobLauncher [as 别名]
# 或者: from mrjob.launch.MRJobLauncher import make_runner [as 别名]
def test_hadoop_runner(self):
# you can't instantiate a HadoopJobRunner without Hadoop installed
launcher = MRJobLauncher(args=["--no-conf", "-r", "hadoop", "", "--hadoop-streaming-jar", "HUNNY"])
with no_handlers_for_logger("mrjob.runner"):
with patch.dict(os.environ, {"HADOOP_HOME": "100-Acre Wood"}):
with launcher.make_runner() as runner:
self.assertIsInstance(runner, HadoopJobRunner)
示例2: test_hadoop_runner
# 需要导入模块: from mrjob.launch import MRJobLauncher [as 别名]
# 或者: from mrjob.launch.MRJobLauncher import make_runner [as 别名]
def test_hadoop_runner(self):
# you can't instantiate a HadoopJobRunner without Hadoop installed
launcher = MRJobLauncher(args=['--no-conf', '-r', 'hadoop', '',
'--hadoop-streaming-jar', 'HUNNY'])
with no_handlers_for_logger('mrjob.runner'):
with patch.dict(os.environ, {'HADOOP_HOME': '100-Acre Wood'}):
with launcher.make_runner() as runner:
self.assertIsInstance(runner, HadoopJobRunner)
示例3: test_no_file_args_required
# 需要导入模块: from mrjob.launch import MRJobLauncher [as 别名]
# 或者: from mrjob.launch.MRJobLauncher import make_runner [as 别名]
def test_no_file_args_required(self):
words1 = self.makefile('words1', b'kit and caboodle\n')
words2 = self.makefile('words2', b'baubles\nbangles and beads\n')
job = MRJobLauncher(
args=['-r', 'local', tests.sr_wc.__file__, words1, words2])
job.sandbox()
with job.make_runner() as runner:
runner.run()
lines = list(to_lines(runner.cat_output()))
self.assertEqual(len(lines), 1)
self.assertEqual(int(lines[0]), 7)
示例4: _make_launcher
# 需要导入模块: from mrjob.launch import MRJobLauncher [as 别名]
# 或者: from mrjob.launch.MRJobLauncher import make_runner [as 别名]
def _make_launcher(self, *args):
"""Make a launcher, add a mock runner (``launcher.mock_runner``), and
set it up so that ``launcher.make_runner().__enter__()`` returns
``launcher.mock_runner()``.
"""
launcher = MRJobLauncher(args=['--no-conf', ''] + list(args))
launcher.sandbox()
launcher.mock_runner = Mock()
launcher.mock_runner.stream_output.return_value = [b'a line\n']
launcher.make_runner = MagicMock() # include __enter__
launcher.make_runner.return_value.__enter__.return_value = (
launcher.mock_runner)
return launcher
示例5: test_emr_runner
# 需要导入模块: from mrjob.launch import MRJobLauncher [as 别名]
# 或者: from mrjob.launch.MRJobLauncher import make_runner [as 别名]
def test_emr_runner(self):
launcher = MRJobLauncher(args=['--no-conf', '-r', 'emr', ''])
with no_handlers_for_logger('mrjob.runner'):
with launcher.make_runner() as runner:
self.assertIsInstance(runner, EMRJobRunner)
示例6: test_emr_runner
# 需要导入模块: from mrjob.launch import MRJobLauncher [as 别名]
# 或者: from mrjob.launch.MRJobLauncher import make_runner [as 别名]
def test_emr_runner(self):
launcher = MRJobLauncher(args=["--no-conf", "-r", "emr", ""])
with no_handlers_for_logger("mrjob"):
with patch_fs_s3():
with launcher.make_runner() as runner:
self.assertIsInstance(runner, EMRJobRunner)
示例7: test_local_runner
# 需要导入模块: from mrjob.launch import MRJobLauncher [as 别名]
# 或者: from mrjob.launch.MRJobLauncher import make_runner [as 别名]
def test_local_runner(self):
launcher = MRJobLauncher(args=["--no-conf", "-r", "local", ""])
with no_handlers_for_logger("mrjob.runner"):
with launcher.make_runner() as runner:
self.assertIsInstance(runner, LocalMRJobRunner)