Search in sources :

Example 6 with ClusterResource

use of com.dtstack.taier.pluginapi.pojo.ClusterResource in project Taier by DTStack.

the class ConsoleService method clusterResources.

public ClusterResource clusterResources(String clusterName) {
    if (StringUtils.isEmpty(clusterName)) {
        return new ClusterResource();
    }
    Cluster cluster = clusterMapper.getByClusterName(clusterName);
    if (cluster == null) {
        throw new RdosDefineException(ErrorCode.DATA_NOT_FIND);
    }
    Component yarnComponent = componentService.getComponentByClusterId(cluster.getId(), EComponentType.YARN.getTypeCode(), null);
    if (yarnComponent == null) {
        return null;
    }
    JSONObject yarnConfigStr = componentService.getComponentByClusterId(cluster.getId(), EComponentType.YARN.getTypeCode(), false, JSONObject.class, null);
    return getResources(yarnComponent, cluster, yarnConfigStr);
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) RdosDefineException(com.dtstack.taier.common.exception.RdosDefineException) ClusterResource(com.dtstack.taier.pluginapi.pojo.ClusterResource)

Aggregations

ClusterResource (com.dtstack.taier.pluginapi.pojo.ClusterResource)6 JSONObject (com.alibaba.fastjson.JSONObject)3 JobClient (com.dtstack.taier.pluginapi.JobClient)3 PluginDefineException (com.dtstack.taier.pluginapi.exception.PluginDefineException)3 ParamAction (com.dtstack.taier.pluginapi.pojo.ParamAction)3 Map (java.util.Map)2 Properties (java.util.Properties)2 YarnClient (org.apache.hadoop.yarn.client.api.YarnClient)2 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)2 RdosDefineException (com.dtstack.taier.common.exception.RdosDefineException)1 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 ArrayList (java.util.ArrayList)1 NodeReport (org.apache.hadoop.yarn.api.records.NodeReport)1 Resource (org.apache.hadoop.yarn.api.records.Resource)1