Search in sources :

Example 1 with FirecloudRunConfigurationEntry

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

the class FirecloudRunner method runAnalysis.

@Override
public List<PipelineRun> runAnalysis(AnalysisConfiguration<FirecloudRunConfigurationEntry> configuration) {
    Assert.state(CollectionUtils.isNotEmpty(configuration.getEntitiesIds()), "Entities are required to run analysis in Firecloud");
    FolderWithMetadata project = folderManager.getProject(configuration.getConfigurationId(), AclClass.CONFIGURATION);
    Assert.notNull(project, "Project folder must be specified to run analysis in Firecloud.");
    List<Long> entities = parameterMapper.fetchAndExpandInputEntities(configuration).values().stream().flatMap(Collection::stream).map(BaseEntity::getId).collect(Collectors.toList());
    // TODO: after merge - add check that FC class is filled
    configuration.getEntries().forEach(this::validateFirecloudConfiguration);
    FirecloudConfiguration settings = buildFirecloudConfig(configuration.getRefreshToken());
    return configuration.getEntries().stream().map(entry -> runFirecloudAnalysis(settings, entry, configuration.getConfigurationId(), entities, project.getId())).collect(Collectors.toList());
}
Also used : CredentialsManager(com.epam.pipeline.manager.google.CredentialsManager) PasswordGenerator(com.epam.pipeline.utils.PasswordGenerator) Arrays(java.util.Arrays) ParameterMapper(com.epam.pipeline.manager.pipeline.ParameterMapper) FirecloudCredentials(com.epam.pipeline.manager.google.FirecloudCredentials) PipelineRunManager(com.epam.pipeline.manager.pipeline.PipelineRunManager) RequiredArgsConstructor(lombok.RequiredArgsConstructor) SystemPreferences(com.epam.pipeline.manager.preference.SystemPreferences) HashMap(java.util.HashMap) StringUtils(org.apache.commons.lang3.StringUtils) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) PipelineRun(com.epam.pipeline.entity.pipeline.PipelineRun) FireCloudClass(com.epam.pipeline.entity.metadata.FireCloudClass) Service(org.springframework.stereotype.Service) FolderWithMetadata(com.epam.pipeline.entity.metadata.FolderWithMetadata) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration) BaseEntity(com.epam.pipeline.entity.BaseEntity) FirecloudPreferences(com.epam.pipeline.entity.pipeline.run.FirecloudPreferences) PipelineConfigurationManager(com.epam.pipeline.manager.pipeline.PipelineConfigurationManager) PreferenceManager(com.epam.pipeline.manager.preference.PreferenceManager) FolderManager(com.epam.pipeline.manager.pipeline.FolderManager) Collection(java.util.Collection) FirecloudRunConfigurationEntry(com.epam.pipeline.entity.configuration.FirecloudRunConfigurationEntry) Collectors(java.util.stream.Collectors) List(java.util.List) Builder(lombok.Builder) MetadataEntityManager(com.epam.pipeline.manager.metadata.MetadataEntityManager) Data(lombok.Data) AclClass(com.epam.pipeline.entity.security.acl.AclClass) SystemParams(com.epam.pipeline.manager.execution.SystemParams) PipelineStart(com.epam.pipeline.entity.pipeline.run.PipelineStart) MetadataClass(com.epam.pipeline.entity.metadata.MetadataClass) Assert(org.springframework.util.Assert) Collection(java.util.Collection) FolderWithMetadata(com.epam.pipeline.entity.metadata.FolderWithMetadata)

Example 2 with FirecloudRunConfigurationEntry

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

the class RunConfigurationDaoTest method testFirecloudConfigCreation.

@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testFirecloudConfigCreation() {
    List<InputsOutputs> inputs = Stream.of(InputsOutputs.builder().name(TEST_INPUT_NAME).type(TEST_INPUT_TYPE).value(TEST_INPUT_VALUE).build()).collect(Collectors.toList());
    List<InputsOutputs> outputs = Stream.of(InputsOutputs.builder().name(TEST_OUTPUT_NAME).value(TEST_OUTPUT_VALUE).build()).collect(Collectors.toList());
    // create
    FirecloudRunConfigurationEntry entry = ObjectCreatorUtils.createFirecloudConfigEntry(TEST_CONFIG_NAME, inputs, outputs, TEST_FIRECLOUD_METHOD, TEST_FIRECLOUD_METHOD_SNAPSHOT, TEST_FIRECLOUD_CONFIGURATION);
    RunConfiguration configuration = ObjectCreatorUtils.createConfiguration(TEST_NAME, TEST_DESCRIPTION, null, TEST_OWNER, Collections.singletonList(entry));
    RunConfiguration created = runConfigurationDao.create(configuration);
    verifyFirecloudConfiguration(configuration, created);
    // load
    RunConfiguration loaded = runConfigurationDao.load(created.getId());
    verifyFirecloudConfiguration(configuration, loaded);
}
Also used : FirecloudRunConfigurationEntry(com.epam.pipeline.entity.configuration.FirecloudRunConfigurationEntry) RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) InputsOutputs(com.epam.pipeline.entity.configuration.InputsOutputs) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with FirecloudRunConfigurationEntry

