Commit 497cb97b authored by lidongdai's avatar lidongdai
Browse files

Merge remote-tracking branch 'upstream/dev-1.1.0' into dev-1.1.0

parents af217278 e0da46d6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ public class MonitorController extends BaseController{
        logger.info("login user: {}, query all master", loginUser.getUserName());
        try{
            logger.info("list master, user:{}", loginUser.getUserName());
            Map<String, Object> result = serverService.queryMaster(loginUser);
            Map<String, Object> result = monitorService.queryMaster(loginUser);
            return returnDataList(result);
        }catch (Exception e){
            logger.error(LIST_MASTERS_ERROR.getMsg(),e);
@@ -86,7 +86,7 @@ public class MonitorController extends BaseController{
    public Result listWorker(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
        logger.info("login user: {}, query all workers", loginUser.getUserName());
        try{
            Map<String, Object> result = serverService.queryWorker(loginUser);
            Map<String, Object> result = monitorService.queryWorker(loginUser);
            return returnDataList(result);
        }catch (Exception e){
            logger.error(LIST_WORKERS_ERROR.getMsg(),e);
+1 −0
Original line number Diff line number Diff line
@@ -163,6 +163,7 @@ public enum Status {
    BATCH_DELETE_PROCESS_INSTANCE_BY_IDS_ERROR(10117,"batch delete process instance by ids {0} error"),
    PREVIEW_SCHEDULE_ERROR(10139,"preview schedule error"),
    PARSE_TO_CRON_EXPRESSION_ERROR(10140,"parse cron to cron expression error"),
    SCHEDULE_START_TIME_END_TIME_SAME(10141,"The start time must not be the same as the end"),


    UDF_FUNCTION_NOT_EXIST(20001, "UDF function not found"),
+4 −5
Original line number Diff line number Diff line
@@ -67,14 +67,10 @@ public class DataSourceService extends BaseService{
    public static final String PASSWORD = cn.escheduler.common.Constants.PASSWORD;
    public static final String OTHER = "other";

    @Autowired
    private ProjectMapper projectMapper;

    @Autowired
    private DataSourceMapper dataSourceMapper;

    @Autowired
    private ProjectService projectService;

    @Autowired
    private DatasourceUserMapper datasourceUserMapper;
@@ -522,7 +518,10 @@ public class DataSourceService extends BaseService{
        parameterMap.put(Constants.JDBC_URL, jdbcUrl);
        parameterMap.put(Constants.USER, userName);
        parameterMap.put(Constants.PASSWORD, password);
        if (CommonUtils.getKerberosStartupState() &&
                (type == DbType.HIVE || type == DbType.SPARK)){
            parameterMap.put(Constants.PRINCIPAL,principal);
        }
        if (other != null && !"".equals(other)) {
            Map map = JSONObject.parseObject(other, new TypeReference<LinkedHashMap<String, String>>() {
            });
+39 −2
Original line number Diff line number Diff line
@@ -18,13 +18,16 @@ package cn.escheduler.api.service;

import cn.escheduler.api.enums.Status;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.ZookeeperMonitorUtils;
import cn.escheduler.api.utils.ZookeeperMonitor;
import cn.escheduler.dao.MonitorDBDao;
import cn.escheduler.dao.model.MasterServer;
import cn.escheduler.dao.model.MonitorRecord;
import cn.escheduler.dao.model.User;
import cn.escheduler.dao.model.ZookeeperRecord;
import org.apache.hadoop.mapred.Master;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -52,6 +55,22 @@ public class MonitorService extends BaseService{

  }

  /**
   * query master list
   *
   * @param loginUser
   * @return
   */
  public Map<String,Object> queryMaster(User loginUser) {

    Map<String, Object> result = new HashMap<>(5);

    List<MasterServer> masterServers = new ZookeeperMonitor().getMasterServers();
    result.put(Constants.DATA_LIST, masterServers);
    putMsg(result,Status.SUCCESS);

    return result;
  }

  /**
   * query zookeeper state
@@ -61,7 +80,7 @@ public class MonitorService extends BaseService{
  public Map<String,Object> queryZookeeperState(User loginUser) {
    Map<String, Object> result = new HashMap<>(5);

    List<ZookeeperRecord> zookeeperRecordList = ZookeeperMonitorUtils.zookeeperInfoList();
    List<ZookeeperRecord> zookeeperRecordList = ZookeeperMonitor.zookeeperInfoList();

    result.put(Constants.DATA_LIST, zookeeperRecordList);
    putMsg(result, Status.SUCCESS);
@@ -69,4 +88,22 @@ public class MonitorService extends BaseService{
    return result;

  }


  /**
   * query master list
   *
   * @param loginUser
   * @return
   */
  public Map<String,Object> queryWorker(User loginUser) {

    Map<String, Object> result = new HashMap<>(5);

    List<MasterServer> workerServers = new ZookeeperMonitor().getWorkerServers();
    result.put(Constants.DATA_LIST, workerServers);
    putMsg(result,Status.SUCCESS);

    return result;
  }
}
+10 −0
Original line number Diff line number Diff line
@@ -119,6 +119,11 @@ public class SchedulerService extends BaseService {
        scheduleObj.setProcessDefinitionName(processDefinition.getName());

        ScheduleParam scheduleParam = JSONUtils.parseObject(schedule, ScheduleParam.class);
        if (DateUtils.differSec(scheduleParam.getStartTime(),scheduleParam.getEndTime()) == 0) {
            logger.warn("The start time must not be the same as the end");
            putMsg(result,Status.SCHEDULE_START_TIME_END_TIME_SAME);
            return result;
        }
        scheduleObj.setStartTime(scheduleParam.getStartTime());
        scheduleObj.setEndTime(scheduleParam.getEndTime());
        if (!org.quartz.CronExpression.isValidExpression(scheduleParam.getCrontab())) {
@@ -205,6 +210,11 @@ public class SchedulerService extends BaseService {
        // updateProcessInstance param
        if (StringUtils.isNotEmpty(scheduleExpression)) {
            ScheduleParam scheduleParam = JSONUtils.parseObject(scheduleExpression, ScheduleParam.class);
            if (DateUtils.differSec(scheduleParam.getStartTime(),scheduleParam.getEndTime()) == 0) {
                logger.warn("The start time must not be the same as the end");
                putMsg(result,Status.SCHEDULE_START_TIME_END_TIME_SAME);
                return result;
            }
            schedule.setStartTime(scheduleParam.getStartTime());
            schedule.setEndTime(scheduleParam.getEndTime());
            if (!org.quartz.CronExpression.isValidExpression(scheduleParam.getCrontab())) {
Loading