def test_owner_and_label_switches(self): runner_opts = ['--no-conf', '--owner=ads', '--label=ads_chain'] runner = MRTwoStepJob(runner_opts).make_runner() match = _JOB_KEY_RE.match(runner.get_job_key()) self.assertEqual(match.group(1), 'ads_chain') self.assertEqual(match.group(2), 'ads')
def test_auto_everything(self): test_start = datetime.datetime.utcnow() os.environ["USER"] = "******" runner = MRTwoStepJob(["--no-conf"]).make_runner() match = _JOB_KEY_RE.match(runner.get_job_key()) self.assertEqual(match.group(1), "mr_two_step_job") self.assertEqual(match.group(2), "mcp") job_start = datetime.datetime.strptime(match.group(3) + match.group(4), "%Y%m%d%H%M%S") job_start = job_start.replace(microsecond=int(match.group(5))) self.assertGreaterEqual(job_start, test_start) self.assertLessEqual(job_start - test_start, datetime.timedelta(seconds=5))
def test_auto_everything(self): test_start = datetime.datetime.utcnow() os.environ['USER'] = '******' runner = MRTwoStepJob(['--no-conf']).make_runner() match = _JOB_KEY_RE.match(runner.get_job_key()) self.assertEqual(match.group(1), 'mr_two_step_job') self.assertEqual(match.group(2), 'mcp') job_start = datetime.datetime.strptime( match.group(3) + match.group(4), '%Y%m%d%H%M%S') job_start = job_start.replace(microsecond=int(match.group(5))) self.assertGreaterEqual(job_start, test_start) self.assertLessEqual(job_start - test_start, datetime.timedelta(seconds=5))
def test_auto_label(self): runner = MRTwoStepJob(['--no-conf']).make_runner() match = _JOB_KEY_RE.match(runner.get_job_key()) self.assertEqual(match.group(1), 'mr_two_step_job') self.assertEqual(match.group(2), getpass.getuser())