@Override public LogData fetchLogs(final int execId, final String name, final int attempt, final int startByte, final int length) throws ExecutorManagerException { return this.executionLogsDao.fetchLogs(execId, name, attempt, startByte, length); }
@Override public void uploadLogFile(final int execId, final String name, final int attempt, final File... files) throws ExecutorManagerException { this.executionLogsDao.uploadLogFile(execId, name, attempt, files); }
@Override public int removeExecutionLogsByTime(final long millis) throws ExecutorManagerException { return this.executionLogsDao.removeExecutionLogsByTime(millis); }
@Test public void testLargeUploadLog() throws ExecutorManagerException { final File logDir = ExecutionsTestUtil.getFlowDir(LOG_TEST_DIR_NAME); // Multiple of 255 for Henry the Eigth final File[] largelog = {new File(logDir, "largeLog1.log"), new File(logDir, "largeLog2.log"), new File(logDir, "largeLog3.log")}; this.executionLogsDao.uploadLogFile(1, "largeFiles", 0, largelog); final LogData logsResult = this.executionLogsDao.fetchLogs(1, "largeFiles", 0, 0, 64000); assertThat(logsResult).isNotNull(); assertThat(logsResult.getLength()).isEqualTo(64000); final LogData logsResult2 = this.executionLogsDao.fetchLogs(1, "largeFiles", 0, 1000, 64000); assertThat(logsResult2).isNotNull(); assertThat(logsResult2.getLength()).isEqualTo(64000); final LogData logsResult3 = this.executionLogsDao.fetchLogs(1, "largeFiles", 0, 150000, 250000); assertThat(logsResult3).isNotNull(); assertThat(logsResult3.getLength()).isEqualTo(185493); } }
if (pos + size == buffer.length) { uploadLogPart(transOperator, execId, name, attempt, startByte, startByte + buffer.length, encType, buffer, buffer.length); uploadLogPart(transOperator, execId, name, attempt, startByte, startByte + pos, encType, buffer, pos);
@Before public void setup() { this.executionLogsDao = new ExecutionLogsDao(dbOperator); }
@Test public void testSmallUploadLog() throws ExecutorManagerException { final File logDir = ExecutionsTestUtil.getFlowDir(LOG_TEST_DIR_NAME); final File[] smalllog = {new File(logDir, "log1.log"), new File(logDir, "log2.log"), new File(logDir, "log3.log")}; this.executionLogsDao.uploadLogFile(1, "smallFiles", 0, smalllog); final LogData data = this.executionLogsDao.fetchLogs(1, "smallFiles", 0, 0, 50000); assertThat(data).isNotNull(); assertThat(data.getLength()).isEqualTo(53); System.out.println(data.toString()); final LogData data2 = this.executionLogsDao.fetchLogs(1, "smallFiles", 0, 10, 20); System.out.println(data2.toString()); assertThat(data2).isNotNull(); assertThat(data2.getLength()).isEqualTo(20); }
if (pos + size == buffer.length) { uploadLogPart(transOperator, execId, name, attempt, startByte, startByte + buffer.length, encType, buffer, buffer.length); uploadLogPart(transOperator, execId, name, attempt, startByte, startByte + pos, encType, buffer, pos);
public void uploadLogFile(final int execId, final String name, final int attempt, final File... files) throws ExecutorManagerException { final SQLTransaction<Integer> transaction = transOperator -> { uploadLogFile(transOperator, execId, name, attempt, files, this.defaultEncodingType); transOperator.getConnection().commit(); return 1; }; try { this.dbOperator.transaction(transaction); } catch (final SQLException e) { logger.error("uploadLogFile failed.", e); throw new ExecutorManagerException("uploadLogFile failed.", e); } }
@Override public LogData fetchLogs(final int execId, final String name, final int attempt, final int startByte, final int length) throws ExecutorManagerException { return this.executionLogsDao.fetchLogs(execId, name, attempt, startByte, length); }
@Override public int removeExecutionLogsByTime(final long millis) throws ExecutorManagerException { return this.executionLogsDao.removeExecutionLogsByTime(millis); }
@Override public void uploadLogFile(final int execId, final String name, final int attempt, final File... files) throws ExecutorManagerException { this.executionLogsDao.uploadLogFile(execId, name, attempt, files); }
public void uploadLogFile(final int execId, final String name, final int attempt, final File... files) throws ExecutorManagerException { final SQLTransaction<Integer> transaction = transOperator -> { uploadLogFile(transOperator, execId, name, attempt, files, this.defaultEncodingType); transOperator.getConnection().commit(); return 1; }; try { this.dbOperator.transaction(transaction); } catch (final SQLException e) { logger.error("uploadLogFile failed.", e); throw new ExecutorManagerException("uploadLogFile failed.", e); } }