use of com.epam.pipeline.entity.pipeline.RunLog in project cloud-pipeline by epam.
the class RunLogManager method getPodLogs.
private List<RunLog> getPodLogs(PipelineRun run) {
String logText = StringUtils.isBlank(run.getPodIP()) ? "Node initialization in progress." : kubernetesManager.getPodLogs(run.getPodId());
RunLog log = new RunLog();
log.setRunId(run.getId());
log.setStatus(TaskStatus.RUNNING);
log.setDate(run.getCreatedDate());
log.setTask(new PipelineTask(consoleLogTask));
log.setLogText(logText);
return Collections.singletonList(log);
}
use of com.epam.pipeline.entity.pipeline.RunLog in project cloud-pipeline by epam.
the class PodMonitor method saveLog.
private void saveLog(PipelineRun pipelineRun, String instance, String log, TaskStatus status) {
RunLog runLog = new RunLog();
runLog.setDate(DateUtils.now());
runLog.setLogText(log);
setTaskName(pipelineRun, runLog, instance);
runLog.setStatus(status);
runLog.setRunId(pipelineRun.getId());
runLog.setInstance(instance);
runLogManager.saveLog(runLog);
}
use of com.epam.pipeline.entity.pipeline.RunLog in project cloud-pipeline by epam.
the class RunLogManagerTest method downloadLogs.
@Test
public void downloadLogs() throws Exception {
PipelineRun run = new PipelineRun(1L, "");
List<RunLog> logs = new ArrayList<>();
logs.add(RunLog.builder().date(Date.from(Instant.now())).task(new PipelineTask(FIRST_TASK)).logText("First task Log1").build());
logs.add(RunLog.builder().date(Date.from(Instant.now())).task(new PipelineTask(SECOND_TASK)).logText("Second task Log1").build());
logs.add(RunLog.builder().date(Date.from(Instant.now())).task(new PipelineTask(FIRST_TASK)).logText("First task Log2").build());
Mockito.when(runManagerMock.loadPipelineRun(run.getId())).thenReturn(run);
Mockito.when(logDao.loadAllLogsForRun(run.getId())).thenReturn(logs);
String result = logManager.downloadLogs(run);
Assert.assertNotNull(result);
Assert.assertTrue(!result.isEmpty());
}
use of com.epam.pipeline.entity.pipeline.RunLog in project cloud-pipeline by epam.
the class CloudPipelineAPIClient method loadPipelineRunWithLogs.
public PipelineRunWithLog loadPipelineRunWithLogs(final Long pipelineRunId) {
PipelineRunWithLog runWithLog = new PipelineRunWithLog();
runWithLog.setPipelineRun(loadPipelineRun(pipelineRunId));
List<RunLog> runLogs = QueryUtils.execute(cloudPipelineAPI.loadLogs(pipelineRunId));
runWithLog.setRunLogs(runLogs);
return runWithLog;
}
use of com.epam.pipeline.entity.pipeline.RunLog in project cloud-pipeline by epam.
the class PipelineRunMapperOld method buildRunLog.
private void buildRunLog(List<RunLog> runLogs, XContentBuilder jsonBuilder) throws IOException {
jsonBuilder.startArray("logs");
for (RunLog runLog : runLogs) {
jsonBuilder.startObject().field("timestamp", parseDataToString(runLog.getDate())).field("taskName", runLog.getTaskName()).field("logText", runLog.getLogText()).field("status", runLog.getStatus()).endObject();
}
jsonBuilder.endArray();
}
Aggregations