use of com.epam.pipeline.entity.configuration.FirecloudRunConfigurationEntry 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)

Example 4 with FirecloudRunConfigurationEntry

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

the class ConfigurationMapperTest method shouldMapFireCloudConfiguration.

@Test
void shouldMapFireCloudConfiguration() throws IOException {
    ConfigurationEntryMapper mapper = new ConfigurationEntryMapper();
    RunConfiguration runConfiguration = buildRunConfiguration();
    FirecloudRunConfigurationEntry entry = new FirecloudRunConfigurationEntry();
    entry.setName(TEST_NAME);
    entry.setMethodName(TEST_NAME);
    entry.setMethodSnapshot(TEST_SNAPSHOT);
    entry.setMethodConfigurationName(TEST_NAME);
    entry.setMethodConfigurationSnapshot(TEST_SNAPSHOT);
    ConfigurationEntryDoc configuration = buildDoc(null, runConfiguration, entry);
    XContentBuilder contentBuilder = mapper.map(buildContainer(configuration));
    verifyFirecloudConfigurationEntry(entry, contentBuilder);
    verifyRunConfiguration(runConfiguration, TEST_NAME + " ", contentBuilder);
    verifyPipelineUser(USER, contentBuilder);
    verifyPermissions(PERMISSIONS_CONTAINER, contentBuilder);
    verifyMetadata(EXPECTED_METADATA, contentBuilder);
}
Also used : FirecloudRunConfigurationEntry(com.epam.pipeline.entity.configuration.FirecloudRunConfigurationEntry) MapperVerificationUtils.verifyRunConfiguration(com.epam.pipeline.elasticsearchagent.MapperVerificationUtils.verifyRunConfiguration) RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) ConfigurationEntryDoc(com.epam.pipeline.elasticsearchagent.model.ConfigurationEntryDoc) XContentBuilder(org.elasticsearch.common.xcontent.XContentBuilder) Test(org.junit.jupiter.api.Test)

Example 5 with FirecloudRunConfigurationEntry

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

the class ObjectCreatorUtils method createFirecloudConfigEntry.

public static FirecloudRunConfigurationEntry createFirecloudConfigEntry(String name, List<InputsOutputs> inputs, List<InputsOutputs> outputs, String methodName, String methodSnapshot, String configName) {
    FirecloudRunConfigurationEntry entry = new FirecloudRunConfigurationEntry();
    entry.setName(name);
    entry.setMethodInputs(inputs);
    entry.setMethodOutputs(outputs);
    entry.setMethodName(methodName);
    entry.setMethodSnapshot(methodSnapshot);
    entry.setMethodConfigurationName(configName);
    return entry;
}
Also used : FirecloudRunConfigurationEntry(com.epam.pipeline.entity.configuration.FirecloudRunConfigurationEntry)

Aggregations

FirecloudRunConfigurationEntry (com.epam.pipeline.entity.configuration.FirecloudRunConfigurationEntry)5 RunConfiguration (com.epam.pipeline.entity.configuration.RunConfiguration)2 PipelineStart (com.epam.pipeline.entity.pipeline.run.PipelineStart)2 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)1 MapperVerificationUtils.verifyRunConfiguration (com.epam.pipeline.elasticsearchagent.MapperVerificationUtils.verifyRunConfiguration)1 ConfigurationEntryDoc (com.epam.pipeline.elasticsearchagent.model.ConfigurationEntryDoc)1 BaseEntity (com.epam.pipeline.entity.BaseEntity)1 InputsOutputs (com.epam.pipeline.entity.configuration.InputsOutputs)1 PipelineConfiguration (com.epam.pipeline.entity.configuration.PipelineConfiguration)1 FireCloudClass (com.epam.pipeline.entity.metadata.FireCloudClass)1 FolderWithMetadata (com.epam.pipeline.entity.metadata.FolderWithMetadata)1 MetadataClass (com.epam.pipeline.entity.metadata.MetadataClass)1 PipelineRun (com.epam.pipeline.entity.pipeline.PipelineRun)1 FirecloudPreferences (com.epam.pipeline.entity.pipeline.run.FirecloudPreferences)1 AclClass (com.epam.pipeline.entity.security.acl.AclClass)1 SystemParams (com.epam.pipeline.manager.execution.SystemParams)1 CredentialsManager (com.epam.pipeline.manager.google.CredentialsManager)1 FirecloudCredentials (com.epam.pipeline.manager.google.FirecloudCredentials)1 MetadataEntityManager (com.epam.pipeline.manager.metadata.MetadataEntityManager)1 FolderManager (com.epam.pipeline.manager.pipeline.FolderManager)1