package com.lanyuanxiaoyao.service.configuration.entity.yarn;

/**
 * Yarn Application 简化版实体类
 *
 * @author lanyuanxiaoyao
 * @date 2023-04-19
 */
public final class YarnApplication {
    private String cluster;
    private String id;
    private String user;
    private String queue;
    private String name;
    private String state;
    private String finalStatus;
    private Float progress;
    private String diagnostics;
    private String applicationType;
    private Long startedTime;
    private Long launchTime;
    private Long finishedTime;
    private Long elapsedTime;
    private String trackingUrl;
    private Long allocatedMB;
    private Long allocatedVCores;
    private Integer runningContainers;
    private Float queueUsagePercentage;
    private Float clusterUsagePercentage;

    public String getCluster() {
        return cluster;
    }

    public YarnApplication setCluster(String cluster) {
        this.cluster = cluster;
        return this;
    }

    public String getId() {
        return id;
    }

    public String getUser() {
        return user;
    }

    public String getQueue() {
        return queue;
    }

    public String getName() {
        return name;
    }

    public String getState() {
        return state;
    }

    public String getFinalStatus() {
        return finalStatus;
    }

    public Float getProgress() {
        return progress;
    }

    public String getDiagnostics() {
        return diagnostics;
    }

    public String getApplicationType() {
        return applicationType;
    }

    public Long getStartedTime() {
        return startedTime;
    }

    public Long getLaunchTime() {
        return launchTime;
    }

    public Long getFinishedTime() {
        return finishedTime;
    }

    public Long getElapsedTime() {
        return elapsedTime;
    }

    public String getTrackingUrl() {
        return trackingUrl;
    }

    public Long getAllocatedMB() {
        return allocatedMB;
    }

    public Long getAllocatedVCores() {
        return allocatedVCores;
    }

    public Integer getRunningContainers() {
        return runningContainers;
    }

    public Float getQueueUsagePercentage() {
        return queueUsagePercentage;
    }

    public Float getClusterUsagePercentage() {
        return clusterUsagePercentage;
    }

    @Override
    public String toString() {
        return "YarnApplication{" +
               "cluster='" + cluster + '\'' +
               ", id='" + id + '\'' +
               ", user='" + user + '\'' +
               ", queue='" + queue + '\'' +
               ", name='" + name + '\'' +
               ", state='" + state + '\'' +
               ", finalStatus='" + finalStatus + '\'' +
               ", progress=" + progress +
               ", diagnostics='" + diagnostics + '\'' +
               ", applicationType='" + applicationType + '\'' +
               ", startedTime=" + startedTime +
               ", launchTime=" + launchTime +
               ", finishedTime=" + finishedTime +
               ", elapsedTime=" + elapsedTime +
               ", trackingUrl='" + trackingUrl + '\'' +
               ", allocatedMB=" + allocatedMB +
               ", allocatedVCores=" + allocatedVCores +
               ", runningContainers=" + runningContainers +
               ", queueUsagePercentage=" + queueUsagePercentage +
               ", clusterUsagePercentage=" + clusterUsagePercentage +
               '}';
    }

    public static final class State {
        /**
         * Application which was just created.
         */
        public static final String NEW = "NEW";
        /**
         * Application which has been submitted.
         */
        public static final String NEW_SAVING = "NEW_SAVING";
        /**
         * Application which has been submitted.
         */
        public static final String SUBMITTED = "SUBMITTED";
        /**
         * Application has been accepted by the scheduler
         */
        public static final String ACCEPTED = "ACCEPTED";
        /**
         * Application which is currently running.
         */
        public static final String RUNNING = "RUNNING";
        /**
         * Application which finished successfully.
         */
        public static final String FINISHED = "FINISHED";
        /**
         * Application which failed.
         */
        public static final String FAILED = "FAILED";
        /**
         * Application which was terminated by a user or admin.
         */
        public static final String KILLED = "KILLED";
    }
}
