use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.
the class PipelineConfigurationManager method getConfigurationFromRun.
public PipelineConfiguration getConfigurationFromRun(PipelineRun run) {
PipelineConfiguration configuration = new PipelineConfiguration();
configuration.setParameters(run.convertParamsToMap());
configuration.setTimeout(run.getTimeout());
configuration.setNodeCount(run.getNodeCount());
configuration.setCmdTemplate(run.getCmdTemplate());
configuration.setDockerImage(run.getDockerImage());
RunInstance instance = run.getInstance();
if (instance != null) {
configuration.setInstanceDisk(String.valueOf(instance.getEffectiveNodeDisk()));
configuration.setInstanceType(instance.getNodeType());
configuration.setIsSpot(instance.getSpot());
configuration.setInstanceImage(instance.getNodeImage());
configuration.setAwsRegionId(awsRegionManager.loadByAwsRegionName(instance.getAwsRegionId()).getId());
}
setEndpointsErasure(configuration);
if (run.getPipelineId() != null) {
try {
ConfigurationEntry entry = pipelineVersionManager.loadConfigurationEntry(run.getPipelineId(), run.getVersion(), run.getConfigName());
PipelineConfiguration defaultConfiguration = entry.getConfiguration();
configuration.setEnvironmentParams(defaultConfiguration.getEnvironmentParams());
configuration.setMainClass(defaultConfiguration.getMainClass());
configuration.setMainFile(defaultConfiguration.getMainFile());
} catch (GitClientException e) {
log.error(e.getMessage(), e);
}
configuration.setGitCredentials(gitManager.getGitCredentials(run.getPipelineId()));
}
configuration.buildEnvVariables();
return configuration;
}
use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.
the class FirecloudRunner method runFirecloudAnalysis.
private PipelineRun runFirecloudAnalysis(FirecloudConfiguration settings, FirecloudRunConfigurationEntry entry, Long configurationId, List<Long> entities, Long projectId) {
FireCloudClass rootEntityType = metadataEntityManager.loadClass(entry.getRootEntityId()).getFireCloudClassName();
PipelineStart startVO = createFirecloudStart(settings, entry, entities, projectId, configurationId, rootEntityType);
PipelineConfiguration runConfiguration = pipelineConfigurationManager.getPipelineConfiguration(startVO);
runConfiguration.setExecutionPreferences(FirecloudPreferences.builder().method(entry.getMethodName()).methodSnapshot(entry.getMethodSnapshot()).methodConfiguration(entry.getMethodConfigurationName()).methodConfigurationSnapshot(entry.getMethodSnapshot()).build());
addCredentials(runConfiguration, settings);
return pipelineRunManager.launchPipeline(runConfiguration, null, null, startVO.getInstanceType(), startVO.getParentNodeId(), startVO.getConfigurationName(), null, null, entities, configurationId, startVO.getRunSids());
}
use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.
the class ToolVersionDaoTest method validateToolVersionSettings.
private static void validateToolVersionSettings(ToolVersion actual, ConfigurationEntry settings, String version, Long toolId, String parameterName) {
assertThat(actual).isNotNull().hasFieldOrPropertyWithValue("version", version).hasFieldOrPropertyWithValue("toolId", toolId).hasFieldOrProperty("settings");
assertThat(actual.getSettings()).hasSize(1);
assertThat(actual.getSettings().get(0)).isNotNull().hasFieldOrProperty("configuration");
PipelineConfiguration actualConfiguration = actual.getSettings().get(0).getConfiguration();
PipelineConfiguration expectedConfiguration = settings.getConfiguration();
assertThat(actualConfiguration).isNotNull().hasFieldOrPropertyWithValue("cmdTemplate", expectedConfiguration.getCmdTemplate()).hasFieldOrPropertyWithValue("nodeCount", expectedConfiguration.getNodeCount()).hasFieldOrProperty("parameters");
assertThat(actualConfiguration.getParameters()).hasSize(1);
assertThat(actualConfiguration.getParameters().get(parameterName)).isEqualToComparingFieldByFieldRecursively(settings.getConfiguration().getParameters().get(parameterName));
}
use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.
the class PipelineConfigurationTest method parsingConfigurationJsonTest.
@Test
public void parsingConfigurationJsonTest() throws IOException {
PipelineConfiguration pipelineConfiguration = mapper.readValue(WITH_TYPE_OF_PARAMS_JSON, PipelineConfiguration.class);
Assert.assertTrue(pipelineConfiguration.getParameters().values().stream().allMatch(v -> v.getType() != null));
Assert.assertEquals(STRING_TYPE, pipelineConfiguration.getParameters().get("main_file").getType());
Assert.assertEquals(true, pipelineConfiguration.getParameters().get("main_file").isRequired());
Assert.assertEquals(CLASS_TYPE, pipelineConfiguration.getParameters().get("main_class").getType());
Assert.assertEquals(false, pipelineConfiguration.getParameters().get("main_class").isRequired());
Assert.assertEquals(STRING_TYPE, pipelineConfiguration.getParameters().get("instance_size").getType());
Assert.assertEquals(false, pipelineConfiguration.getParameters().get("instance_size").isRequired());
Assert.assertEquals(EMPTY, pipelineConfiguration.getParameters().get("instance_size").getValue());
Assert.assertEquals(STRING_TYPE, pipelineConfiguration.getParameters().get("instance_disk").getType());
Assert.assertEquals(false, pipelineConfiguration.getParameters().get("instance_disk").isRequired());
Assert.assertEquals(EXP_INSTANCE_DISK, pipelineConfiguration.getParameters().get("instance_disk").getValue());
}
use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.
the class RunConfigurationApiServiceTest method setUp.
@Before
public void setUp() {
// Create SIDs for "test" users
testUserSid1 = new AclTestDao.AclSid(true, TEST_USER_1);
aclTestDao.createAclSid(testUserSid1);
testUserSid2 = new AclTestDao.AclSid(true, TEST_USER_2);
aclTestDao.createAclSid(testUserSid2);
Folder sourceFolder = new Folder();
sourceFolder.setName(TEST_FOLDER_NAME);
sourceFolder.setOwner(TEST_USER_1);
folderDao.createFolder(sourceFolder);
Long folderId = folderDao.loadFolderByName(TEST_FOLDER_NAME).getId();
AclTestDao.AclClass folderAclClass = new AclTestDao.AclClass(Folder.class.getCanonicalName());
aclTestDao.createAclClassIfNotPresent(folderAclClass);
AclTestDao.AclObjectIdentity folderIdentity = new AclTestDao.AclObjectIdentity(testUserSid1, folderId, folderAclClass.getId(), null, true);
aclTestDao.createObjectIdentity(folderIdentity);
AclTestDao.AclEntry folderAclEntry = new AclTestDao.AclEntry(folderIdentity, 1, testUserSid1, AclPermission.WRITE.getMask(), true);
aclTestDao.createAclEntry(folderAclEntry);
Pipeline pipeline = constructPipeline(TEST_NAME, TEST_NAME, folderId);
pipeline.setOwner(TEST_USER_1);
pipelineDao.createPipeline(pipeline);
Pipeline loadPipelineByName = pipelineDao.loadPipelineByName(TEST_NAME);
AclTestDao.AclClass pipelineAclClass = new AclTestDao.AclClass(Pipeline.class.getCanonicalName());
aclTestDao.createAclClassIfNotPresent(pipelineAclClass);
AclTestDao.AclObjectIdentity pipelineIdentity = new AclTestDao.AclObjectIdentity(testUserSid1, loadPipelineByName.getId(), pipelineAclClass.getId(), null, true);
aclTestDao.createObjectIdentity(pipelineIdentity);
AclTestDao.AclEntry pipelineAclEntry = new AclTestDao.AclEntry(pipelineIdentity, 1, testUserSid1, AclPermission.EXECUTE.getMask(), true);
aclTestDao.createAclEntry(pipelineAclEntry);
PipelineConfiguration pipelineConfiguration = new PipelineConfiguration();
RunConfigurationEntry entryWithPipeline = createConfigEntry(TEST_NAME, true, pipelineConfiguration);
entryWithPipeline.setPipelineId(pipeline.getId());
entryWithPipeline.setPipelineVersion(TEST_NAME);
runConfigurationVO = createRunConfigurationVO(TEST_NAME, TEST_DESCRIPTION, sourceFolder.getId(), Collections.singletonList(entryWithPipeline));
ToolGroup toolGroup = createToolGroup();
Tool tool = createTool(toolGroup);
RunConfigurationEntry entryWithTool = createConfigEntry(TEST_NAME, true, pipelineConfiguration);
pipelineConfiguration.setCmdTemplate(TEST_NAME);
pipelineConfiguration.setDockerImage(tool.getImage());
entryWithTool.setConfiguration(pipelineConfiguration);
updatedRunConfigurationVO = createRunConfigurationVO(TEST_NAME, TEST_DESCRIPTION, sourceFolder.getId(), Collections.singletonList(entryWithTool));
}
Aggregations