Browse Source

add recovery from stop

pull/2/head
lenboo 6 years ago
parent
commit
2a1283437c
  1. 12
      escheduler-api/src/main/java/cn/escheduler/api/service/ExecutorService.java
  2. 14
      escheduler-api/src/main/java/cn/escheduler/api/service/ProcessInstanceService.java
  3. 14
      escheduler-dao/src/main/java/cn/escheduler/dao/model/ProcessInstance.java
  4. 25
      escheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue
  5. 1
      escheduler-ui/src/js/module/i18n/locale/en_US.js
  6. 1
      escheduler-ui/src/js/module/i18n/locale/zh_CN.js

12
escheduler-api/src/main/java/cn/escheduler/api/service/ExecutorService.java

@ -191,6 +191,16 @@ public class ExecutorService extends BaseService{
return checkResult;
}
// checkTenantExists();
Tenant tenant = processDao.getTenantForProcess(processDefinition.getTenantId(),
processDefinition.getUserId());
if(tenant == null){
logger.error("there is not any vaild tenant for the process definition: id:{},name:{}, ",
processDefinition.getId(), processDefinition.getName());
putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceId);
return result;
}
switch (executeType) {
case REPEAT_RUNNING:
result = insertCommand(loginUser, processInstanceId, processDefinition.getId(), CommandType.REPEAT_RUNNING);
@ -260,7 +270,7 @@ public class ExecutorService extends BaseService{
}
break;
case RECOVER_SUSPENDED_PROCESS:
if (executionStatus.typeIsPause()) {
if (executionStatus.typeIsPause()|| executionStatus.typeIsCancel()) {
checkResult = true;
}
default:

14
escheduler-api/src/main/java/cn/escheduler/api/service/ProcessInstanceService.java

@ -38,10 +38,7 @@ import cn.escheduler.common.utils.JSONUtils;
import cn.escheduler.common.utils.ParameterUtils;
import cn.escheduler.common.utils.placeholder.BusinessTimeUtils;
import cn.escheduler.dao.ProcessDao;
import cn.escheduler.dao.mapper.ProcessDefinitionMapper;
import cn.escheduler.dao.mapper.ProcessInstanceMapper;
import cn.escheduler.dao.mapper.ProjectMapper;
import cn.escheduler.dao.mapper.TaskInstanceMapper;
import cn.escheduler.dao.mapper.*;
import cn.escheduler.dao.model.*;
import com.alibaba.fastjson.JSON;
import org.apache.commons.lang3.StringUtils;
@ -97,6 +94,9 @@ public class ProcessInstanceService extends BaseDAGService {
@Autowired
LoggerService loggerService;
@Autowired
WorkerGroupMapper workerGroupMapper;
/**
* query process instance by id
*
@ -115,6 +115,12 @@ public class ProcessInstanceService extends BaseDAGService {
return checkResult;
}
ProcessInstance processInstance = processDao.findProcessInstanceDetailById(processId);
if(processInstance.getWorkerGroupId() == -1){
processInstance.setWorkerGroupName("Default");
}else{
WorkerGroup workerGroup = workerGroupMapper.queryById(processInstance.getWorkerGroupId());
processInstance.setWorkerGroupName(workerGroup.getName());
}
result.put(Constants.DATA_LIST, processInstance);
putMsg(result, Status.SUCCESS);

14
escheduler-dao/src/main/java/cn/escheduler/dao/model/ProcessInstance.java

@ -194,6 +194,11 @@ public class ProcessInstance {
*/
private int tenantId;
/**
* worker group name. for api.
*/
private String workerGroupName;
public ProcessInstance(){
}
@ -549,6 +554,7 @@ public class ProcessInstance {
", dependenceScheduleTimes='" + dependenceScheduleTimes + '\'' +
", duration=" + duration +
", timeout=" + timeout +
", workerGroupName=" + workerGroupName +
", processInstancePriority=" + processInstancePriority +
'}';
}
@ -560,4 +566,12 @@ public class ProcessInstance {
public int getTenantId() {
return this.tenantId ;
}
public String getWorkerGroupName() {
return workerGroupName;
}
public void setWorkerGroupName(String workerGroupName) {
this.workerGroupName = workerGroupName;
}
}

25
escheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue

@ -95,10 +95,10 @@
shape="circle"
size="xsmall"
data-toggle="tooltip"
:title="$t('Stop')"
@click="_stop(item)"
:title="item.state === 'STOP' ? $t('Recovery Stop') : $t('Stop')"
@click="_stop(item,$index)"
icon="iconfont icon-zanting1"
:disabled="item.state !== 'RUNNING_EXEUTION'"></x-button>
:disabled="item.state !== 'RUNNING_EXEUTION' && item.state != 'STOP'"></x-button>
<x-button type="warning"
shape="circle"
size="xsmall"
@ -362,11 +362,20 @@
* stop
* @param STOP
*/
_stop (item) {
this._upExecutorsState({
processInstanceId: item.id,
executeType: 'STOP'
})
_stop (item, index) {
if(item.state == 'STOP') {
this._countDownFn({
id: item.id,
executeType: 'RECOVER_SUSPENDED_PROCESS',
index: index,
buttonType: 'suspend'
})
} else {
this._upExecutorsState({
processInstanceId: item.id,
executeType: 'STOP'
})
}
},
/**
* pause

1
escheduler-ui/src/js/module/i18n/locale/en_US.js

@ -238,6 +238,7 @@ export default {
'Stop': 'Stop',
'Pause': 'Pause',
'Recovery Suspend': 'Recovery Suspend',
'Recovery Stop': 'Recovery Stop',
'Gantt': 'Gantt',
'Name': 'Name',
'Node Type': 'Node Type',

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

@ -238,6 +238,7 @@ export default {
'Stop': '停止',
'Pause': '暂停',
'Recovery Suspend': '恢复暂停',
'Recovery Stop': '恢复停止',
'Gantt': '甘特图',
'Name': '名称',
'Node Type': '节点类型',

Loading…
Cancel
Save