package com.lanyuanxiaoyao.service.scheduler.quartz.distribute.cluster;

import com.lanyuanxiaoyao.service.common.Constants;
import com.lanyuanxiaoyao.service.forest.service.YarnService;
import com.lanyuanxiaoyao.service.scheduler.quartz.distribute.strategy.AvailableStrategy;
import com.lanyuanxiaoyao.service.scheduler.quartz.distribute.strategy.QueueSizeLimit;
import com.lanyuanxiaoyao.service.scheduler.quartz.distribute.strategy.YarnQueueUsedLimit;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.stereotype.Component;

/**
 * A4
 *
 * @author lanyuanxiaoyao
 * @date 2023-06-08
 */
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Component
public class A4Cluster extends Cluster {
    public A4Cluster(DiscoveryClient client, YarnService yarnService) {
        super(
                Constants.CLUSTER_A4,
                Constants.COMPACTION_QUEUE_A4,
                AvailableStrategy.and(
                        new QueueSizeLimit(client, Constants.COMPACTION_QUEUE_A4, 10),
                        new YarnQueueUsedLimit(yarnService, Constants.CLUSTER_A4, "ten_iap.datalake", 0.8)
                )
        );
    }
}
