Search in sources :

Example 1 with RunLog

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);
}
Also used : RunLog(com.epam.pipeline.entity.pipeline.RunLog) PipelineTask(com.epam.pipeline.entity.pipeline.PipelineTask)

Example 2 with RunLog

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);
}
Also used : RunLog(com.epam.pipeline.entity.pipeline.RunLog)

Example 3 with 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());
}
Also used : PipelineRun(com.epam.pipeline.entity.pipeline.PipelineRun) RunLog(com.epam.pipeline.entity.pipeline.RunLog) ArrayList(java.util.ArrayList) PipelineTask(com.epam.pipeline.entity.pipeline.PipelineTask) Test(org.junit.Test) AbstractManagerTest(com.epam.pipeline.manager.AbstractManagerTest)

Example 4 with RunLog

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;
}
Also used : RunLog(com.epam.pipeline.entity.pipeline.RunLog) PipelineRunWithLog(com.epam.pipeline.elasticsearchagent.model.PipelineRunWithLog)

Example 5 with RunLog

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();
}
Also used : RunLog(com.epam.pipeline.entity.pipeline.RunLog)

Aggregations

RunLog (com.epam.pipeline.entity.pipeline.RunLog)8 PipelineTask (com.epam.pipeline.entity.pipeline.PipelineTask)4 PipelineRunWithLog (com.epam.pipeline.elasticsearchagent.model.PipelineRunWithLog)3 PipelineRun (com.epam.pipeline.entity.pipeline.PipelineRun)3 RunInstance (com.epam.pipeline.entity.pipeline.RunInstance)2 RunStatus (com.epam.pipeline.entity.pipeline.run.RunStatus)2 PipelineRunParameter (com.epam.pipeline.entity.pipeline.run.parameter.PipelineRunParameter)2 Test (org.junit.jupiter.api.Test)2 LoaderVerificationUtils.verifyPipelineRun (com.epam.pipeline.elasticsearchagent.LoaderVerificationUtils.verifyPipelineRun)1 LoaderVerificationUtils.verifyRunInstance (com.epam.pipeline.elasticsearchagent.LoaderVerificationUtils.verifyRunInstance)1 MapperVerificationUtils.verifyPipelineRun (com.epam.pipeline.elasticsearchagent.MapperVerificationUtils.verifyPipelineRun)1 EntityContainer (com.epam.pipeline.elasticsearchagent.model.EntityContainer)1 AbstractManagerTest (com.epam.pipeline.manager.AbstractManagerTest)1 ArrayList (java.util.ArrayList)1 XContentBuilder (org.elasticsearch.common.xcontent.XContentBuilder)1 Test (org.junit.Test)1