use of com.epam.pipeline.entity.pipeline.run.RestartRun in project cloud-pipeline by epam.
the class PipelineRunManager method restartRun.
/**
* Restarts spot run
* @param run {@link PipelineRun} which will be restart
* @return Restarted pipeline run
*/
@Transactional(propagation = Propagation.REQUIRED)
public PipelineRun restartRun(final PipelineRun run) {
final PipelineConfiguration configuration = configurationManager.getConfigurationFromRun(run);
final PipelineRun restartedRun = createRestartRun(run);
final Tool tool = getToolForRun(configuration);
final List<String> endpoints = configuration.isEraseRunEndpoints() ? Collections.emptyList() : tool.getEndpoints();
configuration.setSecretName(tool.getSecretName());
final String launchedCommand = pipelineLauncher.launch(restartedRun, configuration, endpoints, restartedRun.getId().toString(), null);
restartedRun.setActualCmd(launchedCommand);
save(restartedRun);
final RestartRun restartRun = new RestartRun();
restartRun.setParentRunId(run.getId());
restartRun.setRestartedRunId(restartedRun.getId());
restartRun.setDate(DateUtils.now());
restartRunManager.createRestartRun(restartRun);
return run;
}
use of com.epam.pipeline.entity.pipeline.run.RestartRun 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.run.RestartRun in project cloud-pipeline by epam.
the class RestartRunDaoTest method setup.
@Before
public void setup() {
testPipeline = new Pipeline();
testPipeline.setName(TEST_NAME);
testPipeline.setRepository(TEST_REPOSITORY);
testPipeline.setOwner(TEST_NAME);
pipelineDao.createPipeline(testPipeline);
Long pipelineId = testPipeline.getId();
createPipelineRun(TEST_RUN_ID_1, pipelineId, null);
restartRun1 = new RestartRun();
restartRun1.setParentRunId(TEST_RUN_ID_1);
restartRun1.setRestartedRunId(TEST_RUN_ID_2);
restartRun1.setDate(new Date());
createPipelineRun(TEST_RUN_ID_2, pipelineId, TEST_RUN_ID_1);
restartRun2 = new RestartRun();
restartRun2.setParentRunId(TEST_RUN_ID_2);
restartRun2.setRestartedRunId(TEST_RUN_ID_3);
restartRun2.setDate(new Date());
createPipelineRun(TEST_RUN_ID_3, pipelineId, TEST_RUN_ID_2);
restartRun3 = new RestartRun();
restartRun3.setParentRunId(TEST_RUN_ID_3);
restartRun3.setRestartedRunId(TEST_RUN_ID_4);
restartRun3.setDate(new Date());
createPipelineRun(TEST_RUN_ID_5, pipelineId, null);
restartRun4 = new RestartRun();
restartRun4.setParentRunId(TEST_RUN_ID_5);
restartRun4.setRestartedRunId(TEST_RUN_ID_6);
restartRun4.setDate(new Date());
}
use of com.epam.pipeline.entity.pipeline.run.RestartRun in project cloud-pipeline by epam.
the class RestartRunDaoTest method testCreateAndLoadPipelineRestartRun.
@Test
public void testCreateAndLoadPipelineRestartRun() {
restartRunDao.createPipelineRestartRun(restartRun1);
RestartRun loadRestartRun = restartRunDao.loadPipelineRestartedRunForParentRun(restartRun1.getParentRunId());
assertNotNull(loadRestartRun);
assertEquals(loadRestartRun.getParentRunId(), restartRun1.getParentRunId());
assertEquals(loadRestartRun.getRestartedRunId(), restartRun1.getRestartedRunId());
}
Aggregations