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());
}
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);
}
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());
}
}
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);
}
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;
}
Aggregations