微调训练完成 时长获取

This commit is contained in:
limin 2025-02-11 11:25:58 +08:00
parent 973f925ca8
commit bd152b3f60

View File

@ -22,6 +22,7 @@ import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.time.Duration;
import java.util.*;
@Component
@ -85,6 +86,12 @@ public class FineTuningTaskSyncService {
String resModels = trainHttpService.modelTableQuery(new HashMap<>(), "models",querModels);
log.info("获取 aigc models 表数据 info {}",resModels);
JSONArray jsonArrayModels = JSONArray.parseArray(resModels);
// 时长获取
Duration duration = Duration.between(fineTuningTaskDO.getUpdateTime(), fineTuningTaskDO.getCreateTime());
long minutes = duration.toMinutes();
updateObj.setTrainDuration(String.valueOf(minutes));
if(jsonArrayModels.size() > 0){
JSONObject jsonObjectModels = jsonArrayModels.getJSONObject(0);
updateObj.setJobModelListId(jsonObjectModels.getLong("id"));
@ -139,12 +146,13 @@ public class FineTuningTaskSyncService {
}catch (Exception e){
log.error(" error {}",e.getMessage());
}
fineTuningTaskMapper.updateById(updateObj);
}
else {
updateObj.setStatus(status);
fineTuningTaskMapper.updateById(updateObj);
}
fineTuningTaskMapper.updateById(updateObj);
}