Search in sources :

Example 1 with ComputeType

use of com.dtstack.taier.pluginapi.enums.ComputeType in project Taier by DTStack.

the class FlinkResource method getComputeResourceType.

@Override
public ComputeResourceType getComputeResourceType(JobClient jobClient) {
    long tenantId = jobClient.getTenantId();
    EComponentType componentType = resourceComponents.computeIfAbsent(tenantId, e -> getResourceEComponentType(jobClient));
    Properties properties = jobClient.getConfProperties();
    ComputeType computeType = jobClient.getComputeType();
    String modeStr = properties.getProperty(FLINK_TASK_RUN_MODE_KEY);
    if (EComponentType.FLINK.getTypeCode().equals(componentType.getTypeCode())) {
        // flink on standalone
        return ComputeResourceType.FlinkOnStandalone;
    } else if (EComponentType.YARN.getTypeCode().equals(componentType.getTypeCode())) {
        if (StringUtils.isEmpty(modeStr)) {
            if (ComputeType.STREAM == computeType) {
                return ComputeResourceType.Yarn;
            } else {
                return ComputeResourceType.FlinkYarnSession;
            }
        }
        if (SESSION.equalsIgnoreCase(modeStr)) {
            return ComputeResourceType.FlinkYarnSession;
        } else if (PER_JOB.equalsIgnoreCase(modeStr)) {
            return ComputeResourceType.Yarn;
        } else if (STANDALONE.equals(modeStr)) {
            return ComputeResourceType.FlinkOnStandalone;
        }
    }
    throw new RdosDefineException("not support mode: " + modeStr);
}
Also used : RdosDefineException(com.dtstack.taier.common.exception.RdosDefineException) Properties(java.util.Properties) ComputeType(com.dtstack.taier.pluginapi.enums.ComputeType) EComponentType(com.dtstack.taier.common.enums.EComponentType)

Aggregations

EComponentType (com.dtstack.taier.common.enums.EComponentType)1 RdosDefineException (com.dtstack.taier.common.exception.RdosDefineException)1 ComputeType (com.dtstack.taier.pluginapi.enums.ComputeType)1 Properties (java.util.Properties)1