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
RetryPolicy retryPolicy = new ExponentialBackoffRetry(
Integer.parseInt(conf.getString(Constants.ZOOKEEPER_RETRY_SLEEP)),
Integer.parseInt(conf.getString(Constants.ZOOKEEPER_RETRY_MAXTIME)));
conf.getInt(Constants.ZOOKEEPER_RETRY_SLEEP),
conf.getInt(Constants.ZOOKEEPER_RETRY_MAXTIME));
try{
// crate zookeeper client
zkClient = CuratorFrameworkFactory.builder()
.connectString(getZookeeperQuorum())
.retryPolicy(retryPolicy)
.sessionTimeoutMs(1000 * Integer.parseInt(conf.getString(Constants.ZOOKEEPER_SESSION_TIMEOUT)))
.connectionTimeoutMs(1000 * Integer.parseInt(conf.getString(Constants.ZOOKEEPER_CONNECTION_TIMEOUT)))
.sessionTimeoutMs(1000 * conf.getInt(Constants.ZOOKEEPER_SESSION_TIMEOUT))
.connectionTimeoutMs(1000 * conf.getInt(Constants.ZOOKEEPER_CONNECTION_TIMEOUT))
.build();
zkClient.start();
@ -240,7 +240,6 @@ public abstract class AbstractZKClient {
return registerPath;
}
registerPath = createZNodePath(zkNodeType);
logger.info("register {} node {} success", zkNodeType.toString(), registerPath);
// handle dead server
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
* @param alergroupId
* @param alertgroupId
* @return
*/
public List<User> listUserByAlertgroupId(int alergroupId){
return userAlertGroupMapper.listUserByAlertgroupId(alergroupId);
public List<User> listUserByAlertgroupId(int alertgroupId){
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) {
int taskWorkerGroupId = taskInstance.getWorkerGroupId();
int processInstanceId = taskInstance.getProcessInstanceId();
if(taskWorkerGroupId > 0){
return taskWorkerGroupId;
}
int processInstanceId = taskInstance.getProcessInstanceId();
ProcessInstance processInstance = findProcessInstanceById(processInstanceId);
if(processInstance == null){
logger.error("cannot find the task:{} process instance", taskInstance.getId());
return Constants.DEFAULT_WORKER_ID;
if(processInstance != null){
return processInstance.getWorkerGroupId();
}
int processWorkerGroupId = processInstance.getWorkerGroupId();
taskWorkerGroupId = (taskWorkerGroupId <= 0 ? processWorkerGroupId : taskWorkerGroupId);
return taskWorkerGroupId;
logger.info("task : {} will use default worker group id", taskInstance.getId());
return Constants.DEFAULT_WORKER_ID;
}
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数量',
'jobManagerMemory':'jobManager内存数',
'taskManagerMemory':'taskManager内存数',
'Complement range': '补数范围',
'Http Url':'请求地址',
'Http Method':'请求类型',
'Http Parameters':'请求参数',

Loading…
Cancel
Save