use of com.dtstack.taier.common.enums.EComponentType in project Taier by DTStack.
the class ConsoleComponentService method convertComponentTypeToClient.
/**
* 根据组件类型转换对应的插件名称
* 如果只配yarn 需要调用插件时候 hdfs给默认值
*
* @param clusterName
* @param componentType
* @param versionName
* @return
*/
public String convertComponentTypeToClient(String clusterName, Integer componentType, String versionName, Integer storeType, Integer deployType) {
Cluster cluster = clusterMapper.getByClusterName(clusterName);
EComponentType type = EComponentType.getByCode(componentType);
EComponentType storeComponent = null == storeType ? null : EComponentType.getByCode(storeType);
PartCluster partCluster = clusterFactory.newImmediatelyLoadCluster(cluster.getId());
Part part = partCluster.create(type, versionName, storeComponent, deployType);
return part.getPluginName();
}
use of com.dtstack.taier.common.enums.EComponentType in project Taier by DTStack.
the class ConsoleClusterService method convertComponentToScheduling.
private List<SchedulingVo> convertComponentToScheduling(Table<Integer, String, KerberosConfig> kerberosTable, Map<EComponentScheduleType, List<IComponentVO>> scheduleType) {
List<SchedulingVo> schedulingVos = new ArrayList<>();
// 为空也返回
for (EComponentScheduleType value : EComponentScheduleType.values()) {
SchedulingVo schedulingVo = new SchedulingVo();
schedulingVo.setSchedulingCode(value.getType());
schedulingVo.setSchedulingName(value.getName());
List<IComponentVO> componentVoList = scheduleType.getOrDefault(value, Collections.emptyList());
if (Objects.nonNull(kerberosTable) && !kerberosTable.isEmpty() && CollectionUtils.isNotEmpty(componentVoList)) {
componentVoList.forEach(component -> {
// 组件每个版本设置k8s参数
for (ComponentVO componentVO : component.loadComponents()) {
KerberosConfig kerberosConfig;
EComponentType type = EComponentType.getByCode(componentVO.getComponentTypeCode());
if (type == EComponentType.YARN || type == EComponentType.SPARK_THRIFT || type == EComponentType.HIVE_SERVER) {
kerberosConfig = kerberosTable.get(type.getTypeCode(), StringUtils.EMPTY);
} else {
kerberosConfig = kerberosTable.get(componentVO.getComponentTypeCode(), StringUtils.isBlank(componentVO.getVersionValue()) ? StringUtils.EMPTY : componentVO.getVersionValue());
}
if (Objects.nonNull(kerberosConfig)) {
componentVO.setPrincipal(kerberosConfig.getPrincipal());
componentVO.setPrincipals(kerberosConfig.getPrincipals());
componentVO.setMergeKrb5Content(kerberosConfig.getMergeKrbContent());
}
}
});
}
schedulingVo.setComponents(componentVoList);
schedulingVos.add(schedulingVo);
}
return schedulingVos;
}
use of com.dtstack.taier.common.enums.EComponentType in project Taier by DTStack.
the class StoragePart method getExtraVersionParameters.
@Override
public Long getExtraVersionParameters() {
Component resourceComponent = componentScheduleGroup.get(EComponentScheduleType.RESOURCE).get(0);
String resourceVersion = resourceComponent.getVersionName();
EComponentType resourceType = EComponentType.getByCode(resourceComponent.getComponentTypeCode());
Optional<JSONObject> resourceModelExtraVersionParameters = context.getModelExtraVersionParameters(resourceType, resourceVersion);
if (resourceModelExtraVersionParameters.isPresent()) {
return resourceModelExtraVersionParameters.map(res -> res.getJSONObject(type.name())).orElse(new JSONObject()).getLong(type.name());
}
return null;
}
Aggregations