in = secureOpenFile(logFile); } catch (IOException e) { logErrorMessage(logFile, e); IOUtils.cleanup(LOG, in); continue; String message = logErrorMessage(logFile, e); out.write(message.getBytes(Charset.forName("UTF-8"))); } finally {
@Override public boolean apply(String next) { return logValue.getAllExistingFilesMeta().contains(next); } });
private Set<File> getPendingLogFilesToUpload(File containerLogDir) { Set<File> candidates = new HashSet<File>(Arrays.asList(containerLogDir.listFiles())); for (File logFile : candidates) { this.allExistingFileMeta.add(getLogFileMetaData(logFile)); } if (this.logAggregationContext != null && candidates.size() > 0) { filterFiles( this.appFinished ? this.logAggregationContext.getIncludePattern() : this.logAggregationContext.getRolledLogsIncludePattern(), candidates, false); filterFiles( this.appFinished ? this.logAggregationContext.getExcludePattern() : this.logAggregationContext.getRolledLogsExcludePattern(), candidates, true); Iterable<File> mask = Iterables.filter(candidates, new Predicate<File>() { @Override public boolean apply(File next) { return !alreadyUploadedLogFiles .contains(getLogFileMetaData(next)); } }); candidates = Sets.newHashSet(mask); } return candidates; }
new LogValue(Collections.singletonList(srcFileRoot.toString()), testContainerId, ugi.getShortUserName()); File errorFile = new File((new Path(srcFilePath, "stderr")).toString()); doThrow(new IOException("Mock can not open FileInputStream")).when( spyLogValue).secureOpenFile(errorFile);
new LogValue(Collections.singletonList(srcFileRoot.toString()), testContainerId, ugi.getShortUserName()); File errorFile = new File((new Path(srcFilePath, "stderr")).toString()); doThrow(new IOException("Mock can not open FileInputStream")).when( spyLogValue).secureOpenFile(errorFile);
LogKey logKey = new LogKey(testContainerId); LogValue logValue = new LogValue(Collections.singletonList(srcFileRoot.toString()), testContainerId, ugi.getShortUserName(),ugi.getShortUserName()); File errorFile = new File((new Path(srcFilePath, "stderr")).toString()); doThrow(new IOException("Mock can not open FileInputStream")).when( spyLogValue).secureOpenFile(errorFile);
String containerId = logKey.toString(); Set<File> pendingUploadFiles = logValue .getPendingLogFilesToUploadForThisContainer(); List<IndexedFileLogMeta> metas = new ArrayList<>(); for (File logFile : pendingUploadFiles) { FileInputStream in = null; try { in = SecureIOUtils.openForRead(logFile, logValue.getUser(), null); } catch (IOException e) { logErrorMessage(logFile, e);
spy(new LogValue(Collections.singletonList(srcFileRoot.toString()), testContainerId, ugi.getShortUserName(),ugi.getShortUserName()));
spy(new LogValue(Collections.singletonList(srcFileRoot.toString()), testContainerId, ugi.getShortUserName()));
in = secureOpenFile(logFile); } catch (IOException e) { logErrorMessage(logFile, e); IOUtils.cleanup(LOG, in); continue; String message = logErrorMessage(logFile, e); out.write(message.getBytes(Charset.forName("UTF-8"))); } finally {
spy(new LogValue(Collections.singletonList(srcFileRoot.toString()), testContainerId, ugi.getShortUserName()));
in = secureOpenFile(logFile); } catch (IOException e) { logErrorMessage(logFile, e); IOUtils.cleanupWithLogger(LOG, in); continue; String message = logErrorMessage(logFile, e); out.write(message.getBytes(Charset.forName("UTF-8"))); } finally {
fileController.write( new AggregatedLogFormat.LogKey("container_0_0001_01_000001"), new AggregatedLogFormat.LogValue(rootLogDirs, containerId, UserGroupInformation.getCurrentUser().getShortUserName())); } finally {
final LogKey logKey = new LogKey(containerId); final LogValue logValue = new LogValue(dirsHandler.getLogDirsForRead(), containerId, userUgi.getShortUserName(), logAggregationContext, this.uploadedFileMeta, appFinished, containerFinished, userFolder); .getCurrentUpLoadedFileMeta()); return logValue.getCurrentUpLoadedFilesPath();
final LogKey logKey = new LogKey(containerId); final LogValue logValue = new LogValue(dirsHandler.getLogDirsForRead(), containerId, userUgi.getShortUserName(), logAggregationContext, this.uploadedFileMeta, appFinished); .getCurrentUpLoadedFileMeta()); return logValue.getCurrentUpLoadedFilesPath();
final LogKey logKey = new LogKey(containerId); final LogValue logValue = new LogValue(dirsHandler.getLogDirsForRead(), containerId, userUgi.getShortUserName(), logAggregationContext, this.uploadedFileMeta, appFinished); .getCurrentUpLoadedFileMeta()); return logValue.getCurrentUpLoadedFilesPath();
final LogKey logKey = new LogKey(containerId); final LogValue logValue = new LogValue(dirsHandler.getLogDirsForRead(), containerId, userUgi.getShortUserName(), logAggregationContext, this.uploadedFileMeta, retentionContext, appFinished, .getCurrentUpLoadedFileMeta()); return Sets.union(logValue.getCurrentUpLoadedFilesPath(), logValue.getObsoleteRetentionLogFiles());