use of com.dtstack.taier.dao.domain.Component in project Taier by DTStack.
the class TenantService method initDataDevelop.
@Transactional(rollbackFor = Exception.class)
public void initDataDevelop(Long clusterId, Long tenantId, Long userId, String tenantName, String tenantDesc, List<ComponentBindDBDTO> bindDBDTOList) throws Exception {
// 初始化目录
List<Component> components = componentService.listAllComponents(clusterId);
List<ComponentVO> componentVOS = ComponentVO.toVOS(components);
batchCatalogueService.initCatalogue(tenantId, userId, componentVOS);
// 初始化数据源相关的信息
IComponentService componentService = null;
for (ComponentBindDBDTO componentBindDBDTO : bindDBDTOList) {
EComponentType eComponentType = EComponentType.getByCode(componentBindDBDTO.getComponentCode());
String componentIdentity = tenantName;
// db相关的操作
if (BooleanUtils.isTrue(componentBindDBDTO.getCreateFlag())) {
componentService = multiEngineServiceFactory.getComponentService(eComponentType.getTypeCode());
componentService.createDatabase(clusterId, eComponentType, componentIdentity, tenantDesc);
} else {
componentIdentity = componentBindDBDTO.getDbName();
}
// 初始化数据源
datasourceService.initDefaultSource(clusterId, eComponentType, tenantId, componentIdentity, tenantDesc, userId);
// 初始化租户引擎关系
TenantComponent tenantEngine = new TenantComponent();
tenantEngine.setTaskType(ComponentTypeToEScheduleJobMapping.getEScheduleTypeByComponentCode(eComponentType.getTypeCode()).getType());
tenantEngine.setTenantId(tenantId);
tenantEngine.setComponentIdentity(componentIdentity);
tenantEngine.setCreateUserId(userId);
tenantEngine.setStatus(0);
developTenantComponentService.insert(tenantEngine);
}
}
use of com.dtstack.taier.dao.domain.Component in project Taier by DTStack.
the class FlinkResource method getResourceEComponentType.
public EComponentType getResourceEComponentType(JobClient jobClient) {
long tenantId = jobClient.getTenantId();
Long clusterId = clusterTenantMapper.getClusterIdByTenantId(tenantId);
Component flinkComponent = componentService.getComponentByClusterId(clusterId, EComponentType.FLINK.getTypeCode(), null);
if (null != flinkComponent) {
if (EDeployType.STANDALONE.getType() == flinkComponent.getDeployType()) {
return EComponentType.FLINK;
} else if (EDeployType.YARN.getType() == flinkComponent.getDeployType()) {
return EComponentType.YARN;
}
}
throw new RdosDefineException("No found resource EComponentType");
}
use of com.dtstack.taier.dao.domain.Component in project Taier by DTStack.
the class StoragePart method getPluginName.
@Override
public String getPluginName() {
List<Component> components = componentScheduleGroup.get(EComponentScheduleType.RESOURCE);
if (CollectionUtils.isEmpty(components)) {
throw new RdosDefineException(ErrorCode.RESOURCE_COMPONENT_NOT_CONFIG);
}
Component resourceComponent = components.get(0);
String resourceVersion = resourceComponent.getVersionName();
EComponentType resourceType = EComponentType.getByCode(resourceComponent.getComponentTypeCode());
Optional<JSONObject> resourceModelConfig = context.getModelConfig(resourceType, resourceVersion);
JSONObject storageModelConfig = resourceModelConfig.map(res -> res.getJSONObject(type.name())).orElseThrow(() -> new RdosDefineException(Strings.format(ErrorCode.RESOURCE_NOT_SUPPORT_COMPONENT_VERSION.getMsg(), resourceComponent.getComponentName(), type.name(), versionName)));
return storageModelConfig.getString(type.name());
}
use of com.dtstack.taier.dao.domain.Component in project Taier by DTStack.
the class DependComputePart method getExtraVersionParameters.
public Long getExtraVersionParameters() {
Component resourceComponent = componentScheduleGroup.get(EComponentScheduleType.RESOURCE).get(0);
String resourceVersion = resourceComponent.getVersionName();
EComponentType resourceType = EComponentType.getByCode(resourceComponent.getComponentTypeCode());
Optional<JSONObject> resourceModelExtraConfig = context.getModelExtraVersionParameters(resourceType, resourceVersion);
String extraTemplateId = null;
if (resourceModelExtraConfig.isPresent()) {
extraTemplateId = getValueInConfigWithResourceStore(resourceModelExtraConfig.get(), resourceComponent, null);
if (StringUtils.isNotBlank(extraTemplateId)) {
return Long.parseLong(extraTemplateId);
}
}
// 依赖resource 但是不依赖resource的类型拼接额外参数信息 如hive2
extraTemplateId = context.getModelExtraVersionParameters(type, versionName).map((extraConfig) -> extraConfig.getString(versionName)).orElse(null);
if (StringUtils.isNotBlank(extraTemplateId)) {
return Long.parseLong(extraTemplateId);
}
return null;
}
use of com.dtstack.taier.dao.domain.Component in project Taier by DTStack.
the class DependComputePart method getPluginName.
@Override
public String getPluginName() {
validDeployType(deployType);
if (null == storageType) {
throw new RdosDefineException(ErrorCode.STORE_COMPONENT_NOT_CONFIG);
}
List<Component> components = componentScheduleGroup.get(EComponentScheduleType.RESOURCE);
if (CollectionUtils.isEmpty(components)) {
throw new RdosDefineException(ErrorCode.RESOURCE_COMPONENT_NOT_CONFIG);
}
Component resourceComponent = components.get(0);
String resourceVersion = resourceComponent.getVersionName();
EComponentType resourceType = EComponentType.getByCode(resourceComponent.getComponentTypeCode());
Optional<JSONObject> resourceModelConfig = context.getModelConfig(resourceType, resourceVersion);
if (!resourceModelConfig.isPresent()) {
throw new RdosDefineException(Strings.format(ErrorCode.RESOURCE_NOT_SUPPORT_COMPONENT_VERSION.getMsg(), resourceType, type, versionName));
}
// 唯一的pluginName
return getValueInConfigWithResourceStore(resourceModelConfig.get(), resourceComponent, this::getPluginNameInModelOrByConfigVersion);
}
Aggregations