@Test public void executeBatch_failed_finalize() throws Exception { ProfileBuilder prf = new ProfileBuilder(folder.getRoot()); prf.setTracker(FinalizerFailed.class); ExecutionTask task = prf.task(); try { task.executeBatch("batch"); fail(); } catch (IOException e) { } List<Record> results = SerialExecutionTracker.get(prf.trackingId); verifyPhaseOrder(results); assertThat(phase(results, "testing", ExecutionPhase.SETUP).size(), is(2)); assertThat(phase(results, "testing", ExecutionPhase.INITIALIZE).size(), is(1)); assertThat(phase(results, "testing", ExecutionPhase.IMPORT).size(), is(2)); assertThat(phase(results, "testing", ExecutionPhase.PROLOGUE).size(), is(1)); assertThat(phase(results, "testing", ExecutionPhase.MAIN).size(), is(4)); assertThat(phase(results, "testing", ExecutionPhase.EPILOGUE).size(), is(1)); assertThat(phase(results, "testing", ExecutionPhase.EXPORT).size(), is(2)); assertThat(phase(results, "testing", ExecutionPhase.FINALIZE).size(), is(1)); assertThat(phase(results, "testing", ExecutionPhase.CLEANUP).size(), is(0)); assertThat(flow(results, "left").size(), is(0)); assertThat(flow(results, "right").size(), is(0)); assertThat(flow(results, "last").size(), is(0)); }
public void executeBatch(String batchId) throws InterruptedException, IOException { if (batchId == null) { throw new IllegalArgumentException("batchId must not be null"); } ExecutorService executor = createJobflowExecutor(batchId); YSLOG.info("I01000", batchId); long start = System.currentTimeMillis(); try { try (ExecutionLock lock = acquireExecutionLock(batchId)) { BatchScheduler batchScheduler = new BatchScheduler(batchId, script, lock, executor); batchScheduler.run(); } YSLOG.info("I01001", batchId); } catch (ExitCodeException e) { YSLOG.error("E01001", batchId); throw e; } catch (IOException e) { YSLOG.error(e, "E01001", batchId); throw e; } catch (InterruptedException e) { YSLOG.warn(e, "W01001", batchId); throw e; } finally { long end = System.currentTimeMillis(); YSLOG.info("I01999", batchId, end - start); } }
ExecutionTask { public void executeBatch(String batchId) throws InterruptedException, IOException { if (batchId == null) { throw new IllegalArgumentException("batchId must not be null"); } ExecutorService executor = createJobflowExecutor(batchId); YSLOG.info("I01000", batchId); long start = System.currentTimeMillis(); try { try (ExecutionLock lock = acquireExecutionLock(batchId)) { BatchScheduler batchScheduler = new BatchScheduler(batchId, script, lock, executor); batchScheduler.run(); } YSLOG.info("I01001", batchId); } catch (ExitCodeException e) { YSLOG.error("E01001", batchId); throw e; } catch (IOException e) { YSLOG.error(e, "E01001", batchId); throw e; } catch (InterruptedException e) { YSLOG.warn(e, "W01001", batchId); throw e; } finally { long end = System.currentTimeMillis(); YSLOG.info("I01999", batchId, end - start); } } }
ExecutionTask { public void executeBatch(String batchId) throws InterruptedException, IOException { if (batchId == null) { throw new IllegalArgumentException("batchId must not be null"); } ExecutorService executor = createJobflowExecutor(batchId); YSLOG.info("I01000", batchId); long start = System.currentTimeMillis(); try { try (ExecutionLock lock = acquireExecutionLock(batchId)) { BatchScheduler batchScheduler = new BatchScheduler(batchId, script, lock, executor); batchScheduler.run(); } YSLOG.info("I01001", batchId); } catch (ExitCodeException e) { YSLOG.error("E01001", batchId); throw e; } catch (IOException e) { YSLOG.error(e, "E01001", batchId); throw e; } catch (InterruptedException e) { YSLOG.warn(e, "W01001", batchId); throw e; } finally { long end = System.currentTimeMillis(); YSLOG.info("I01999", batchId, end - start); } } ExecutionTask(
            ExecutionMonitorProvider monitors,
            ExecutionLockProvider locks,
            JobScheduler scheduler,
            HadoopScriptHandler hadoopHandler,
            Map<String, CommandScriptHandler> commandHandlers,
            BatchScript script,
            Map<String, String> batchArguments,
            Map<String, Blob> extensions); }
