private void outputAMContainerLogs(ContainerLogsRequest request, Configuration conf, LogCLIHelpers logCliHelper, boolean useRegex, boolean ignoreSizeLimit) throws Exception { String nodeHttpAddress = request.getNodeHttpAddress(); String containerId = request.getContainerId(); String nodeId = request.getNodeId(); if (request.isAppFinished()) { if (containerId != null && !containerId.isEmpty()) { if (nodeId != null && !nodeId.isEmpty()) { logCliHelper.dumpAContainerLogsForLogType(request); } else { logCliHelper.dumpAContainerLogsForLogTypeWithoutNodeId( request); } } } else { if (nodeHttpAddress != null && containerId != null && !nodeHttpAddress.isEmpty() && !containerId.isEmpty()) { ContainerState containerState = getContainerReport(containerId) .getContainerState(); request.setContainerState(containerState); printContainerLogsFromRunningApplication(conf, request, logCliHelper, useRegex, ignoreSizeLimit); } } }
private List<ContainerLogsRequest> getContainersLogRequestForRunningApplication( ContainerLogsRequest options) throws YarnException, IOException { List<ContainerLogsRequest> newOptionsList = new ArrayList<ContainerLogsRequest>(); List<ContainerReport> reports = getContainerReportsFromRunningApplication(options); for (ContainerReport container : reports) { ContainerLogsRequest newOptions = new ContainerLogsRequest(options); newOptions.setContainerId(container.getContainerId().toString()); newOptions.setNodeId(container.getAssignedNode().toString()); String httpAddress = container.getNodeHttpAddress(); if (httpAddress != null && !httpAddress.isEmpty()) { newOptions.setNodeHttpAddress(httpAddress .replaceFirst(WebAppUtils.getHttpSchemePrefix(getConf()), "")); } newOptions.setContainerState(container.getContainerState()); newOptionsList.add(newOptions); } return newOptionsList; }
public ContainerLogsRequest(ApplicationId applicationId, boolean isAppFinished, String owner, String address, String httpAddress, String container, String localDir, Set<String> logs, long bytes, ContainerState containerState) { this.setAppId(applicationId); this.setAppFinished(isAppFinished); this.setAppOwner(owner); this.setNodeId(address); this.setNodeHttpAddress(httpAddress); this.setContainerId(container); this.setOutputLocalDir(localDir); this.setLogTypes(logs); this.setBytes(bytes); this.setContainerState(containerState); }
request.setContainerState(report.getContainerState()); } catch (IOException | YarnException ex) { nodeHttpAddress = getNodeHttpAddressFromRMWebString(request);
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()); }