assert context != null; assert script != null; monitor.open(100); try { monitor.checkCancelled(); JobInfo info = registerScript(monitor, context, script); monitor.progressed(5); monitor.checkCancelled(); submitScript(context, info); monitor.progressed(5); monitor.checkCancelled(); YSLOG.info("I01005", info.script.getBatchId(), break; case RUNNING: monitor.progressed(10); break; case COMPLETED: monitor.checkCancelled(); Thread.sleep(pollingInterval); monitor.close();
private void command( ExecutionMonitor monitor, ExecutionContext context, ExecutionScript script, List<String> command) throws InterruptedException, IOException { assert monitor != null; assert context != null; assert command != null; assert command.isEmpty() == false; Map<String, String> env = getEnvironmentVariables(context, script); LOG.debug("env: {}", env); LOG.debug("command: {}", command); Map<String, Blob> extensions = BlobUtil.getExtensions(context, script); LOG.debug("extensions: {}", extensions); monitor.checkCancelled(); ProcessExecutor executor = getCommandExecutor(); int exit = executor.execute(context, command, env, extensions, monitor.getOutput()); if (exit == 0) { return; } throw new ExitCodeException(MessageFormat.format( "Unexpected exit code from command job: " + "code={4} (batch={0}, flow={1}, phase={2}, exection={3})", context.getBatchId(), context.getFlowId(), context.getPhase(), context.getExecutionId(), String.valueOf(exit)), exit); }
JobScript job = convert(context, script); for (int i = 1, n = clients.count() * 2; i <= n; i++) { monitor.checkCancelled(); JobClient client = clients.get(); try {
LOG.debug("extensions: {}", extensions); monitor.checkCancelled(); ProcessExecutor executor = getCommandExecutor(); int exit = executor.execute(context, command, env, extensions, monitor.getOutput()); if (exit == 0) { return;
LOG.debug("extensions: {}", extensions); monitor.checkCancelled(); ProcessExecutor executor = getCommandExecutor(); int exit = executor.execute(context, command, env, extensions, monitor.getOutput()); if (exit == 0) { return;
/** * Cleanup the target environment. * @param monitor the progress monitor of the operation * @param context the current execution context * @throws InterruptedException if this operation is interrupted * @throws IOException if failed to setup the target environment */ public void cleanUp( ExecutionMonitor monitor, ExecutionContext context) throws InterruptedException, IOException { monitor.open(1); try { voidCleanUp(context); } finally { monitor.close(); } }
/** * Setup the target environment. * @param monitor the progress monitor of the operation * @param context the current execution context * @throws InterruptedException if this operation is interrupted * @throws IOException if failed to setup the target environment */ public void setUp( ExecutionMonitor monitor, ExecutionContext context) throws InterruptedException, IOException { monitor.open(1); try { voidSetUp(context); } finally { monitor.close(); } }
@Override public void cleanUp( ExecutionMonitor monitor, ExecutionContext context) throws InterruptedException, IOException { monitor.open(1); try { if (cleanupCommand.isEmpty() == false) { command(monitor, context, null, cleanupCommand); } else { voidCleanUp(context); } } finally { monitor.close(); } }
@Override public void cleanUp( ExecutionMonitor monitor, ExecutionContext context) throws InterruptedException, IOException { monitor.open(1); try { if (cleanup) { YSLOG.info("I51001", context.getBatchId(), context.getFlowId(), context.getExecutionId(), getHandlerId()); HadoopScript script = new HadoopScript( context.getPhase().getSymbol(), Collections.emptySet(), CLEANUP_STAGE_CLASS, Collections.emptyMap(), Collections.emptyMap()); execute0(monitor, context, script); } else { YSLOG.info("I51002", context.getBatchId(), context.getFlowId(), context.getExecutionId(), getHandlerId()); } } finally { monitor.close(); } }