use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunManager method prolongIdleRun.
@Transactional(propagation = Propagation.REQUIRED)
public void prolongIdleRun(Long runId) {
PipelineRun run = loadPipelineRun(runId);
run.setLastIdleNotificationTime(null);
run.setProlongedAtTime(DateUtils.nowUTC());
updateProlongIdleRunAndLastIdleNotificationTime(run);
}
use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunManager method runPod.
/**
* Creates a new pod with a given run_id, doesn't create a new pipeline run
* @param runVO
* @return
*/
// TODO: refactoring
@ToolSecurityPolicyCheck
@Transactional(propagation = Propagation.REQUIRED)
public PipelineRun runPod(PipelineStart runVO) {
Assert.notNull(runVO.getCmdTemplate(), messageHelper.getMessage(MessageConstants.SETTING_IS_NOT_PROVIDED, "cmd_template"));
PipelineRun parentRun = loadPipelineRun(runVO.getUseRunId());
Assert.state(parentRun.getStatus() == TaskStatus.RUNNING, messageHelper.getMessage(MessageConstants.ERROR_PIPELINE_RUN_NOT_RUNNING, runVO.getUseRunId()));
PipelineConfiguration configuration = configurationManager.getPipelineConfiguration(runVO);
Tool tool = getToolForRun(configuration);
configuration.setSecretName(tool.getSecretName());
List<String> endpoints = tool.getEndpoints();
PipelineRun run = new PipelineRun();
run.setInstance(parentRun.getInstance());
run.setId(runVO.getUseRunId());
run.setStartDate(DateUtils.now());
run.setStatus(TaskStatus.RUNNING);
run.setPipelineName(DEFAULT_PIPELINE_NAME);
run.setPodId(getRootPodIDFromTool(tool.getImage(), run.getId()));
run.setDockerImage(configuration.getDockerImage());
run.setCmdTemplate(determinateCmdTemplateForRun(configuration));
run.setTimeout(runVO.getTimeout());
run.setCommitStatus(CommitStatus.NOT_COMMITTED);
run.setLastChangeCommitTime(DateUtils.now());
run.setRunSids(runVO.getRunSids());
run.setOwner(parentRun.getOwner());
String launchedCommand = pipelineLauncher.launch(run, configuration, endpoints, runVO.getUseRunId().toString(), false, parentRun.getPodId(), null);
run.setActualCmd(launchedCommand);
return run;
}
use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunManager method updateRunInstance.
@Transactional(propagation = Propagation.REQUIRED)
public PipelineRun updateRunInstance(Long id, RunInstance instance) {
PipelineRun pipelineRun = pipelineRunDao.loadPipelineRun(id);
if (!instance.isEmpty()) {
pipelineRun.setInstance(instance);
pipelineRunDao.updateRunInstance(pipelineRun);
}
return pipelineRun;
}
use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunManager method updatePrettyUrl.
@Transactional(propagation = Propagation.REQUIRED)
public PipelineRun updatePrettyUrl(Long runId, String url) {
PipelineRun pipelineRun = pipelineRunDao.loadPipelineRun(runId);
Assert.notNull(pipelineRun, messageHelper.getMessage(MessageConstants.ERROR_PIPELINE_NOT_FOUND, runId));
if (Objects.equals(pipelineRun.getPrettyUrl(), url)) {
LOGGER.debug("Url '{}' is already assigned to run {}", url, runId);
return pipelineRun;
}
validatePrettyUrlFree(url);
pipelineRun.setPrettyUrl(url);
pipelineRunDao.updateRun(pipelineRun);
// TODO: check if we need it
setParent(pipelineRun);
return pipelineRun;
}
use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunManager method updateRunSids.
/**
* Updates pipeline run sids
* @param runId {@link PipelineRun} id for pipeline run which run sids should be updated
* @param runSids - a list of identities (user names or groups) that have access to run
* @return updated pipeline {@link RunSid}
*/
@Transactional(propagation = Propagation.REQUIRED)
public PipelineRun updateRunSids(Long runId, List<RunSid> runSids) {
PipelineRun pipelineRun = pipelineRunDao.loadPipelineRun(runId);
Assert.notNull(pipelineRun, messageHelper.getMessage(MessageConstants.ERROR_PIPELINE_NOT_FOUND, runId));
pipelineRunDao.deleteRunSids(runId);
pipelineRunDao.createRunSids(runId, runSids);
pipelineRun.setRunSids(runSids);
return pipelineRun;
}
Aggregations