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)
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)
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)
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)
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
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)
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)
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)
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)
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)