Browse Source

优化积分扣除

pull/268/head
chenzhihang 8 months ago
parent
commit
19b797189d
4 changed files with 25 additions and 0 deletions
  1. +3
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ActiveLearnInsServiceImpl.java
  2. +16
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java
  3. +3
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/MachineLearnInsServiceImpl.java
  4. +3
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/RayInsServiceImpl.java

+ 3
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ActiveLearnInsServiceImpl.java View File

@@ -68,6 +68,9 @@ public class ActiveLearnInsServiceImpl implements ActiveLearnInsService {
activeLearnIns = queryStatusFromArgo(activeLearnIns);
activeLearnInsDao.update(activeLearnIns);
updateActiveLearnStatus(activeLearnIns.getActiveLearnId());
if (Constant.Failed.equals(activeLearnIns.getStatus()) || Constant.Succeeded.equals(activeLearnIns.getStatus())) {
resourceOccupyService.endDeduce(Constant.TaskType_ActiveLearn, null, activeLearnIns.getId(), null, null);
}
return activeLearnIns;
}



+ 16
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java View File

@@ -30,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.*;

/**
@@ -208,6 +209,21 @@ public class ExperimentInsServiceImpl implements ExperimentInsService {
experimentIns = queryStatusFromArgo(experimentIns);
this.experimentInsDao.update(experimentIns);
updateExperimentStatus(experimentIns.getExperimentId());
if (Constant.Failed.equals(experimentIns.getStatus()) || Constant.Succeeded.equals(experimentIns.getStatus())) {
if (StringUtils.isNotEmpty(experimentIns.getNodesStatus())) {
Map<String, Object> nodesStatusMap = JsonUtils.jsonToMap(experimentIns.getNodesStatus());
for (String key : nodesStatusMap.keySet()) {
Map<String, Object> value = (Map<String, Object>) nodesStatusMap.get(key);
String startedAt = (String) value.get("startedAt");
Instant instant = Instant.parse(startedAt);
Date startTime = Date.from(instant);
String finishedAt = (String) value.get("finishedAt");
if (StringUtils.isNotEmpty(finishedAt)) {
resourceOccupyService.endDeduce(Constant.TaskType_Workflow, null, Long.valueOf(experimentIns.getId()), key, startTime);
}
}
}
}
return experimentIns;
}



+ 3
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/MachineLearnInsServiceImpl.java View File

@@ -64,6 +64,9 @@ public class MachineLearnInsServiceImpl implements MachineLearnInsService {
machineLearnIns = queryStatusFromArgo(machineLearnIns);
machineLearnInsDao.update(machineLearnIns);
updateMLStatus(machineLearnIns.getMachineLearnId());
if (Constant.Failed.equals(machineLearnIns.getStatus()) || Constant.Succeeded.equals(machineLearnIns.getStatus())) {
resourceOccupyService.endDeduce(Constant.TaskType_ML, null, machineLearnIns.getId(), null, null);
}
return machineLearnIns;
}



+ 3
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/RayInsServiceImpl.java View File

@@ -76,6 +76,9 @@ public class RayInsServiceImpl implements RayInsService {
rayIns = queryStatusFromArgo(rayIns);
rayInsDao.update(rayIns);
updateRayStatus(rayIns.getRayId());
if (Constant.Failed.equals(rayIns.getStatus()) || Constant.Succeeded.equals(rayIns.getStatus())) {
resourceOccupyService.endDeduce(Constant.TaskType_Ray, null, rayIns.getId(), null, null);
}
return rayIns;
}



Loading…
Cancel
Save