BridgeJobRunner extends Configured implements JobRunner, EventListener { @Override public RunningJob submit() throws OdpsException { job = new BridgeJobConf(getConf()); metaExplorer = getMetaExplorer(); jobId = System.currentTimeMillis() + RandomStringUtils.randomNumeric(8); taskName = "MRonSQL_" + jobId; Validator validator = ValidatorFactory.getValidator(job, metaExplorer); validator.validate(); setUp(); Instance instance = submitInternal(); BridgeRunningJob runningJob = new BridgeRunningJob(instance, taskName, this); if (SessionState.get().isCostMode()) { runningJob.setIsCostMode(true); } return runningJob; }  @Override RunningJob submit(); @Override void onComplete();  }
@Test public void testSubmit() throws OdpsException { BridgeJobRunner runner = new BridgeJobRunner() { @Override protected Instance submitInternal() throws OdpsException { Assert.assertEquals(6, job.getResources().length); Assert.assertEquals("foo", job.getResources()[0]); Assert.assertEquals(5, aliasToTempResource.size()); return null; } @Override protected MetaExplorer getMetaExplorer() { return new MockMetaExplorer(); } }; JobConf job = new JobConf(); job.setMapperClass(WordCount.TokenizerMapper.class); job.setNumReduceTasks(0); job.setResources("foo,file:bar"); runner.setConf(job); runner.submit(); }
@Test public void testMergeStreamJobAliasResource() throws OdpsException { BridgeJobRunner runner = new BridgeJobRunner() { @Override protected Instance submitInternal() throws OdpsException { Assert.assertEquals(6+2, job.getResources().length); Assert.assertEquals("foo", job.getResources()[0]); Assert.assertEquals(5+2, aliasToTempResource.size()); return null; } @Override protected MetaExplorer getMetaExplorer() { return new MockMetaExplorer(); } }; JobConf job = new JobConf(); job.setMapperClass(WordCount.TokenizerMapper.class); job.setNumReduceTasks(0); job.setResources("foo,file:bar"); job.set( "stream.temp.resource.alias", "{\"count.py\":\"count_c1bd152b-6eef-4533-b334-bd4cb70eafe3_0.py\",\"words.py\":\"words_c1bd152b-6eef-4533-b334-bd4cb70eafe3_0.py\"}"); runner.setConf(job); runner.submit(); }