@Override protected void serviceInit(Configuration conf) throws Exception { Configuration config = new XLearningConfiguration(conf); config.setBoolean(Dispatcher.DISPATCHER_EXIT_ON_ERROR_KEY, true); // This is required for WebApps to use https if enabled. XLearningWebAppUtil.initialize(getConfig()); try { doSecureLogin(conf); } catch (IOException ie) { throw new YarnRuntimeException("History Server Failed to login", ie); } jobHistoryService = new JobHistory(); historyContext = (HistoryContext) jobHistoryService; stateStore = createStateStore(conf); this.jhsDTSecretManager = createJHSSecretManager(conf, stateStore); clientService = createHistoryClientService(); aggLogDelService = new AggregatedLogDeletionService(); addService(stateStore); addService(new HistoryServerSecretManagerService()); addService(clientService); addService(aggLogDelService); super.serviceInit(config); }
@Override public Path getRemoteAppLogDir(ApplicationId appId, String user) throws IOException { return LogAggregationUtils.getRemoteAppLogDir(conf, appId, user, this.remoteRootLogDir, this.remoteRootLogDirSuffix); }
public ContainerLogFileInfo(String fileName, String fileSize, String lastModifiedTime) { this.setFileName(fileName); this.setFileSize(fileSize); this.setLastModifiedTime(lastModifiedTime); }
public ContainerLogsRequest(ContainerLogsRequest request) { this.setAppId(request.getAppId()); this.setAppFinished(request.isAppFinished()); this.setAppOwner(request.getAppOwner()); this.setNodeId(request.getNodeId()); this.setNodeHttpAddress(request.getNodeHttpAddress()); this.setContainerId(request.getContainerId()); this.setOutputLocalDir(request.getOutputLocalDir()); this.setLogTypes(request.getLogTypes()); this.setBytes(request.getBytes()); this.setContainerState(request.getContainerState()); }
/** * Writes all logs for a single container to the provided writer. * @param valueStream * @param writer * @throws IOException */ public static void readAcontainerLogs(DataInputStream valueStream, Writer writer) throws IOException { readAcontainerLogs(valueStream, writer, -1); }
@Override public Void run() throws IOException { aggLogDelService.refreshLogRetentionSettings(); return null; } });
@Override public void write(LogKey logKey, LogValue logValue) throws IOException { this.writer.append(logKey, logValue); }
/** * Keep calling this till you get a {@link EOFException} for getting logs of * all types for a single container. * * @param valueStream the value stream * @param out the output print stream * @throws IOException if we can not read the container log */ public static void readAContainerLogsForALogType( DataInputStream valueStream, PrintStream out) throws IOException { readAContainerLogsForALogType(valueStream, out, -1); }
Path getRemoteNodeLogFileForApp(ApplicationId appId, String user) { return LogAggregationUtils.getRemoteNodeLogFileForApp( this.remoteRootLogDir, appId, user, this.nodeId, this.remoteRootLogDirSuffix); }
private AggregatedLogsBlockForTest getAggregatedLogsBlockForTest( Configuration configuration, String user, String containerId) { return getAggregatedLogsBlockForTest(configuration, user, containerId, "localhost:1234"); }
private int showNodeLists(ContainerLogsRequest request, LogCLIHelpers logCliHelper) throws IOException { if (!request.isAppFinished()) { System.err.println("The -list_nodes command can be only used with " + "finished applications"); return -1; } else { logCliHelper.printNodesList(request, System.out, System.err); return 0; } }
private int showContainerLogInfo(ContainerLogsRequest request, LogCLIHelpers logCliHelper) throws IOException, YarnException, ClientHandlerException, UniformInterfaceException, JSONException { if (!request.isAppFinished()) { return printContainerInfoFromRunningApplication(request, logCliHelper); } else { return logCliHelper.printAContainerLogMetadata( request, System.out, System.err); } }
/** * Writes all logs for a single container to the provided writer. * @param valueStream the value stream * @param writer the log writer * @throws IOException if we can not read the container logs. */ public static void readAcontainerLogs(DataInputStream valueStream, Writer writer) throws IOException { readAcontainerLogs(valueStream, writer, -1); }
@Override public Void run() throws IOException { aggLogDelService.refreshLogRetentionSettings(); return null; } });
/** * Get the remote application directory for log aggregation. * @param appId the Application ID * @param appOwner the Application Owner * @return the remote application directory * @throws IOException if can not find the remote application directory */ public Path getRemoteAppLogDir(ApplicationId appId, String appOwner) throws IOException { return LogAggregationUtils.getRemoteAppLogDir(conf, appId, appOwner, this.remoteRootLogDir, this.remoteRootLogDirSuffix); }
/** * Keep calling this till you get a {@link EOFException} for getting logs of * all types for a single container. * * @param valueStream * @param out * @throws IOException */ public static void readAContainerLogsForALogType( DataInputStream valueStream, PrintStream out) throws IOException { readAContainerLogsForALogType(valueStream, out, -1); }
private AggregatedLogsBlockForTest getAggregatedLogsBlockForTest( Configuration configuration, String user, String containerId) { return getAggregatedLogsBlockForTest(configuration, user, containerId, "localhost:1234"); }
/** * Writes all logs for a single container to the provided writer. * @param valueStream * @param writer * @throws IOException */ public static void readAcontainerLogs(DataInputStream valueStream, Writer writer) throws IOException { readAcontainerLogs(valueStream, writer, -1); }
@Override public Void run() throws IOException { aggLogDelService.refreshLogRetentionSettings(); return null; } });
/** * Keep calling this till you get a {@link EOFException} for getting logs of * all types for a single container. * * @param valueStream * @param out * @throws IOException */ public static void readAContainerLogsForALogType( DataInputStream valueStream, PrintStream out) throws IOException { readAContainerLogsForALogType(valueStream, out, -1); }