All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alibaba.schedulerx.worker.master.BatchTaskMaster Maven / Gradle / Ivy

There is a newer version: 1.12.2
Show newest version
package com.alibaba.schedulerx.worker.master;

import java.io.IOException;

import com.alibaba.schedulerx.common.domain.JobInstanceInfo;
import com.alibaba.schedulerx.common.util.ConfigUtil;
import com.alibaba.schedulerx.worker.domain.WorkerConstants;
import com.alibaba.schedulerx.worker.log.LogFactory;
import com.alibaba.schedulerx.worker.log.Logger;
import com.alibaba.schedulerx.worker.master.persistence.H2FilePersistence;
import com.alibaba.schedulerx.worker.util.SystemManagementUtil;

import akka.actor.ActorContext;

/**
 *
 * @author xiaomeng.hxm
 */
public class BatchTaskMaster extends GridTaskMaster {
    private static final Logger LOGGER = LogFactory.getLogger(BatchTaskMaster.class);

    public BatchTaskMaster(JobInstanceInfo jobInstanceInfo, ActorContext actorContext) throws Exception {
        super(jobInstanceInfo, actorContext);
        this.taskPersistence = H2FilePersistence.getInstance();
        this.taskPersistence.initTable();
    }

    /**
     * Master各类指标信息检查
     */
    @Override
    protected void doMetricsCheck() throws IOException {
        float usedDiskPercent = SystemManagementUtil.getUserDiskSpacePercent();
        float maxDiskPercent = ConfigUtil.getWorkerConfig().getFloat(WorkerConstants.MAP_DISK_PERCENT_MAX, 
            WorkerConstants.USER_DISK_PERCENT_DEFAULT);
        if (usedDiskPercent > maxDiskPercent) {
            throw new IOException("disk usage:" + usedDiskPercent * 100 + ",beyond " + maxDiskPercent * 100 + "%!");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy