use of com.epam.pipeline.entity.pipeline.run.PipelineStart in project cloud-pipeline by epam.
the class PipelineConfigurationManagerTest method getPipelineStartVO.
private PipelineStart getPipelineStartVO() {
PipelineStart vo = new PipelineStart();
vo.setInstanceType(TEST_INSTANCE_TYPE);
vo.setDockerImage(tool.getImage());
vo.setHddSize(1);
vo.setCmdTemplate("template");
vo.setTimeout(TEST_TIMEOUT);
vo.setNodeCount(1);
vo.setIsSpot(true);
vo.setParams(Collections.singletonMap("testParam", new PipeConfValueVO("testParamValue", "int", true)));
return vo;
}
use of com.epam.pipeline.entity.pipeline.run.PipelineStart in project cloud-pipeline by epam.
the class PipelineConfigurationManagerTest method testGetUnregisteredPipelineConfiguration.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW)
@WithMockUser(username = TEST_OWNER1)
public void testGetUnregisteredPipelineConfiguration() {
PipelineStart vo = getPipelineStartVO();
PipelineConfiguration config = pipelineConfigurationManager.getPipelineConfiguration(vo);
Assert.assertFalse(config.getBuckets().isEmpty());
Assert.assertFalse(config.getNfsMountOptions().isEmpty());
String[] buckets = config.getBuckets().split(";");
Assert.assertEquals(2, buckets.length);
for (String bucket : buckets) {
Assert.assertTrue(dataStorages.stream().anyMatch(ds -> bucket.equals(ds.getPathMask())));
}
String[] nfsOptions = config.getNfsMountOptions().split(";");
Assert.assertEquals(1, nfsOptions.length);
for (String option : nfsOptions) {
if (StringUtils.isNotBlank(option)) {
Assert.assertTrue(dataStorages.stream().filter(ds -> ds instanceof NFSDataStorage).anyMatch(ds -> {
NFSDataStorage nfsDs = (NFSDataStorage) ds;
return nfsDs.getMountOptions().equals(option) || option.equals(nfsDs.getMountOptions() + ",ro");
}));
}
}
String[] mountPoints = config.getMountPoints().split(";");
for (String mountPoint : mountPoints) {
if (StringUtils.isNotBlank(mountPoint)) {
Assert.assertTrue(dataStorages.stream().anyMatch(ds -> mountPoint.equals(ds.getMountPoint())));
}
}
// Assert.assertTrue(Arrays.stream(nfsOptions).anyMatch(o -> o.endsWith(",ro")));
}
use of com.epam.pipeline.entity.pipeline.run.PipelineStart in project cloud-pipeline by epam.
the class DtsRunConfigurationEntry method toPipelineStart.
@Override
public PipelineStart toPipelineStart() {
PipelineStart pipelineStart = new PipelineStart();
pipelineStart.setPipelineId(pipelineId);
pipelineStart.setVersion(pipelineVersion);
pipelineStart.setCmdTemplate(cmdTemplate);
pipelineStart.setDockerImage(dockerImage);
pipelineStart.setParams(parameters);
return pipelineStart;
}
use of com.epam.pipeline.entity.pipeline.run.PipelineStart in project cloud-pipeline by epam.
the class RunConfigurationEntry method toPipelineStart.
@Override
public PipelineStart toPipelineStart() {
PipelineStart startVO = new PipelineStart();
startVO.setPipelineId(getPipelineId());
startVO.setVersion(getPipelineVersion());
startVO.setConfigurationName(getConfigName());
startVO.setRunSids(getRunSids());
PipelineConfiguration configuration = getConfiguration();
if (configuration != null) {
startVO.setAwsRegionId(configuration.getAwsRegionId());
startVO.setIsSpot(configuration.getIsSpot());
startVO.setCmdTemplate(configuration.getCmdTemplate());
startVO.setDockerImage(configuration.getDockerImage());
if (configuration.getInstanceDisk() != null) {
startVO.setHddSize(Integer.parseInt(configuration.getInstanceDisk()));
}
startVO.setInstanceType(configuration.getInstanceType());
startVO.setNodeCount(configuration.getNodeCount());
startVO.setParams(configuration.getParameters());
startVO.setTimeout(configuration.getTimeout());
startVO.setWorkerCmd(configuration.getWorkerCmd());
if (!StringUtils.hasText(startVO.getWorkerCmd())) {
startVO.setWorkerCmd(configuration.getCmdTemplate());
}
startVO.setNonPause(configuration.isNonPause());
}
return startVO;
}
use of com.epam.pipeline.entity.pipeline.run.PipelineStart in project cloud-pipeline by epam.
the class ConfigurationEntryMapper method buildExecutionEnvironmentConfiguration.
private void buildExecutionEnvironmentConfiguration(final AbstractRunConfigurationEntry entry, final Pipeline pipeline, final XContentBuilder jsonBuilder) throws IOException {
if (entry.getExecutionEnvironment() == ExecutionEnvironment.CLOUD_PLATFORM || entry.getExecutionEnvironment() == ExecutionEnvironment.DTS) {
PipelineStart pipelineStart = entry.toPipelineStart();
jsonBuilder.field("pipelineId", pipelineStart.getPipelineId()).field("pipelineVersion", pipelineStart.getVersion()).field("dockerImage", pipelineStart.getDockerImage());
if (pipeline != null) {
jsonBuilder.field("pipelineName", pipeline.getName());
}
} else if (entry.getExecutionEnvironment() == ExecutionEnvironment.FIRECLOUD) {
FirecloudRunConfigurationEntry firecloudEntry = (FirecloudRunConfigurationEntry) entry;
jsonBuilder.field("methodName", firecloudEntry.getMethodName()).field("methodSnapshot", firecloudEntry.getMethodSnapshot()).field("methodConfigurationName", firecloudEntry.getMethodConfigurationName()).field("methodConfigurationSnapshot", firecloudEntry.getMethodConfigurationSnapshot());
}
}
Aggregations