Search in sources :

Example 6 with PipelineConfiguration

use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.

the class PipelineConfigurationManager method getPipelineConfiguration.

public PipelineConfiguration getPipelineConfiguration(final PipelineStart runVO, final Tool tool) {
    PipelineConfiguration configuration;
    PipelineConfiguration defaultConfiguration = new PipelineConfiguration();
    boolean toolRun = tool != null;
    boolean pipelineRun = runVO.getPipelineId() != null;
    if (toolRun || pipelineRun) {
        defaultConfiguration = getConfigurationForToolRunOrPipelineRun(runVO, tool, toolRun);
    }
    configuration = mergeParameters(runVO, defaultConfiguration);
    if (pipelineRun) {
        configuration.setGitCredentials(gitManager.getGitCredentials(runVO.getPipelineId()));
    }
    if (toolRun) {
        mergeParametersFromTool(configuration, tool);
    }
    List<AbstractDataStorage> dataStorages = dataStorageApiService.getWritableStorages();
    configuration.setBuckets(zipToString(dataStorages, AbstractDataStorage::getPathMask));
    configuration.setNfsMountOptions(zipToString(dataStorages, mountOptionsSupplier));
    configuration.setMountPoints(zipToString(dataStorages, AbstractDataStorage::getMountPoint));
    // client always sends actual node count value
    configuration.setNodeCount(Optional.ofNullable(runVO.getNodeCount()).orElse(0));
    configuration.setAwsRegionId(runVO.getAwsRegionId());
    setEndpointsErasure(configuration);
    return configuration;
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration)

Example 7 with PipelineConfiguration

use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.

the class CloudPlatformRunner method runConfiguration.

private List<PipelineRun> runConfiguration(Long configurationId, List<RunConfigurationEntry> entries, ResolvedConfiguration resolvedConfigurations) {
    SplitConfig splitConfig = new SplitConfig(entries);
    RunConfigurationEntry mainEntry = splitConfig.getMain();
    List<RunConfigurationEntry> childEntries = splitConfig.getChildEntries();
    boolean isMasterNFSServer = pipelineConfigurationManager.hasNFSParameter(mainEntry.getConfiguration()) || childEntries.stream().noneMatch(entry -> pipelineConfigurationManager.hasNFSParameter(entry.getConfiguration()));
    boolean nfsStarted = isMasterNFSServer;
    PipelineConfiguration mainConfiguration = resolvedConfigurations.getConfiguration(mainEntry.getName());
    List<PipelineConfiguration> childConfigurations = childEntries.stream().map(entry -> resolvedConfigurations.getConfiguration(entry.getName())).collect(Collectors.toList());
    int masterNodeCount = getNodeCount(mainConfiguration.getNodeCount(), 0);
    int totalNodes = childConfigurations.stream().map(PipelineConfiguration::getNodeCount).mapToInt(nodeCount -> getNodeCount(nodeCount, 1)).sum();
    totalNodes += masterNodeCount;
    log.debug("Running total {} nodes", totalNodes + 1);
    mainConfiguration.setNodeCount(totalNodes);
    // create master run
    List<PipelineRun> masterRun = runConfigurationEntry(mainEntry, mainConfiguration, 1, null, isMasterNFSServer, resolvedConfigurations.getAllAssociatedIds(), configurationId);
    List<PipelineRun> launched = new ArrayList<>(masterRun);
    String clusterId = String.valueOf(masterRun.get(0).getId());
    // create master workers
    if (masterNodeCount > 0) {
        mainEntry.getConfiguration().setWorkerCmd(WORKER_CMD_TEMPLATE);
        launched.addAll(runConfigurationEntry(mainEntry, mainConfiguration, masterNodeCount, clusterId, false, resolvedConfigurations.getAllAssociatedIds(), configurationId));
    }
    // create all other workers
    for (int i = 0; i < childConfigurations.size(); i++) {
        PipelineConfiguration childConfig = childConfigurations.get(i);
        boolean startNFS = !nfsStarted && pipelineConfigurationManager.hasNFSParameter(childConfig);
        nfsStarted = nfsStarted || startNFS;
        int copies = getNodeCount(childConfig.getNodeCount(), 1);
        launched.addAll(runConfigurationEntry(childEntries.get(i), childConfig, copies, clusterId, startNFS, resolvedConfigurations.getAllAssociatedIds(), configurationId));
    }
    return launched;
}
Also used : PipelineManager(com.epam.pipeline.manager.pipeline.PipelineManager) MessageConstants(com.epam.pipeline.common.MessageConstants) ParameterMapper(com.epam.pipeline.manager.pipeline.ParameterMapper) PipelineRunManager(com.epam.pipeline.manager.pipeline.PipelineRunManager) RequiredArgsConstructor(lombok.RequiredArgsConstructor) SystemPreferences(com.epam.pipeline.manager.preference.SystemPreferences) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) PipelineRun(com.epam.pipeline.entity.pipeline.PipelineRun) MessageHelper(com.epam.pipeline.common.MessageHelper) Service(org.springframework.stereotype.Service) AbstractRunConfigurationEntry(com.epam.pipeline.entity.configuration.AbstractRunConfigurationEntry) RunConfigurationEntry(com.epam.pipeline.entity.configuration.RunConfigurationEntry) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration) Pipeline(com.epam.pipeline.entity.pipeline.Pipeline) PipelineConfigurationManager(com.epam.pipeline.manager.pipeline.PipelineConfigurationManager) WORKER_CMD_TEMPLATE(com.epam.pipeline.manager.pipeline.PipelineConfigurationManager.WORKER_CMD_TEMPLATE) PreferenceManager(com.epam.pipeline.manager.preference.PreferenceManager) Collection(java.util.Collection) RunConfigurationUtils.getNodeCount(com.epam.pipeline.entity.configuration.RunConfigurationUtils.getNodeCount) Collectors(java.util.stream.Collectors) ResolvedConfiguration(com.epam.pipeline.entity.pipeline.ResolvedConfiguration) NFS_CLUSTER_ROLE(com.epam.pipeline.manager.pipeline.PipelineConfigurationManager.NFS_CLUSTER_ROLE) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) Data(lombok.Data) PipelineStart(com.epam.pipeline.entity.pipeline.run.PipelineStart) Assert(org.springframework.util.Assert) StringUtils(org.springframework.util.StringUtils) PipelineRun(com.epam.pipeline.entity.pipeline.PipelineRun) ArrayList(java.util.ArrayList) AbstractRunConfigurationEntry(com.epam.pipeline.entity.configuration.AbstractRunConfigurationEntry) RunConfigurationEntry(com.epam.pipeline.entity.configuration.RunConfigurationEntry) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration)

