def test_with_all_job_flows(self): self.mock_emr_job_flows.update(JOB_FLOWS_BY_ID) emr_conn = EMRJobRunner(conf_paths=[]).make_emr_conn() emr_conn.run_jobflow('no name', log_uri=None) main(['-q', '--no-conf']) lines = [line for line in StringIO(self.stdout.getvalue())] self.assertEqual(len(lines), len(JOB_FLOWS_BY_ID) - 1)
def test_attach_to_existing_job_flow(self): emr_conn = EMRJobRunner(conf_path=False).make_emr_conn() # set log_uri to None, so that when we describe the job flow, it # won't have the loguri attribute, to test Issue #112 emr_job_flow_id = emr_conn.run_jobflow( name='Development Job Flow', log_uri=None) stdin = StringIO('foo\nbar\n') self.mock_emr_output = {(emr_job_flow_id, 1): [ '1\t"bar"\n1\t"foo"\n2\tnull\n']} mr_job = MRTwoStepJob(['-r', 'emr', '-v', '-c', self.mrjob_conf_path, '--emr-job-flow-id', emr_job_flow_id]) mr_job.sandbox(stdin=stdin) results = [] with mr_job.make_runner() as runner: runner.run() # Issue 182: don't create the bootstrap script when # attaching to another job flow assert_equal(runner._master_bootstrap_script, None) for line in runner.stream_output(): key, value = mr_job.parse_output_line(line) results.append((key, value)) assert_equal(sorted(results), [(1, 'bar'), (1, 'foo'), (2, None)])
def test_with_one_job_flow(self): emr_conn = EMRJobRunner(conf_path=False).make_emr_conn() emr_conn.run_jobflow('no name', log_uri=None) main(['-q', '--no-conf']) # just make sure it doesn't crash