提交 2a128343 编写于 作者: leon-baoliang's avatar leon-baoliang

add recovery from stop

上级 b8a9ef55
......@@ -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:
......
......@@ -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);
......
......@@ -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;
}
}
......@@ -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
......
......@@ -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',
......
......@@ -238,6 +238,7 @@ export default {
'Stop': '停止',
'Pause': '暂停',
'Recovery Suspend': '恢复暂停',
'Recovery Stop': '恢复停止',
'Gantt': '甘特图',
'Name': '名称',
'Node Type': '节点类型',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册