Example 8 with PipelineConfiguration

use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.

the class RunConfigurationDaoTest method getTestConfig.

public PipelineConfiguration getTestConfig() {
    PipelineConfiguration configuration = new PipelineConfiguration();
    configuration.setCmdTemplate(TEST_CMD_TEMPLATE);
    configuration.setDockerImage(TEST_DOCKER);
    configuration.setInstanceDisk(TEST_DISK);
    configuration.setInstanceType(TEST_INSTANCE);
    return configuration;
}
Also used : PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration)

Example 9 with PipelineConfiguration

use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.

the class FolderDaoTest method addConfiguration.

private RunConfiguration addConfiguration(Folder folder) {
    RunConfigurationEntry entry = ObjectCreatorUtils.createConfigEntry(TEST_NAME, true, new PipelineConfiguration());
    RunConfiguration configuration = ObjectCreatorUtils.createConfiguration(TEST_NAME, TEST_NAME, folder.getId(), TEST_USER, Collections.singletonList(entry));
    return configurationDao.create(configuration);
}
Also used : RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) RunConfigurationEntry(com.epam.pipeline.entity.configuration.RunConfigurationEntry) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration)

Example 10 with PipelineConfiguration

use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.

the class PipelineRunDaoTest method createTestPipelineRun.

private PipelineRun createTestPipelineRun(Long pipelineId) {
    PipelineRun run = new PipelineRun();
    run.setPipelineId(pipelineId);
    run.setVersion("abcdefg");
    run.setStartDate(new Date());
    run.setEndDate(run.getStartDate());
    run.setStatus(TaskStatus.RUNNING);
    run.setCommitStatus(CommitStatus.NOT_COMMITTED);
    run.setLastChangeCommitTime(new Date());
    run.setPodId(TEST_POD_ID);
    run.setParams(TEST_PARAMS);
    run.setOwner(USER);
    run.setServiceUrl(TEST_SERVICE_URL);
    Map<SystemParams, String> systemParams = EnvVarsBuilderTest.matchSystemParams();
    PipelineConfiguration configuration = EnvVarsBuilderTest.matchPipeConfig();
    EnvVarsBuilder.buildEnvVars(run, configuration, systemParams, null);
    run.setEnvVars(run.getEnvVars());
    pipelineRunDao.createPipelineRun(run);
    return run;
}
Also used : PipelineRun(com.epam.pipeline.entity.pipeline.PipelineRun) SystemParams(com.epam.pipeline.manager.execution.SystemParams) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration) Date(java.util.Date) LocalDate(java.time.LocalDate)

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