| @@ -1,62 +0,0 @@ | |||
| package com.ruoyi.platform.controller.textClassfication; | |||
| import com.ruoyi.common.core.web.controller.BaseController; | |||
| import com.ruoyi.common.core.web.domain.GenericsAjaxResult; | |||
| import com.ruoyi.platform.domain.TextClassification; | |||
| import com.ruoyi.platform.service.TextClassificationService; | |||
| import com.ruoyi.platform.vo.TextClassificationVo; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.data.domain.PageRequest; | |||
| import javax.annotation.Resource; | |||
| import java.io.IOException; | |||
| @RestController | |||
| @RequestMapping("textClassification") | |||
| @Api("文本分类") | |||
| public class TextClassificationController extends BaseController { | |||
| @Resource | |||
| private TextClassificationService textClassificationService; | |||
| @GetMapping | |||
| @ApiOperation("分页查询") | |||
| public GenericsAjaxResult<Page<TextClassification>> queryByPage(@RequestParam("page") int page, | |||
| @RequestParam("size") int size, | |||
| @RequestParam(value = "name", required = false) String name) { | |||
| PageRequest pageRequest = PageRequest.of(page, size); | |||
| return genericsSuccess(this.textClassificationService.queryByPage(name, pageRequest)); | |||
| } | |||
| @PostMapping | |||
| @ApiOperation("新增文本分类") | |||
| public GenericsAjaxResult<TextClassification> add(@RequestBody TextClassificationVo textClassificationVo) throws Exception { | |||
| return genericsSuccess(this.textClassificationService.save(textClassificationVo)); | |||
| } | |||
| @PutMapping | |||
| @ApiOperation("编辑文本分类") | |||
| public GenericsAjaxResult<String> edit(@RequestBody TextClassificationVo textClassificationVo) throws Exception { | |||
| return genericsSuccess(this.textClassificationService.edit(textClassificationVo)); | |||
| } | |||
| @GetMapping("/getTextClassificationDetail") | |||
| @ApiOperation("获取文本分类详细信息") | |||
| public GenericsAjaxResult<TextClassificationVo> getTextClassificationDetail(@RequestParam("id") Long id) throws IOException { | |||
| return genericsSuccess(this.textClassificationService.getTextClassificationDetail(id)); | |||
| } | |||
| @DeleteMapping("{id}") | |||
| @ApiOperation("删除文本分类") | |||
| public GenericsAjaxResult<String> deleteTextClassification(@PathVariable("id") Long id) { | |||
| return genericsSuccess(this.textClassificationService.delete(id)); | |||
| } | |||
| @PostMapping("/run/{id}") | |||
| @ApiOperation("运行文本分类") | |||
| public GenericsAjaxResult<String> runTextClassification(@PathVariable("id") Long id) throws Exception { | |||
| return genericsSuccess(this.textClassificationService.runTextClassificationIns(id)); | |||
| } | |||
| } | |||
| @@ -1,59 +0,0 @@ | |||
| package com.ruoyi.platform.controller.textClassfication; | |||
| import com.ruoyi.common.core.web.controller.BaseController; | |||
| import com.ruoyi.common.core.web.domain.GenericsAjaxResult; | |||
| import com.ruoyi.platform.domain.TextClassificationIns; | |||
| import com.ruoyi.platform.service.TextClassificationInsService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.data.domain.PageRequest; | |||
| import javax.annotation.Resource; | |||
| import java.util.List; | |||
| @RestController | |||
| @RequestMapping("textClassificationIns") | |||
| @Api("文本分类实验实例") | |||
| public class TextClassificationInsController extends BaseController { | |||
| @Resource | |||
| private TextClassificationInsService textClassificationInsService; | |||
| @GetMapping | |||
| @ApiOperation("分页查询") | |||
| public GenericsAjaxResult<Page<TextClassificationIns>> queryByPage(TextClassificationIns textClassificationIns, int page, int size){ | |||
| PageRequest pageRequest = PageRequest.of(page, size); | |||
| return genericsSuccess(this.textClassificationInsService.queryByPage(textClassificationIns, pageRequest)); | |||
| } | |||
| @PostMapping | |||
| @ApiOperation("新增实验实例") | |||
| public GenericsAjaxResult<TextClassificationIns> add(@RequestBody TextClassificationIns textClassificationIns) { | |||
| return genericsSuccess(this.textClassificationInsService.insert(textClassificationIns)); | |||
| } | |||
| @DeleteMapping("{id}") | |||
| @ApiOperation("删除实验实例") | |||
| public GenericsAjaxResult<String> deleteById(@PathVariable("id") Long id) { | |||
| return genericsSuccess(this.textClassificationInsService.removeById(id)); | |||
| } | |||
| @DeleteMapping("batchDelete") | |||
| @ApiOperation("批量删除实验实例") | |||
| public GenericsAjaxResult<String> batchDelete(@RequestBody List<Long> ids) { | |||
| return genericsSuccess(this.textClassificationInsService.batchDelete(ids)); | |||
| } | |||
| @PutMapping("{id}") | |||
| @ApiOperation("终止实验实例") | |||
| public GenericsAjaxResult<Boolean> terminateTextClassificationIns(@PathVariable("id") Long id) throws Exception { | |||
| return genericsSuccess(this.textClassificationInsService.terminateTextClassificationIns(id)); | |||
| } | |||
| @GetMapping("{id}") | |||
| @ApiOperation("查看实验实例详情") | |||
| public GenericsAjaxResult<TextClassificationIns> getDetailById(@PathVariable("id") Long id) { | |||
| return genericsSuccess(this.textClassificationInsService.getDetailById(id)); | |||
| } | |||
| } | |||
| @@ -1,52 +0,0 @@ | |||
| package com.ruoyi.platform.domain; | |||
| import com.fasterxml.jackson.databind.PropertyNamingStrategy; | |||
| import com.fasterxml.jackson.databind.annotation.JsonNaming; | |||
| import io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| import java.util.Date; | |||
| @Data | |||
| @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) | |||
| @ApiModel(description = "文本分类") | |||
| public class TextClassification { | |||
| private Long id; | |||
| @ApiModelProperty(value = "实验名称") | |||
| private String name; | |||
| @ApiModelProperty(value = "实验描述") | |||
| private String description; | |||
| @ApiModelProperty(value = "模型类型:TextCNN, TextRNN, FastText, TextRCNN, TextRNN_Att, DPCNN, Transformer") | |||
| private String modelType; | |||
| @ApiModelProperty(value = "数据集") | |||
| private String dataset; | |||
| private Integer computingResourceId; | |||
| @ApiModelProperty(value = "epochs") | |||
| private Integer epochs; | |||
| @ApiModelProperty(value = "batch_size") | |||
| private Integer batchSize; | |||
| @ApiModelProperty(value = "学习率") | |||
| private Float lr; | |||
| private String createBy; | |||
| private String updateBy; | |||
| private Date createTime; | |||
| private Date updateTime; | |||
| private Integer state; | |||
| @ApiModelProperty(value = "状态列表") | |||
| private String statusList; | |||
| } | |||
| @@ -1,41 +0,0 @@ | |||
| package com.ruoyi.platform.domain; | |||
| import com.fasterxml.jackson.databind.PropertyNamingStrategy; | |||
| import com.fasterxml.jackson.databind.annotation.JsonNaming; | |||
| import io.swagger.annotations.ApiModel; | |||
| import lombok.Data; | |||
| import java.util.Date; | |||
| @Data | |||
| @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) | |||
| @ApiModel(description = "文本分类实验实例") | |||
| public class TextClassificationIns { | |||
| private Long id; | |||
| private Long textClassificationId; | |||
| private Integer state; | |||
| private String status; | |||
| private String param; | |||
| private Date createTime; | |||
| private Date updateTime; | |||
| private Date finishTime; | |||
| private String argoInsName; | |||
| private String argoInsNs; | |||
| private String resultPath; | |||
| private String ModelPath; | |||
| private String nodeStatus; | |||
| private String nodeResult; | |||
| } | |||
| @@ -1,23 +0,0 @@ | |||
| package com.ruoyi.platform.mapper; | |||
| import com.ruoyi.platform.domain.TextClassification; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.springframework.data.domain.Pageable; | |||
| import java.util.List; | |||
| public interface TextClassificationDao { | |||
| long count(@Param("name") String name); | |||
| List<TextClassification> queryByPage(@Param("name") String name, @Param("pageable") Pageable pageable); | |||
| TextClassification getByName(@Param("name") String name); | |||
| TextClassification getById(@Param("id") Long id); | |||
| int save(@Param("textClassification") TextClassification textClassification); | |||
| int edit(@Param("textClassification") TextClassification textClassification); | |||
| List<TextClassification> queryByDatasetId(@Param("datasetId") String datasetId); | |||
| } | |||
| @@ -1,23 +0,0 @@ | |||
| package com.ruoyi.platform.mapper; | |||
| import com.ruoyi.platform.domain.TextClassificationIns; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.springframework.data.domain.Pageable; | |||
| import java.util.List; | |||
| public interface TextClassificationInsDao { | |||
| long count(@Param("textClassificationIns") TextClassificationIns textClassificationIns); | |||
| List<TextClassificationIns> queryAllByLimit(@Param("textClassificationIns") TextClassificationIns textClassificationIns, @Param("pageable") Pageable pageable); | |||
| List<TextClassificationIns> getByTextClassificationId(@Param("textClassificationId") Long textClassificationId); | |||
| TextClassificationIns queryById(@Param("id") Long id); | |||
| int insert(@Param("textClassificationIns") TextClassificationIns textClassificationIns); | |||
| int update(@Param("textClassificationIns") TextClassificationIns textClassificationIns); | |||
| List<TextClassificationIns> queryByNotTerminated(); | |||
| } | |||
| @@ -1,116 +0,0 @@ | |||
| package com.ruoyi.platform.scheduling; | |||
| import com.ruoyi.platform.domain.TextClassification; | |||
| import com.ruoyi.platform.domain.TextClassificationIns; | |||
| import com.ruoyi.platform.mapper.ResourceOccupyDao; | |||
| import com.ruoyi.platform.mapper.TextClassificationDao; | |||
| import com.ruoyi.platform.mapper.TextClassificationInsDao; | |||
| import com.ruoyi.platform.service.ResourceOccupyService; | |||
| import com.ruoyi.platform.service.TextClassificationInsService; | |||
| import com.ruoyi.system.api.constant.Constant; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.scheduling.annotation.Scheduled; | |||
| import org.springframework.stereotype.Component; | |||
| import javax.annotation.Resource; | |||
| import java.util.ArrayList; | |||
| import java.util.Iterator; | |||
| import java.util.List; | |||
| @Component() | |||
| public class TextClassificationInsTask { | |||
| @Resource | |||
| private TextClassificationInsService textClassificationInsService; | |||
| @Resource | |||
| private TextClassificationInsDao textClassificationInsDao; | |||
| @Resource | |||
| private TextClassificationDao textClassificationDao; | |||
| @Resource | |||
| private ResourceOccupyDao resourceOccupyDao; | |||
| @Resource | |||
| private ResourceOccupyService resourceOccupyService; | |||
| private List<Long> textClassificationIds = new ArrayList<>(); | |||
| @Scheduled(cron = "0/30 * * * * ?") // 每30S执行一次 | |||
| public void executeTextClassificationInsStatus() { | |||
| // 首先查到所有非终止态的实验实例 | |||
| List<TextClassificationIns> insList = textClassificationInsService.queryByNotTerminated(); | |||
| // 去argo查询状态 | |||
| List<TextClassificationIns> updateList = new ArrayList<>(); | |||
| if (insList != null && insList.size() > 0) { | |||
| for (TextClassificationIns ins : insList) { | |||
| //当原本状态为null或非终止态时才调用argo接口 | |||
| try { | |||
| Long userId = resourceOccupyDao.getResourceOccupyByTask(Constant.TaskType_TextClassification, ins.getTextClassificationId(), ins.getId(), null).get(0).getUserId(); | |||
| if (resourceOccupyDao.getUserCredit(userId) <= 0) { | |||
| ins.setStatus(Constant.Failed); | |||
| textClassificationInsService.terminateTextClassificationIns(ins.getId()); | |||
| } else { | |||
| ins = textClassificationInsService.queryStatusFromArgo(ins); | |||
| // 扣除积分 | |||
| if (Constant.Running.equals(ins.getStatus())) { | |||
| resourceOccupyService.deducing(Constant.TaskType_TextClassification, null, ins.getId(), null, null); | |||
| } else if (Constant.Failed.equals(ins.getStatus()) || Constant.Terminated.equals(ins.getStatus()) | |||
| || Constant.Succeeded.equals(ins.getStatus())) { | |||
| resourceOccupyService.endDeduce(Constant.TaskType_TextClassification, null, ins.getId(), null, null); | |||
| } | |||
| } | |||
| } catch (Exception e) { | |||
| ins.setStatus(Constant.Failed); | |||
| // 结束扣除积分 | |||
| resourceOccupyService.endDeduce(Constant.TaskType_TextClassification, null, ins.getId(), null, null); | |||
| } | |||
| // 线程安全的添加操作 | |||
| synchronized (textClassificationIds) { | |||
| textClassificationIds.add(ins.getTextClassificationId()); | |||
| } | |||
| updateList.add(ins); | |||
| } | |||
| if (updateList.size() > 0) { | |||
| for (TextClassificationIns ins : updateList) { | |||
| textClassificationInsDao.update(ins); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @Scheduled(cron = "0/30 * * * * ?") // / 每30S执行一次 | |||
| public void executeTextClassificationStatus() { | |||
| if (textClassificationIds.size() == 0) { | |||
| return; | |||
| } | |||
| // 存储需要更新的实验对象列表 | |||
| List<TextClassification> updateTextClassifications = new ArrayList<>(); | |||
| for (Long textClassificationId : textClassificationIds) { | |||
| // 获取当前实验的所有实例列表 | |||
| List<TextClassificationIns> insList = textClassificationInsDao.getByTextClassificationId(textClassificationId); | |||
| List<String> statusList = new ArrayList<>(); | |||
| // 更新实验状态列表 | |||
| for (int i = 0; i < insList.size(); i++) { | |||
| statusList.add(insList.get(i).getStatus()); | |||
| } | |||
| String subStatus = statusList.toString().substring(1, statusList.toString().length() - 1); | |||
| TextClassification textClassification = textClassificationDao.getById(textClassificationId); | |||
| if (!StringUtils.equals(textClassification.getStatusList(), subStatus)) { | |||
| textClassification.setStatusList(subStatus); | |||
| updateTextClassifications.add(textClassification); | |||
| textClassificationDao.edit(textClassification); | |||
| } | |||
| } | |||
| if (!updateTextClassifications.isEmpty()) { | |||
| // 使用Iterator进行安全的删除操作 | |||
| Iterator<Long> iterator = textClassificationIds.iterator(); | |||
| while (iterator.hasNext()) { | |||
| Long textClassificationId = iterator.next(); | |||
| for (TextClassification textClassification : updateTextClassifications) { | |||
| if (textClassification.getId().equals(textClassificationId)) { | |||
| iterator.remove(); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -1,27 +0,0 @@ | |||
| package com.ruoyi.platform.service; | |||
| import com.ruoyi.platform.domain.TextClassificationIns; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.data.domain.PageRequest; | |||
| import java.util.List; | |||
| public interface TextClassificationInsService { | |||
| Page<TextClassificationIns> queryByPage(TextClassificationIns textClassificationIns, PageRequest pageRequest); | |||
| TextClassificationIns insert(TextClassificationIns textClassificationIns); | |||
| String removeById(Long id); | |||
| String batchDelete(List<Long> ids); | |||
| boolean terminateTextClassificationIns(Long id) throws Exception; | |||
| TextClassificationIns getDetailById(Long id); | |||
| List<TextClassificationIns> queryByNotTerminated(); | |||
| TextClassificationIns queryStatusFromArgo(TextClassificationIns textClassificationIns); | |||
| void updateTextClassificationStatus(Long textClassificationId); | |||
| } | |||
| @@ -1,22 +0,0 @@ | |||
| package com.ruoyi.platform.service; | |||
| import com.ruoyi.platform.domain.TextClassification; | |||
| import com.ruoyi.platform.vo.TextClassificationVo; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.data.domain.PageRequest; | |||
| import java.io.IOException; | |||
| public interface TextClassificationService { | |||
| Page<TextClassification> queryByPage(String name, PageRequest pageRequest); | |||
| TextClassification save(TextClassificationVo textClassificationVo) throws Exception; | |||
| String edit(TextClassificationVo textClassificationVo) throws Exception; | |||
| String delete(Long id); | |||
| TextClassificationVo getTextClassificationDetail(Long id) throws IOException; | |||
| String runTextClassificationIns(Long id) throws Exception; | |||
| } | |||
| @@ -1,259 +0,0 @@ | |||
| package com.ruoyi.platform.service.impl; | |||
| import com.ruoyi.platform.domain.TextClassification; | |||
| import com.ruoyi.platform.domain.TextClassificationIns; | |||
| import com.ruoyi.platform.mapper.TextClassificationDao; | |||
| import com.ruoyi.platform.mapper.TextClassificationInsDao; | |||
| import com.ruoyi.platform.service.ResourceOccupyService; | |||
| import com.ruoyi.platform.service.TextClassificationInsService; | |||
| import com.ruoyi.platform.utils.DateUtils; | |||
| import com.ruoyi.platform.utils.HttpUtils; | |||
| import com.ruoyi.platform.utils.JsonUtils; | |||
| import com.ruoyi.system.api.constant.Constant; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Value; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.data.domain.PageImpl; | |||
| import org.springframework.data.domain.PageRequest; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import javax.annotation.Resource; | |||
| import java.util.*; | |||
| @Service | |||
| public class TextClassificationInsServiceImpl implements TextClassificationInsService { | |||
| @Value("${argo.url}") | |||
| private String argoUrl; | |||
| @Value("${argo.workflowStatus}") | |||
| private String argoWorkflowStatus; | |||
| @Value("${argo.workflowTermination}") | |||
| private String argoWorkflowTermination; | |||
| @Resource | |||
| private TextClassificationDao textClassificationDao; | |||
| @Resource | |||
| private TextClassificationInsDao textClassificationInsDao; | |||
| @Resource | |||
| private ResourceOccupyService resourceOccupyService; | |||
| @Override | |||
| public Page<TextClassificationIns> queryByPage(TextClassificationIns textClassificationIns, PageRequest pageRequest) { | |||
| long total = this.textClassificationInsDao.count(textClassificationIns); | |||
| List<TextClassificationIns> textClassificationInsList = this.textClassificationInsDao.queryAllByLimit(textClassificationIns, pageRequest); | |||
| return new PageImpl<>(textClassificationInsList, pageRequest, total); | |||
| } | |||
| @Override | |||
| public TextClassificationIns insert(TextClassificationIns textClassificationIns) { | |||
| this.textClassificationInsDao.insert(textClassificationIns); | |||
| return textClassificationIns; | |||
| } | |||
| @Override | |||
| @Transactional | |||
| public String removeById(Long id) { | |||
| TextClassificationIns textClassificationIns = textClassificationInsDao.queryById(id); | |||
| if (textClassificationIns == null) { | |||
| return "实验实例不存在"; | |||
| } | |||
| if (StringUtils.isEmpty(textClassificationIns.getStatus())) { | |||
| textClassificationIns = queryStatusFromArgo(textClassificationIns); | |||
| } | |||
| if (StringUtils.equals(textClassificationIns.getStatus(), Constant.Running)) { | |||
| return "实验实例正在运行,不可删除"; | |||
| } | |||
| textClassificationIns.setState(Constant.State_invalid); | |||
| int update = textClassificationInsDao.update(textClassificationIns); | |||
| if (update > 0) { | |||
| resourceOccupyService.deleteTaskState(Constant.TaskType_TextClassification, textClassificationIns.getTextClassificationId(), id); | |||
| updateTextClassificationStatus(textClassificationIns.getTextClassificationId()); | |||
| return "删除成功"; | |||
| } else { | |||
| return "删除失败"; | |||
| } | |||
| } | |||
| @Override | |||
| public String batchDelete(List<Long> ids) { | |||
| for (Long id : ids) { | |||
| String result = removeById(id); | |||
| if (!"删除成功".equals(result)) { | |||
| return result; | |||
| } | |||
| } | |||
| return "删除成功"; | |||
| } | |||
| @Override | |||
| public boolean terminateTextClassificationIns(Long id) throws Exception { | |||
| TextClassificationIns textClassificationIns = textClassificationInsDao.queryById(id); | |||
| if (textClassificationIns == null) { | |||
| throw new IllegalStateException("实验实例未查询到,id: " + id); | |||
| } | |||
| String currentStatus = textClassificationIns.getStatus(); | |||
| String name = textClassificationIns.getArgoInsName(); | |||
| String namespace = textClassificationIns.getArgoInsNs(); | |||
| // 获取当前状态,如果为空,则从Argo查询 | |||
| if (StringUtils.isEmpty(currentStatus)) { | |||
| currentStatus = queryStatusFromArgo(textClassificationIns).getStatus(); | |||
| } | |||
| // 只有状态是"Running"时才能终止实例 | |||
| if (!currentStatus.equalsIgnoreCase(Constant.Running)) { | |||
| throw new Exception("终止错误,只有运行状态的实例才能终止"); // 如果不是"Running"状态,则不执行终止操作 | |||
| } | |||
| // 创建请求数据map | |||
| Map<String, Object> requestData = new HashMap<>(); | |||
| requestData.put("namespace", namespace); | |||
| requestData.put("name", name); | |||
| // 创建发送数据map,将请求数据作为"data"键的值 | |||
| Map<String, Object> res = new HashMap<>(); | |||
| res.put("data", requestData); | |||
| try { | |||
| // 发送POST请求到Argo工作流状态查询接口,并将请求数据转换为JSON | |||
| String req = HttpUtils.sendPost(argoUrl + argoWorkflowTermination, null, JsonUtils.mapToJson(res)); | |||
| // 检查响应是否为空或无内容 | |||
| if (StringUtils.isEmpty(req)) { | |||
| throw new RuntimeException("终止响应内容为空"); | |||
| } | |||
| // 将响应的JSON字符串转换为Map对象 | |||
| Map<String, Object> runResMap = JsonUtils.jsonToMap(req); | |||
| // 从响应Map中直接获取"errCode"的值 | |||
| Integer errCode = (Integer) runResMap.get("errCode"); | |||
| if (errCode != null && errCode == 0) { | |||
| //更新autoMlIns,确保状态更新被保存到数据库 | |||
| TextClassificationIns ins = queryStatusFromArgo(textClassificationIns); | |||
| String nodeStatus = ins.getNodeStatus(); | |||
| Map<String, Object> nodeMap = JsonUtils.jsonToMap(nodeStatus); | |||
| // 遍历 map | |||
| for (Map.Entry<String, Object> entry : nodeMap.entrySet()) { | |||
| // 获取每个 Map 中的值并强制转换为 Map | |||
| Map<String, Object> innerMap = (Map<String, Object>) entry.getValue(); | |||
| // 检查 phase 的值 | |||
| if (innerMap.containsKey("phase")) { | |||
| String phaseValue = (String) innerMap.get("phase"); | |||
| // 如果值不等于 Succeeded,则赋值为 Failed | |||
| if (!StringUtils.equals(Constant.Succeeded, phaseValue)) { | |||
| innerMap.put("phase", Constant.Failed); | |||
| } | |||
| } | |||
| } | |||
| ins.setNodeStatus(JsonUtils.mapToJson(nodeMap)); | |||
| ins.setStatus(Constant.Terminated); | |||
| ins.setUpdateTime(new Date()); | |||
| ins.setFinishTime(new Date()); | |||
| this.textClassificationInsDao.update(ins); | |||
| updateTextClassificationStatus(textClassificationIns.getTextClassificationId()); | |||
| // 结束扣积分 | |||
| resourceOccupyService.endDeduce(Constant.TaskType_TextClassification, null, id, null, null); | |||
| return true; | |||
| } else { | |||
| return false; | |||
| } | |||
| } catch (Exception e) { | |||
| throw new RuntimeException("终止实例错误: " + e.getMessage(), e); | |||
| } | |||
| } | |||
| @Override | |||
| public TextClassificationIns getDetailById(Long id) { | |||
| TextClassificationIns textClassificationIns = textClassificationInsDao.queryById(id); | |||
| if (Constant.Running.equals(textClassificationIns.getStatus()) || Constant.Pending.equals(textClassificationIns.getStatus())) { | |||
| textClassificationIns = queryStatusFromArgo(textClassificationIns); | |||
| } | |||
| return textClassificationIns; | |||
| } | |||
| @Override | |||
| public List<TextClassificationIns> queryByNotTerminated() { | |||
| return textClassificationInsDao.queryByNotTerminated(); | |||
| } | |||
| @Override | |||
| public TextClassificationIns queryStatusFromArgo(TextClassificationIns ins) { | |||
| String namespace = ins.getArgoInsNs(); | |||
| String name = ins.getArgoInsName(); | |||
| // 创建请求数据map | |||
| Map<String, Object> requestData = new HashMap<>(); | |||
| requestData.put("namespace", namespace); | |||
| requestData.put("name", name); | |||
| // 创建发送数据map,将请求数据作为"data"键的值 | |||
| Map<String, Object> res = new HashMap<>(); | |||
| res.put("data", requestData); | |||
| try { | |||
| // 发送POST请求到Argo工作流状态查询接口,并将请求数据转换为JSON | |||
| String req = HttpUtils.sendPost(argoUrl + argoWorkflowStatus, null, JsonUtils.mapToJson(res)); | |||
| // 检查响应是否为空或无内容 | |||
| if (req == null || StringUtils.isEmpty(req)) { | |||
| throw new RuntimeException("工作流状态响应为空"); | |||
| } | |||
| // 将响应的JSON字符串转换为Map对象 | |||
| Map<String, Object> runResMap = JsonUtils.jsonToMap(req); | |||
| // 从响应Map中获取"data"部分 | |||
| Map<String, Object> data = (Map<String, Object>) runResMap.get("data"); | |||
| if (data == null || data.isEmpty()) { | |||
| throw new RuntimeException("工作流数据为空"); | |||
| } | |||
| // 从"data"中获取"status"部分,并返回"phase"的值 | |||
| Map<String, Object> status = (Map<String, Object>) data.get("status"); | |||
| if (status == null || status.isEmpty()) { | |||
| throw new RuntimeException("工作流状态为空"); | |||
| } | |||
| //解析流水线结束时间 | |||
| String finishedAtString = (String) status.get("finishedAt"); | |||
| if (finishedAtString != null && !finishedAtString.isEmpty()) { | |||
| Date finishTime = DateUtils.convertUTCtoShanghaiDate(finishedAtString); | |||
| ins.setFinishTime(finishTime); | |||
| } | |||
| // 解析nodes字段,提取节点状态并转换为JSON字符串 | |||
| Map<String, Object> nodes = (Map<String, Object>) status.get("nodes"); | |||
| Map<String, Object> modifiedNodes = new LinkedHashMap<>(); | |||
| if (nodes != null) { | |||
| for (Map.Entry<String, Object> nodeEntry : nodes.entrySet()) { | |||
| Map<String, Object> nodeDetails = (Map<String, Object>) nodeEntry.getValue(); | |||
| String templateName = (String) nodeDetails.get("displayName"); | |||
| modifiedNodes.put(templateName, nodeDetails); | |||
| } | |||
| } | |||
| String nodeStatusJson = JsonUtils.mapToJson(modifiedNodes); | |||
| ins.setNodeStatus(nodeStatusJson); | |||
| //终止态为终止不改 | |||
| if (!StringUtils.equals(ins.getStatus(), Constant.Terminated)) { | |||
| ins.setStatus(StringUtils.isNotEmpty((String) status.get("phase")) ? (String) status.get("phase") : Constant.Pending); | |||
| } | |||
| if (StringUtils.equals(ins.getStatus(), Constant.Error)) { | |||
| ins.setStatus(Constant.Failed); | |||
| } | |||
| return ins; | |||
| } catch (Exception e) { | |||
| throw new RuntimeException("查询状态失败: " + e.getMessage(), e); | |||
| } | |||
| } | |||
| @Override | |||
| public void updateTextClassificationStatus(Long textClassificationId) { | |||
| List<TextClassificationIns> insList = textClassificationInsDao.getByTextClassificationId(textClassificationId); | |||
| List<String> statusList = new ArrayList<>(); | |||
| // 更新实验状态列表 | |||
| for (int i = 0; i < insList.size(); i++) { | |||
| statusList.add(insList.get(i).getStatus()); | |||
| } | |||
| String subStatus = statusList.toString().substring(1, statusList.toString().length() - 1); | |||
| TextClassification textClassification = textClassificationDao.getById(textClassificationId); | |||
| if (!StringUtils.equals(textClassification.getStatusList(), subStatus)) { | |||
| textClassification.setStatusList(subStatus); | |||
| textClassificationDao.edit(textClassification); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,191 +0,0 @@ | |||
| package com.ruoyi.platform.service.impl; | |||
| import com.ruoyi.common.security.utils.SecurityUtils; | |||
| import com.ruoyi.platform.domain.TextClassification; | |||
| import com.ruoyi.platform.domain.TextClassificationIns; | |||
| import com.ruoyi.platform.mapper.TextClassificationDao; | |||
| import com.ruoyi.platform.mapper.TextClassificationInsDao; | |||
| import com.ruoyi.platform.service.ResourceOccupyService; | |||
| import com.ruoyi.platform.service.TextClassificationInsService; | |||
| import com.ruoyi.platform.service.TextClassificationService; | |||
| import com.ruoyi.platform.utils.HttpUtils; | |||
| import com.ruoyi.platform.utils.JacksonUtil; | |||
| import com.ruoyi.platform.utils.JsonUtils; | |||
| import com.ruoyi.platform.vo.TextClassificationParamVo; | |||
| import com.ruoyi.platform.vo.TextClassificationVo; | |||
| import com.ruoyi.system.api.constant.Constant; | |||
| import org.apache.commons.collections4.MapUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.BeanUtils; | |||
| import org.springframework.beans.factory.annotation.Value; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.data.domain.PageImpl; | |||
| import org.springframework.data.domain.PageRequest; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import javax.annotation.Resource; | |||
| import java.io.IOException; | |||
| import java.util.ArrayList; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @Service | |||
| public class TextClassificationServiceImpl implements TextClassificationService { | |||
| @Value("${git.localPath}") | |||
| String localPath; | |||
| @Value("${argo.url}") | |||
| private String argoUrl; | |||
| @Value("${argo.convertTextClassification}") | |||
| String convertTextClassification; | |||
| @Value("${argo.workflowRun}") | |||
| private String argoWorkflowRun; | |||
| @Value("${minio.endpointIp}") | |||
| private String minioEndpoint; | |||
| @Resource | |||
| private TextClassificationDao textClassificationDao; | |||
| @Resource | |||
| private TextClassificationInsDao textClassificationInsDao; | |||
| @Resource | |||
| private TextClassificationInsService textClassificationInsService; | |||
| @Resource | |||
| private ResourceOccupyService resourceOccupyService; | |||
| @Override | |||
| public Page<TextClassification> queryByPage(String name, PageRequest pageRequest) { | |||
| long total = textClassificationDao.count(name); | |||
| List<TextClassification> textClassifications = textClassificationDao.queryByPage(name, pageRequest); | |||
| return new PageImpl<>(textClassifications, pageRequest, total); | |||
| } | |||
| @Override | |||
| public TextClassification save(TextClassificationVo textClassificationVo) throws Exception { | |||
| if (textClassificationVo.getName().length() >= 64) { | |||
| throw new RuntimeException("实验名称大于最大长度"); | |||
| } | |||
| TextClassification textClassificationByName = textClassificationDao.getByName(textClassificationVo.getName()); | |||
| if (textClassificationByName != null) { | |||
| throw new RuntimeException("实验名称已存在"); | |||
| } | |||
| TextClassification textClassification = new TextClassification(); | |||
| BeanUtils.copyProperties(textClassificationVo, textClassification); | |||
| String username = SecurityUtils.getLoginUser().getUsername(); | |||
| textClassification.setCreateBy(username); | |||
| textClassification.setUpdateBy(username); | |||
| String datasetJson = JacksonUtil.toJSONString(textClassificationVo.getDataset()); | |||
| textClassification.setDataset(datasetJson); | |||
| textClassificationDao.save(textClassification); | |||
| return textClassification; | |||
| } | |||
| @Override | |||
| public String edit(TextClassificationVo textClassificationVo) throws Exception { | |||
| TextClassification oldTextClassification = textClassificationDao.getByName(textClassificationVo.getName()); | |||
| if (oldTextClassification != null && !oldTextClassification.getId().equals(textClassificationVo.getId())) { | |||
| throw new RuntimeException("实验名称已存在"); | |||
| } | |||
| TextClassification textClassification = new TextClassification(); | |||
| BeanUtils.copyProperties(textClassificationVo, textClassification); | |||
| String username = SecurityUtils.getLoginUser().getUsername(); | |||
| textClassification.setUpdateBy(username); | |||
| String datasetJson = JacksonUtil.toJSONString(textClassificationVo.getDataset()); | |||
| textClassification.setDataset(datasetJson); | |||
| textClassificationDao.edit(textClassification); | |||
| return "修改成功"; | |||
| } | |||
| @Override | |||
| @Transactional | |||
| public String delete(Long id) { | |||
| TextClassification textClassification = textClassificationDao.getById(id); | |||
| if (textClassification == null) { | |||
| throw new RuntimeException("实验不存在"); | |||
| } | |||
| String username = SecurityUtils.getLoginUser().getUsername(); | |||
| String createBy = textClassification.getCreateBy(); | |||
| if (!(StringUtils.equals(username, "admin") || StringUtils.equals(username, createBy))) { | |||
| throw new RuntimeException("无权限删除该实验"); | |||
| } | |||
| textClassification.setState(Constant.State_invalid); | |||
| resourceOccupyService.deleteTaskState(Constant.TaskType_TextClassification, id, null); | |||
| return textClassificationDao.edit(textClassification) > 0 ? "删除成功" : "删除失败"; | |||
| } | |||
| @Override | |||
| public TextClassificationVo getTextClassificationDetail(Long id) throws IOException { | |||
| TextClassification textClassification = textClassificationDao.getById(id); | |||
| TextClassificationVo textClassificationVo = new TextClassificationVo(); | |||
| BeanUtils.copyProperties(textClassification, textClassificationVo); | |||
| if (StringUtils.isNotEmpty(textClassification.getDataset())) { | |||
| textClassificationVo.setDataset(JsonUtils.jsonToMap(textClassification.getDataset())); | |||
| } | |||
| return textClassificationVo; | |||
| } | |||
| @Override | |||
| public String runTextClassificationIns(Long id) throws Exception { | |||
| TextClassification textClassification = textClassificationDao.getById(id); | |||
| if (textClassification == null) { | |||
| throw new Exception("文本分类配置不存在"); | |||
| } | |||
| // 记录开始扣积分 | |||
| if (resourceOccupyService.haveResource(textClassification.getComputingResourceId(), 1)) { | |||
| TextClassificationParamVo paramVo = new TextClassificationParamVo(); | |||
| BeanUtils.copyProperties(textClassification, paramVo); | |||
| paramVo.setDataset(JsonUtils.jsonToMap(textClassification.getDataset())); | |||
| String param = JsonUtils.objectToJson(paramVo); | |||
| // 调argo转换接口 | |||
| try { | |||
| String convertRes = HttpUtils.sendPost(argoUrl + convertTextClassification, param); | |||
| if (convertRes == null || StringUtils.isEmpty(convertRes)) { | |||
| throw new RuntimeException("转换流水线失败"); | |||
| } | |||
| Map<String, Object> converMap = JsonUtils.jsonToMap(convertRes); | |||
| // 组装运行接口json | |||
| Map<String, Object> output = (Map<String, Object>) converMap.get("output"); | |||
| Map<String, Object> runReqMap = new HashMap<>(); | |||
| runReqMap.put("data", converMap.get("data")); | |||
| // 调argo运行接口 | |||
| String runRes = HttpUtils.sendPost(argoUrl + argoWorkflowRun, JsonUtils.mapToJson(runReqMap)); | |||
| if (runRes == null || StringUtils.isEmpty(runRes)) { | |||
| throw new RuntimeException("运行流水线失败"); | |||
| } | |||
| Map<String, Object> runResMap = JsonUtils.jsonToMap(runRes); | |||
| Map<String, Object> data = (Map<String, Object>) runResMap.get("data"); | |||
| //判断data为空 | |||
| if (data == null || MapUtils.isEmpty(data)) { | |||
| throw new RuntimeException("运行流水线失败"); | |||
| } | |||
| Map<String, Object> metadata = (Map<String, Object>) data.get("metadata"); | |||
| // 插入记录到实验实例表 | |||
| TextClassificationIns textClassificationIns = new TextClassificationIns(); | |||
| textClassificationIns.setTextClassificationId(id); | |||
| textClassificationIns.setArgoInsNs((String) metadata.get("namespace")); | |||
| textClassificationIns.setArgoInsName((String) metadata.get("name")); | |||
| textClassificationIns.setParam(param); | |||
| textClassificationIns.setStatus(Constant.Pending); | |||
| //替换argoInsName | |||
| String outputString = JsonUtils.mapToJson(output); | |||
| textClassificationIns.setNodeResult(outputString.replace("{{workflow.name}}", (String) metadata.get("name"))); | |||
| Map<String, Object> param_output = (Map<String, Object>) output.get("param_output"); | |||
| List output1 = (ArrayList) param_output.values().toArray()[0]; | |||
| Map<String, String> output2 = (Map<String, String>) output1.get(0); | |||
| String outputPath = minioEndpoint + "/" + output2.get("path").replace("{{workflow.name}}", (String) metadata.get("name")) + "/"; | |||
| textClassificationIns.setModelPath(outputPath + "/saved_dict/" + textClassification.getModelType() + ".ckpt"); | |||
| textClassificationInsDao.insert(textClassificationIns); | |||
| textClassificationInsService.updateTextClassificationStatus(id); | |||
| // 记录开始扣除积分 | |||
| resourceOccupyService.startDeduce(textClassification.getComputingResourceId(), 1, Constant.TaskType_TextClassification, id, textClassificationIns.getId(), null, textClassification.getName(), null, null); | |||
| } catch (Exception e) { | |||
| throw new RuntimeException(e); | |||
| } | |||
| } | |||
| return "执行成功"; | |||
| } | |||
| } | |||
| @@ -1,51 +0,0 @@ | |||
| package com.ruoyi.platform.vo; | |||
| import com.fasterxml.jackson.databind.PropertyNamingStrategy; | |||
| import com.fasterxml.jackson.databind.annotation.JsonNaming; | |||
| import io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| import java.util.Date; | |||
| import java.util.Map; | |||
| @Data | |||
| @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) | |||
| @ApiModel(description = "文本分类") | |||
| public class TextClassificationVo { | |||
| private Long id; | |||
| @ApiModelProperty(value = "实验名称") | |||
| private String name; | |||
| @ApiModelProperty(value = "实验描述") | |||
| private String description; | |||
| @ApiModelProperty(value = "模型") | |||
| private String modelType; | |||
| @ApiModelProperty(value = "数据集") | |||
| private Map<String, Object> dataset; | |||
| @ApiModelProperty(value = "epochs") | |||
| private Integer epochs; | |||
| @ApiModelProperty(value = "batch_size") | |||
| private Integer batchSize; | |||
| @ApiModelProperty(value = "学习率") | |||
| private Float lr; | |||
| private String createBy; | |||
| private String updateBy; | |||
| private Date createTime; | |||
| private Date updateTime; | |||
| private Integer state; | |||
| @ApiModelProperty(value = "状态列表") | |||
| private String statusList; | |||
| } | |||
| @@ -1,90 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.ruoyi.platform.mapper.TextClassificationDao"> | |||
| <select id="count" resultType="java.lang.Long"> | |||
| select count(1) from text_classification | |||
| <include refid="common_condition"></include> | |||
| </select> | |||
| <select id="queryByPage" resultType="com.ruoyi.platform.domain.TextClassification"> | |||
| select * from text_classification | |||
| <include refid="common_condition"></include> | |||
| order by create_time desc limit #{pageable.offset}, #{pageable.pageSize} | |||
| </select> | |||
| <select id="getByName" resultType="com.ruoyi.platform.domain.TextClassification"> | |||
| select * | |||
| from text_classification | |||
| where name = #{name} | |||
| and state = 1 | |||
| </select> | |||
| <select id="getById" resultType="com.ruoyi.platform.domain.TextClassification"> | |||
| select * | |||
| from text_classification | |||
| where id = #{id} | |||
| </select> | |||
| <insert id="save" keyProperty="id" useGeneratedKeys="true"> | |||
| insert into text_classification(name, description, model_type, dataset, epochs, batch_size, lr, create_by, update_by, computing_resource_id) | |||
| values (#{textClassification.name}, #{textClassification.description}, #{textClassification.modelType}, | |||
| #{textClassification.dataset}, #{textClassification.epochs}, #{textClassification.batchSize}, | |||
| #{textClassification.lr}, #{textClassification.createBy}, #{textClassification.updateBy}, #{textClassification.computingResourceId}) | |||
| </insert> | |||
| <update id="edit"> | |||
| update text_classification | |||
| <set> | |||
| <if test="textClassification.name != null and textClassification.name !=''"> | |||
| name = #{textClassification.name}, | |||
| </if> | |||
| <if test="textClassification.description != null and textClassification.description !=''"> | |||
| description = #{textClassification.description}, | |||
| </if> | |||
| <if test="textClassification.modelType != null and textClassification.modelType !=''"> | |||
| model_type = #{textClassification.modelType}, | |||
| </if> | |||
| <if test="textClassification.dataset != null and textClassification.dataset !=''"> | |||
| dataset = #{textClassification.dataset}, | |||
| </if> | |||
| <if test="textClassification.computingResourceId != null"> | |||
| computing_resource_id = #{textClassification.computingResourceId}, | |||
| </if> | |||
| <if test="textClassification.epochs != null"> | |||
| epochs = #{textClassification.epochs}, | |||
| </if> | |||
| <if test="textClassification.batchSize != null"> | |||
| batch_size = #{textClassification.batchSize}, | |||
| </if> | |||
| <if test="textClassification.lr != null"> | |||
| lr = #{textClassification.lr}, | |||
| </if> | |||
| <if test="textClassification.updateBy != null and textClassification.updateBy !=''"> | |||
| update_by = #{textClassification.updateBy}, | |||
| </if> | |||
| <if test="textClassification.statusList != null and textClassification.statusList !=''"> | |||
| status_list = #{textClassification.statusList}, | |||
| </if> | |||
| <if test="textClassification.state != null"> | |||
| state = #{textClassification.state}, | |||
| </if> | |||
| </set> | |||
| where id = #{textClassification.id} | |||
| </update> | |||
| <select id="queryByDatasetId" resultType="com.ruoyi.platform.domain.TextClassification"> | |||
| select * | |||
| from text_classification | |||
| where JSON_CONTAINS(dataset, #{datasetId}) | |||
| and state = 1 | |||
| </select> | |||
| <sql id="common_condition"> | |||
| <where> | |||
| state = 1 | |||
| <if test="name != null and name != ''"> | |||
| and name like concat('%', #{name}, '%') | |||
| </if> | |||
| </where> | |||
| </sql> | |||
| </mapper> | |||
| @@ -1,85 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.ruoyi.platform.mapper.TextClassificationInsDao"> | |||
| <select id="count" resultType="java.lang.Long"> | |||
| select count(1) | |||
| from text_classification_ins | |||
| <where> | |||
| state = 1 | |||
| and text_classification_id = #{textClassificationIns.textClassificationId} | |||
| </where> | |||
| </select> | |||
| <select id="queryAllByLimit" resultType="com.ruoyi.platform.domain.TextClassificationIns"> | |||
| select * from text_classification_ins | |||
| <where> | |||
| state = 1 | |||
| and text_classification_id = #{textClassificationIns.textClassificationId} | |||
| </where> | |||
| order by update_time DESC | |||
| limit #{pageable.offset}, #{pageable.pageSize} | |||
| </select> | |||
| <select id="getByTextClassificationId" resultType="com.ruoyi.platform.domain.TextClassificationIns"> | |||
| select * | |||
| from text_classification_ins | |||
| where text_classification_id = #{textClassificationId} | |||
| and state = 1 | |||
| order by update_time DESC limit 5 | |||
| </select> | |||
| <select id="queryById" resultType="com.ruoyi.platform.domain.TextClassificationIns"> | |||
| select * from text_classification_ins | |||
| <where> | |||
| state = 1 and id = #{id} | |||
| </where> | |||
| </select> | |||
| <insert id="insert" keyProperty="id" useGeneratedKeys="true"> | |||
| insert into text_classification_ins(text_classification_id, status, param, argo_ins_name, argo_ins_ns, | |||
| node_status, node_result) | |||
| values (#{textClassificationIns.textClassificationId}, #{textClassificationIns.status}, | |||
| #{textClassificationIns.param}, #{textClassificationIns.argoInsName}, | |||
| #{textClassificationIns.argoInsNs}, #{textClassificationIns.nodeStatus}, | |||
| #{textClassificationIns.nodeResult}) | |||
| </insert> | |||
| <update id="update"> | |||
| update text_classification_ins | |||
| <set> | |||
| <if test="autoMlIns.modelPath != null and autoMlIns.modelPath != ''"> | |||
| model_path = #{autoMlIns.modelPath}, | |||
| </if> | |||
| <if test="autoMlIns.resultPath != null and autoMlIns.resultPath != ''"> | |||
| result_path = #{autoMlIns.resultPath}, | |||
| </if> | |||
| <if test="autoMlIns.status != null and autoMlIns.status != ''"> | |||
| status = #{autoMlIns.status}, | |||
| </if> | |||
| <if test="autoMlIns.nodeStatus != null and autoMlIns.nodeStatus != ''"> | |||
| node_status = #{autoMlIns.nodeStatus}, | |||
| </if> | |||
| <if test="autoMlIns.nodeResult != null and autoMlIns.nodeResult != ''"> | |||
| node_result = #{autoMlIns.nodeResult}, | |||
| </if> | |||
| <if test="autoMlIns.state != null"> | |||
| state = #{autoMlIns.state}, | |||
| </if> | |||
| <if test="autoMlIns.updateTime != null"> | |||
| update_time = #{autoMlIns.updateTime}, | |||
| </if> | |||
| <if test="autoMlIns.finishTime != null"> | |||
| finish_time = #{autoMlIns.finishTime}, | |||
| </if> | |||
| </set> | |||
| where id = #{textClassificationIns.id} | |||
| </update> | |||
| <select id="queryByNotTerminated" resultType="com.ruoyi.platform.domain.TextClassificationIns"> | |||
| select * | |||
| from text_classification_ins | |||
| where (status NOT IN ('Terminated', 'Succeeded', 'Failed') | |||
| OR status IS NULL) | |||
| and state = 1 | |||
| </select> | |||
| </mapper> | |||