Exemplo n.º 1
0
    def test_no_bootstrap_script_if_not_needed(self):
        script_path = os.path.join(self.tmp_dir, 'b.py')

        runner = EMRJobRunner(conf_path=False,
                              bootstrap_mrjob=False)
        runner._create_master_bootstrap_script(dest=script_path)
        assert not os.path.exists(script_path)

        # bootstrap actions don't figure into the master bootstrap script
        runner = EMRJobRunner(conf_path=False,
                              bootstrap_mrjob=False,
                              bootstrap_actions=['foo', 'bar baz'])
        runner._create_master_bootstrap_script(dest=script_path)
        assert not os.path.exists(script_path)
Exemplo n.º 2
0
    def test_master_bootstrap_script_is_valid_python(self):
        # create a fake src tarball
        with open(os.path.join(self.tmp_dir, 'foo.py'), 'w'): pass
        yelpy_tar_gz_path = os.path.join(self.tmp_dir, 'yelpy.tar.gz')
        tar_and_gzip(self.tmp_dir, yelpy_tar_gz_path, prefix='yelpy')

        # do everything
        runner = EMRJobRunner(conf_path=False,
                              bootstrap_cmds=['echo "Hi!"', 'true', 'ls'],
                              bootstrap_files=['/tmp/quz'],
                              bootstrap_mrjob=True,
                              bootstrap_python_packages=[yelpy_tar_gz_path],
                              bootstrap_scripts=['speedups.sh', '/tmp/s.sh'])
        script_path = os.path.join(self.tmp_dir, 'b.py')
        runner._create_master_bootstrap_script(dest=script_path)

        assert os.path.exists(script_path)
        py_compile.compile(script_path)