ExecutionTask { public void executeBatch(String batchId) throws InterruptedException, IOException { if (batchId == null) { throw new IllegalArgumentException("batchId must not be null"); } ExecutorService executor = createJobflowExecutor(batchId); YSLOG.info("I01000", batchId); long start = System.currentTimeMillis(); try { try (ExecutionLock lock = acquireExecutionLock(batchId)) { BatchScheduler batchScheduler = new BatchScheduler(batchId, script, lock, executor); batchScheduler.run(); } YSLOG.info("I01001", batchId); } catch (ExitCodeException e) { YSLOG.error("E01001", batchId); throw e; } catch (IOException e) { YSLOG.error(e, "E01001", batchId); throw e; } catch (InterruptedException e) { YSLOG.warn(e, "W01001", batchId); throw e; } finally { long end = System.currentTimeMillis(); YSLOG.info("I01999", batchId, end - start); } } ExecutionTask(
            ExecutionMonitorProvider monitors,
            ExecutionLockProvider locks,
            JobScheduler scheduler,
            HadoopScriptHandler hadoopHandler,
            Map<String, CommandScriptHandler> commandHandlers,
            BatchScript script,
            Map<String, String> batchArguments,
            Map<String, Blob> extensions); static ExecutionTask load(
            YaessProfile profile,
            Properties script,
            Map<String, String> batchArguments); static ExecutionTask load(
            YaessProfile profile,
            Properties script,
            Map<String, String> batchArguments,
            Map<String, String> yaessArguments); static ExecutionTask load(
            YaessProfile profile,
            Properties script,
            Map<String, String> batchArguments,
            Map<String, String> yaessArguments,
            Map<String, Blob> extensions); void executeBatch(String batchId); void executeFlow(
            String batchId,
            String flowId,
            String executionId); void executePhase(
            String batchId,
            String flowId,
            String executionId,
            ExecutionPhase phase); void executePhase(ExecutionContext context); }
ExecutionTask { public void executeBatch(String batchId) throws InterruptedException, IOException { if (batchId == null) { throw new IllegalArgumentException("batchId must not be null"); } ExecutorService executor = createJobflowExecutor(batchId); YSLOG.info("I01000", batchId); long start = System.currentTimeMillis(); try { try (ExecutionLock lock = acquireExecutionLock(batchId)) { BatchScheduler batchScheduler = new BatchScheduler(batchId, script, lock, executor); batchScheduler.run(); } YSLOG.info("I01001", batchId); } catch (ExitCodeException e) { YSLOG.error("E01001", batchId); throw e; } catch (IOException e) { YSLOG.error(e, "E01001", batchId); throw e; } catch (InterruptedException e) { YSLOG.warn(e, "W01001", batchId); throw e; } finally { long end = System.currentTimeMillis(); YSLOG.info("I01999", batchId, end - start); } } ExecutionTask(
            ExecutionMonitorProvider monitors,
            ExecutionLockProvider locks,
            JobScheduler scheduler,
            HadoopScriptHandler hadoopHandler,
            Map<String, CommandScriptHandler> commandHandlers,
            BatchScript script,
            Map<String, String> batchArguments,
            Map<String, Blob> extensions); static ExecutionTask load(
            YaessProfile profile,
            Properties script,
            Map<String, String> batchArguments); static ExecutionTask load(
            YaessProfile profile,
            Properties script,
            Map<String, String> batchArguments,
            Map<String, String> yaessArguments); static ExecutionTask load(
            YaessProfile profile,
            Properties script,
            Map<String, String> batchArguments,
            Map<String, String> yaessArguments,
            Map<String, Blob> extensions); void executeBatch(String batchId); void executeFlow(
            String batchId,
            String flowId,
            String executionId); void executePhase(
            String batchId,
            String flowId,
            String executionId,
            ExecutionPhase phase); void executePhase(ExecutionContext context);  }