use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunManager method loadPipelineRunWithRestartedRuns.
@Transactional(propagation = Propagation.REQUIRED)
public PipelineRun loadPipelineRunWithRestartedRuns(Long id) {
PipelineRun run = loadPipelineRun(id);
List<RestartRun> restartedRuns = restartRunManager.loadRestartedRunsForInitialRun(id);
run.setRestartedRuns(restartedRuns);
run.setRunStatuses(runStatusManager.loadRunStatus(id));
return run;
}
use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class RunLogManager method loadTasksByRunId.
@Transactional(propagation = Propagation.SUPPORTS)
public List<PipelineTask> loadTasksByRunId(Long runId) {
PipelineRun run = pipelineRunManager.loadPipelineRun(runId);
List<PipelineTask> tasks = runLogDao.loadTasksForRun(runId);
tasks.forEach(task -> {
if (run.getStatus().isFinal() && !task.getStatus().isFinal()) {
task.setStatus(run.getStatus());
if (task.getFinished() == null) {
task.setFinished(run.getEndDate());
}
}
if ((StringUtils.isEmpty(task.getInstance()) || task.getInstance().equals(run.getPodId())) && !task.getStatus().isFinal()) {
task.setStatus(run.getStatus());
}
if (task.getStarted() == null && (StringUtils.isEmpty(task.getInstance()) || task.getInstance().equals(run.getPodId()) || task.getStatus().isFinal())) {
task.setStarted(task.getCreated());
}
if (!task.getStatus().isFinal()) {
task.setFinished(null);
}
if (task.getName().equals(run.getPipelineName())) {
task.setCreated(run.getStartDate());
task.setStarted(tasks.get(0).getCreated());
}
});
if (!run.getStatus().isFinal()) {
// for running tasks we add dummy 'console' task to get online logs from Kubernetes
PipelineTask consoleTask = new PipelineTask();
consoleTask.setName(consoleLogTask);
consoleTask.setStatus(TaskStatus.RUNNING);
consoleTask.setStarted(run.getStartDate());
tasks.add(consoleTask);
}
return tasks;
}
use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class CloudPlatformRunner method runConfigurationEntry.
private List<PipelineRun> runConfigurationEntry(RunConfigurationEntry entry, PipelineConfiguration configuration, int copies, String clusterId, boolean startNFS, List<Long> entityIds, Long configurationId) {
PipelineStart startVO = entry.toPipelineStart();
if (!StringUtils.hasText(clusterId)) {
log.debug("Launching master entry {}", entry.getName());
pipelineConfigurationManager.updateMasterConfiguration(configuration, startNFS);
} else {
log.debug("Launching worker entry {}", entry.getName());
pipelineConfigurationManager.updateWorkerConfiguration(clusterId, startVO, configuration, startNFS, true);
}
Pipeline pipeline = entry.getPipelineId() != null ? pipelineManager.load(entry.getPipelineId()) : null;
List<PipelineRun> result = new ArrayList<>();
log.debug("Launching total {} copies of entry {}", copies, entry.getName());
for (int i = 0; i < copies; i++) {
// only first node may be a NFS server
if (i != 0) {
configuration.setCmdTemplate(WORKER_CMD_TEMPLATE);
configuration.getParameters().remove(NFS_CLUSTER_ROLE);
configuration.buildEnvVariables();
}
result.add(pipelineRunManager.launchPipeline(configuration, pipeline, entry.getPipelineVersion(), startVO.getInstanceType(), startVO.getParentNodeId(), startVO.getConfigurationName(), clusterId, null, entityIds, configurationId, startVO.getRunSids()));
}
return result;
}
use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunDaoTest method updatePodStatus.
@Test
public void updatePodStatus() {
PipelineRun run = createRun(testPipeline.getId(), null, TaskStatus.SUCCESS, null);
run.setPodStatus(POD_STATUS);
pipelineRunDao.updatePodStatus(run);
PipelineRun loadedRun = pipelineRunDao.loadPipelineRun(run.getId());
assertEquals(POD_STATUS, loadedRun.getPodStatus());
}
use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunDaoTest method testLoadActiveServicesByOwner.
@Test
public void testLoadActiveServicesByOwner() {
PipelineRun run = createTestPipelineRun();
PagingRunFilterVO filterVO = new PagingRunFilterVO();
filterVO.setPage(1);
filterVO.setPageSize(TEST_PAGE_SIZE);
PipelineUser user = new PipelineUser();
user.setUserName(USER);
List<PipelineRun> runs = pipelineRunDao.loadActiveServices(filterVO, user);
assertEquals(1, runs.size());
assertEquals(run.getId(), runs.get(0).getId());
assertEquals(1, runs.size());
}
Aggregations