Search in sources :

Example 31 with PipelineConfiguration

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;
}
Also used : GitClientException(com.epam.pipeline.exception.git.GitClientException) RunInstance(com.epam.pipeline.entity.pipeline.RunInstance) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration) ConfigurationEntry(com.epam.pipeline.entity.configuration.ConfigurationEntry)

Example 32 with PipelineConfiguration

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());
}
Also used : FireCloudClass(com.epam.pipeline.entity.metadata.FireCloudClass) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration) PipelineStart(com.epam.pipeline.entity.pipeline.run.PipelineStart)

Example 33 with PipelineConfiguration

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));
}
Also used : PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration)

Example 34 with PipelineConfiguration

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());
}
Also used : JsonInclude(com.fasterxml.jackson.annotation.JsonInclude) JsonMapper(com.epam.pipeline.config.JsonMapper) SerializationFeature(com.fasterxml.jackson.databind.SerializationFeature) Test(org.junit.Test) IOException(java.io.IOException) Assert(org.junit.Assert) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration) DeserializationFeature(com.fasterxml.jackson.databind.DeserializationFeature) Before(org.junit.Before) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration) Test(org.junit.Test)

Example 35 with PipelineConfiguration

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));
}
Also used : PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration) RunConfigurationEntry(com.epam.pipeline.entity.configuration.RunConfigurationEntry) AclTestDao(com.epam.pipeline.dao.util.AclTestDao) Before(org.junit.Before)

Aggregations

PipelineConfiguration (com.epam.pipeline.entity.configuration.PipelineConfiguration)43 Test (org.junit.Test)16 PipelineRun (com.epam.pipeline.entity.pipeline.PipelineRun)12 Tool (com.epam.pipeline.entity.pipeline.Tool)12 RunConfigurationEntry (com.epam.pipeline.entity.configuration.RunConfigurationEntry)10 Pipeline (com.epam.pipeline.entity.pipeline.Pipeline)9 AbstractManagerTest (com.epam.pipeline.manager.AbstractManagerTest)9 PipelineStart (com.epam.pipeline.entity.pipeline.run.PipelineStart)8 List (java.util.List)7 ConfigurationEntry (com.epam.pipeline.entity.configuration.ConfigurationEntry)6 Before (org.junit.Before)6 PipeConfValueVO (com.epam.pipeline.entity.configuration.PipeConfValueVO)5 HashMap (java.util.HashMap)5 Collectors (java.util.stream.Collectors)5 Autowired (org.springframework.beans.factory.annotation.Autowired)5 Transactional (org.springframework.transaction.annotation.Transactional)5 RunConfiguration (com.epam.pipeline.entity.configuration.RunConfiguration)4 AbstractDataStorage (com.epam.pipeline.entity.datastorage.AbstractDataStorage)4 RunInstance (com.epam.pipeline.entity.pipeline.RunInstance)4 ArrayList (java.util.ArrayList)4