YSLOG.info("I01000", batchId); long start = System.currentTimeMillis(); try { 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);
private String message(String code, Object... arguments) { assert code != null; assert arguments != null; String message = getMessage(code, arguments); return format.format(new Object[] { componentName, code, message }); }
/** * Log a message at WARN level. * @param code the message code * @param arguments the arguments * @throws IllegalArgumentException if some parameters were {@code null} */ public void warn(String code, Object... arguments) { if (internal.isWarnEnabled()) { String message = message(code, arguments); internal.warn(message); } }
private static File findCustomProfile(File file, String customProfileName) { if (customProfileName == null) { return file; } String fileName = file.getName(); int index = fileName.lastIndexOf('.'); String extension = ""; //$NON-NLS-1$ if (index >= 0) { extension = fileName.substring(index); } File result = new File(file.getParentFile(), customProfileName + extension); YSLOG.info("I01001", //$NON-NLS-1$ result); return result; }
YSLOG.info("I00001", user, host, port, privateKey); long sessionStart = System.currentTimeMillis(); session.connect((int) TimeUnit.SECONDS.toMillis(60)); long sessionEnd = System.currentTimeMillis(); YSLOG.info("I00002", user, host, port, privateKey, sessionEnd - sessionStart); try { Map<String, String> newEnv = resolveBlobs(session, environmentVariables, extensions, output); YSLOG.error(e, "E00001", user, host, port, privateKey); throw e;
private void closeFile() { try { this.file.close(); } catch (IOException e) { YSLOG.warn(e, "W41002", label, path); } }
@Override public synchronized void beginFlow(String flowId, String executionId) throws IOException { if (flowId == null) { throw new IllegalArgumentException("flowId must not be null"); //$NON-NLS-1$ } if (executionId == null) { throw new IllegalArgumentException("executionId must not be null"); //$NON-NLS-1$ } if (closed) { throw new IOException("Lock manager is already closed"); } LockObject other = flowLocks.get(flowId); if (other != null) { YSLOG.error("E41002", batchId, flowId, executionId, lockScope); throw new IOException(MessageFormat.format( "Failed to lock target flow (re-entrant): {0} ({1})", flowId, other.label)); } try { LockObject lock = acquireForFlow(flowId, executionId); if (lock != null) { flowLocks.put(flowId, lock); } } catch (IOException e) { YSLOG.error("E41002", batchId, flowId, executionId, lockScope); throw e; } }
/** * Program entry. * @param args program arguments */ public static void main(String... args) { CommandLineUtil.prepareLogContext(); YSLOG.info("I00000"); long start = System.currentTimeMillis(); int status = execute(args); long end = System.currentTimeMillis(); YSLOG.info("I00999", status, end - start); System.exit(status); }
System.out.printf(" %s%n", phase.getSymbol()); YSLOG.error(e, "E00001", Arrays.toString(args)); return 1; conf.arguments, conf.definitions, blobs); } catch (Exception e) { YSLOG.error(e, "E00002", conf); return 1; YSLOG.info("I00001", conf); switch (conf.mode) { case BATCH: YSLOG.error("E00003", conf); return 1; } catch (Exception e) { YSLOG.error(e, "E00003", conf); return 1; } finally {
private void deleteFile() { // FIXME more safe if (path.delete() == false) { YSLOG.warn("W41003", label, path); } } }
/** * Creates a new instance. * @param lockScope lock scope * @param batchId target batch ID * @param directory base directory for lock files, must exist * @throws IOException if failed to create instance * @throws IllegalArgumentException if some parameters were {@code null} */ FileExecutionLock(Scope lockScope, String batchId, File directory) throws IOException { if (lockScope == null) { throw new IllegalArgumentException("lockScope must not be null"); //$NON-NLS-1$ } if (batchId == null) { throw new IllegalArgumentException("batchId must not be null"); //$NON-NLS-1$ } if (directory == null) { throw new IllegalArgumentException("directory must not be null"); //$NON-NLS-1$ } this.lockScope = lockScope; this.batchId = batchId; this.directory = directory; this.flowLocks = new HashMap<>(); try { this.batchLock = acquireForBatch(); } catch (IOException e) { YSLOG.error("E41001", batchId, lockScope); throw e; } }
assert flow != null; assert executionId != null; YSLOG.info("I02000", batchId, flow.getId(), executionId); long start = System.currentTimeMillis(); try { if (skipFlows.contains(flow.getId())) { YSLOG.info("I02002", batchId, flow.getId(), executionId); return; executePhase(batchId, flow, executionId, ExecutionPhase.FINALIZE); } else { YSLOG.info("I02003", batchId, flow.getId(), executionId); try { executePhase(batchId, flow, executionId, ExecutionPhase.FINALIZE); } catch (Exception e) { YSLOG.warn(e, "W02002", batchId, flow.getId(), executionId); executePhase(batchId, flow, executionId, ExecutionPhase.CLEANUP); } catch (Exception e) { YSLOG.warn(e, "W02003", batchId, flow.getId(), executionId); YSLOG.info("I02001", batchId, flow.getId(), executionId); } catch (ExitCodeException e) { YSLOG.error("E02001", batchId, flow.getId(), executionId); throw e; } catch (IOException e) { YSLOG.error(e, "E02001", batchId, flow.getId(), executionId); throw e; } catch (InterruptedException e) {
private File getConfDirectory(ServiceProfile<?> profile) { assert profile != null; String value = profile.getConfiguration(KEY_DIRECTORY, true, true); File dir = new File(value); if (dir.exists() == false) { YSLOG.info("I00001", profile.getPrefix(), KEY_DIRECTORY, value); } return dir; }
private void submitScript(ExecutionContext context, JobInfo info) throws IOException, InterruptedException { assert context != null; assert info != null; YSLOG.info("I01003", info.script.getBatchId(), info.script.getFlowId(), info.client.submit(info.id); } catch (IOException e) { YSLOG.error(e, "E01002", info.script.getBatchId(), info.script.getFlowId(), YSLOG.info("I01004", info.script.getBatchId(), info.script.getFlowId(),
private static void close(InputStream c) { try { c.close(); } catch (IOException e) { YSLOG.warn(e, "W99004"); } }
private Properties loadBatchConf(ExecutionContext context, ExecutionScript script) throws IOException { assert context != null; String fileName = context.getBatchId() + SUFFIX_CONF; File file = new File(confDirectory, fileName); LOG.debug("Finding multidispatch configuration file: batchId={}, file={}", context.getBatchId(), file); if (file.isFile() == false) { LOG.debug("Missing multidispatch configuration file: batchId={}, file={}", context.getBatchId(), file); return null; } LOG.debug("Loading multidispatch configuration file: batchId={}, file={}", context.getBatchId(), file); try (InputStream in = new FileInputStream(file)) { Properties properties = new Properties(); properties.load(in); return properties; } catch (IOException e) { YSLOG.error(e, "E01001", context.getBatchId(), file.getAbsolutePath()); throw e; } }
/** * Log a message at ERROR level. * @param code the message code * @param arguments the arguments * @throws IllegalArgumentException if some parameters were {@code null} */ public void error(String code, Object... arguments) { if (internal.isErrorEnabled()) { String message = message(code, arguments); internal.error(message); } }
assert context != null; assert executions != null; YSLOG.info("I03000", context.getBatchId(), context.getFlowId(), context.getExecutionId(), context.getPhase()); long start = System.currentTimeMillis(); try { if (skipFlows.contains(context.getFlowId())) { YSLOG.info("I03002", context.getBatchId(), context.getFlowId(), context.getExecutionId(), context.getPhase()); return; YSLOG.info("I03001", context.getBatchId(), context.getFlowId(), context.getExecutionId(), context.getPhase()); } catch (ExitCodeException e) { YSLOG.error("E03001", context.getBatchId(), context.getFlowId(), context.getExecutionId(), context.getPhase()); throw e; } catch (IOException e) { YSLOG.error(e, "E03001", context.getBatchId(), context.getFlowId(), context.getExecutionId(), context.getPhase()); throw e; } catch (InterruptedException e) { YSLOG.warn(e, "W03001", context.getBatchId(), context.getFlowId(), context.getExecutionId(), context.getPhase()); throw e; } finally { long end = System.currentTimeMillis(); YSLOG.info("I03999", context.getBatchId(), context.getFlowId(), context.getExecutionId(), context.getPhase(),