Search in sources :

Example 6 with PipelineStart

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

Example 7 with PipelineStart

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")));
}
Also used : DirtiesContext(org.springframework.test.annotation.DirtiesContext) TestApplicationWithAclSecurity(com.epam.pipeline.app.TestApplicationWithAclSecurity) ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup) DataStorageDao(com.epam.pipeline.dao.datastorage.DataStorageDao) AclTestDao(com.epam.pipeline.dao.util.AclTestDao) Autowired(org.springframework.beans.factory.annotation.Autowired) PipeConfValueVO(com.epam.pipeline.entity.configuration.PipeConfValueVO) StringUtils(org.apache.commons.lang3.StringUtils) ArrayList(java.util.ArrayList) Propagation(org.springframework.transaction.annotation.Propagation) AbstractManagerTest(com.epam.pipeline.manager.AbstractManagerTest) AclPermission(com.epam.pipeline.security.acl.AclPermission) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration) Before(org.junit.Before) ToolDao(com.epam.pipeline.dao.tool.ToolDao) AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) Test(org.junit.Test) DockerRegistryDao(com.epam.pipeline.dao.docker.DockerRegistryDao) NFSDataStorage(com.epam.pipeline.entity.datastorage.nfs.NFSDataStorage) DockerRegistry(com.epam.pipeline.entity.pipeline.DockerRegistry) Tool(com.epam.pipeline.entity.pipeline.Tool) List(java.util.List) WithMockUser(org.springframework.security.test.context.support.WithMockUser) ContextConfiguration(org.springframework.test.context.ContextConfiguration) S3bucketDataStorage(com.epam.pipeline.entity.datastorage.aws.S3bucketDataStorage) PipelineStart(com.epam.pipeline.entity.pipeline.run.PipelineStart) Assert(org.junit.Assert) ToolGroupDao(com.epam.pipeline.dao.tool.ToolGroupDao) Collections(java.util.Collections) Transactional(org.springframework.transaction.annotation.Transactional) NFSDataStorage(com.epam.pipeline.entity.datastorage.nfs.NFSDataStorage) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration) PipelineStart(com.epam.pipeline.entity.pipeline.run.PipelineStart) WithMockUser(org.springframework.security.test.context.support.WithMockUser) AbstractManagerTest(com.epam.pipeline.manager.AbstractManagerTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 8 with PipelineStart

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

Example 9 with 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;
}
Also used : PipelineStart(com.epam.pipeline.entity.pipeline.run.PipelineStart)

Example 10 with PipelineStart

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

Aggregations

PipelineStart (com.epam.pipeline.entity.pipeline.run.PipelineStart)16 PipelineConfiguration (com.epam.pipeline.entity.configuration.PipelineConfiguration)7 AbstractManagerTest (com.epam.pipeline.manager.AbstractManagerTest)7 Test (org.junit.Test)7 Tool (com.epam.pipeline.entity.pipeline.Tool)4 PipeConfValueVO (com.epam.pipeline.entity.configuration.PipeConfValueVO)3 Transactional (org.springframework.transaction.annotation.Transactional)3 ConfigurationEntry (com.epam.pipeline.entity.configuration.ConfigurationEntry)2 AbstractDataStorage (com.epam.pipeline.entity.datastorage.AbstractDataStorage)2 NFSDataStorage (com.epam.pipeline.entity.datastorage.nfs.NFSDataStorage)2 PipelineRun (com.epam.pipeline.entity.pipeline.PipelineRun)2 AclPermission (com.epam.pipeline.security.acl.AclPermission)2 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 List (java.util.List)2 Autowired (org.springframework.beans.factory.annotation.Autowired)2 WithMockUser (org.springframework.security.test.context.support.WithMockUser)2 TestApplicationWithAclSecurity (com.epam.pipeline.app.TestApplicationWithAclSecurity)1 MessageConstants (com.epam.pipeline.common.MessageConstants)1 MessageHelper (com.epam.pipeline.common.MessageHelper)1