コード例 #1
0
ファイル: test_launch.py プロジェクト: duedil-ltd/mrjob
 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
0
ファイル: test_launch.py プロジェクト: Asana/mrjob
 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
0
ファイル: test_launch.py プロジェクト: yukatherin/mrjob
 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)
コード例 #4
0
    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)
コード例 #5
0
ファイル: test_local.py プロジェクト: Affirm/mrjob
    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)
コード例 #6
0
    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
コード例 #7
0
ファイル: test_launch.py プロジェクト: DrMavenRebe/mrjob
 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)
コード例 #8
0
ファイル: test_launch.py プロジェクト: yukatherin/mrjob
 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)
コード例 #9
0
ファイル: test_launch.py プロジェクト: yukatherin/mrjob
 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)
コード例 #10
0
ファイル: test_launch.py プロジェクト: duedil-ltd/mrjob
 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)
コード例 #11
0
ファイル: test_launch.py プロジェクト: duedil-ltd/mrjob
 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)