Browse Source

using conf.getInt instead of getString (#1010)

* move updateTaskState into try/catch block in case of exception

* fix NPE

* using conf.getInt instead of getString

* for AbstractZKClient, remove the log, for it will print the same log message in createZNodePath.
for AlertDao, correct the spelling.

* duplicate

* refactor getTaskWorkerGroupId

* add friendly log
pull/2/head
Tboy 5 years ago committed by bao liang
parent
commit
a75859c94d
  1. 9
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/zk/AbstractZKClient.java
  2. 6
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java
  3. 16
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/ProcessDao.java
  4. 1
      dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js

9
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/zk/AbstractZKClient.java

@ -78,16 +78,16 @@ public abstract class AbstractZKClient {
// retry strategy // retry strategy
RetryPolicy retryPolicy = new ExponentialBackoffRetry( RetryPolicy retryPolicy = new ExponentialBackoffRetry(
Integer.parseInt(conf.getString(Constants.ZOOKEEPER_RETRY_SLEEP)), conf.getInt(Constants.ZOOKEEPER_RETRY_SLEEP),
Integer.parseInt(conf.getString(Constants.ZOOKEEPER_RETRY_MAXTIME))); conf.getInt(Constants.ZOOKEEPER_RETRY_MAXTIME));
try{ try{
// crate zookeeper client // crate zookeeper client
zkClient = CuratorFrameworkFactory.builder() zkClient = CuratorFrameworkFactory.builder()
.connectString(getZookeeperQuorum()) .connectString(getZookeeperQuorum())
.retryPolicy(retryPolicy) .retryPolicy(retryPolicy)
.sessionTimeoutMs(1000 * Integer.parseInt(conf.getString(Constants.ZOOKEEPER_SESSION_TIMEOUT))) .sessionTimeoutMs(1000 * conf.getInt(Constants.ZOOKEEPER_SESSION_TIMEOUT))
.connectionTimeoutMs(1000 * Integer.parseInt(conf.getString(Constants.ZOOKEEPER_CONNECTION_TIMEOUT))) .connectionTimeoutMs(1000 * conf.getInt(Constants.ZOOKEEPER_CONNECTION_TIMEOUT))
.build(); .build();
zkClient.start(); zkClient.start();
@ -240,7 +240,6 @@ public abstract class AbstractZKClient {
return registerPath; return registerPath;
} }
registerPath = createZNodePath(zkNodeType); registerPath = createZNodePath(zkNodeType);
logger.info("register {} node {} success", zkNodeType.toString(), registerPath);
// handle dead server // handle dead server
handleDeadServer(registerPath, zkNodeType, Constants.DELETE_ZK_OP); handleDeadServer(registerPath, zkNodeType, Constants.DELETE_ZK_OP);

6
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java

@ -162,11 +162,11 @@ public class AlertDao extends AbstractBaseDao {
/** /**
* list user information by alert group id * list user information by alert group id
* @param alergroupId * @param alertgroupId
* @return * @return
*/ */
public List<User> listUserByAlertgroupId(int alergroupId){ public List<User> listUserByAlertgroupId(int alertgroupId){
return userAlertGroupMapper.listUserByAlertgroupId(alergroupId); return userAlertGroupMapper.listUserByAlertgroupId(alertgroupId);
} }

16
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/ProcessDao.java

@ -1686,18 +1686,18 @@ public class ProcessDao extends AbstractBaseDao {
*/ */
public int getTaskWorkerGroupId(TaskInstance taskInstance) { public int getTaskWorkerGroupId(TaskInstance taskInstance) {
int taskWorkerGroupId = taskInstance.getWorkerGroupId(); int taskWorkerGroupId = taskInstance.getWorkerGroupId();
int processInstanceId = taskInstance.getProcessInstanceId();
if(taskWorkerGroupId > 0){
return taskWorkerGroupId;
}
int processInstanceId = taskInstance.getProcessInstanceId();
ProcessInstance processInstance = findProcessInstanceById(processInstanceId); ProcessInstance processInstance = findProcessInstanceById(processInstanceId);
if(processInstance == null){ if(processInstance != null){
logger.error("cannot find the task:{} process instance", taskInstance.getId()); return processInstance.getWorkerGroupId();
return Constants.DEFAULT_WORKER_ID;
} }
int processWorkerGroupId = processInstance.getWorkerGroupId(); logger.info("task : {} will use default worker group id", taskInstance.getId());
return Constants.DEFAULT_WORKER_ID;
taskWorkerGroupId = (taskWorkerGroupId <= 0 ? processWorkerGroupId : taskWorkerGroupId);
return taskWorkerGroupId;
} }
public List<Project> getProjectListHavePerm(int userId){ public List<Project> getProjectListHavePerm(int userId){

1
dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js

@ -485,7 +485,6 @@ export default {
'taskManager':'taskManage数量', 'taskManager':'taskManage数量',
'jobManagerMemory':'jobManager内存数', 'jobManagerMemory':'jobManager内存数',
'taskManagerMemory':'taskManager内存数', 'taskManagerMemory':'taskManager内存数',
'Complement range': '补数范围',
'Http Url':'请求地址', 'Http Url':'请求地址',
'Http Method':'请求类型', 'Http Method':'请求类型',
'Http Parameters':'请求参数', 'Http Parameters':'请求参数',

Loading…
Cancel
Save