parent
ad44337e20
commit
63dec7ef93
|
|
@ -182,10 +182,10 @@ public class ServiceVersionStatusTask {
|
|||
// 4. 如果url有值,则将url写入对应的数据中,然后更新数据库
|
||||
if (taskStatusInfo != null) {
|
||||
String url = taskStatusInfo.get("url").toString();
|
||||
if (url != null && !url.isEmpty()) {
|
||||
String status = taskStatusInfo.get("status").toString();
|
||||
if (url != null && url.startsWith("https://")) {
|
||||
version.setUrl(url);
|
||||
}
|
||||
String status = taskStatusInfo.get("status").toString();
|
||||
version.setRunState(capitalizeFirstLetter(status));
|
||||
serviceVersionMapper.updateVersion(version);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,24 @@ public class ZSServiceVersionServiceImpl implements ServiceVersionService {
|
|||
|
||||
@Override
|
||||
public void updateVersion(ServiceVersionDTO versionDTO) throws Exception {
|
||||
|
||||
ServiceVersionZs version = zsServiceVersionMapper.getVersionById(versionDTO.getId());
|
||||
String result = version.getResult();
|
||||
String url = zsServiceVersionUrl + "/api/v1/reSubmitTask";
|
||||
Map<String, Object> response = restTemplate.postForObject(url, JsonUtils.jsonToMap(result), Map.class);
|
||||
if (response == null || (int)response.get("code") != 200) {
|
||||
throw new Exception("Failed to restart task: " + response.get("msg"));
|
||||
}
|
||||
|
||||
// 提取jobSetID
|
||||
Map<String, Object> data = (Map<String, Object>) response.get("data");
|
||||
if (data != null && data.containsKey("jobSetID")) {
|
||||
String jobSetID = (String) data.get("jobSetID");
|
||||
version.setJobSetId(jobSetID);
|
||||
// 更新数据库
|
||||
version.setRunState("Completed");
|
||||
version.setUrl(null);
|
||||
zsServiceVersionMapper.updateVersion(version);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -157,7 +174,17 @@ public class ZSServiceVersionServiceImpl implements ServiceVersionService {
|
|||
|
||||
@Override
|
||||
public void stopServiceVersion(Long id) throws Exception {
|
||||
ServiceVersionZs version = zsServiceVersionMapper.getVersionById(id);
|
||||
String url = zsServiceVersionUrl + "/api/v1/stopInferenceTask";
|
||||
Map<String, String> request = new HashMap<>();
|
||||
request.put("localJobID", "1");
|
||||
request.put("jobSetID", version.getJobSetId());
|
||||
Map<String, Object> response = restTemplate.postForObject(url, request, Map.class);
|
||||
|
||||
if (response == null || (int)response.get("code") != 200) {
|
||||
throw new Exception("Failed to stop task: " + response.get("msg"));
|
||||
}
|
||||
zsServiceVersionMapper.stopServiceVersion(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@
|
|||
</delete>
|
||||
|
||||
<update id="stopServiceVersion" parameterType="java.lang.Long">
|
||||
update service_version_zs set run_state = 'stopped' where id = #{id}
|
||||
update service_version_zs set run_state = 'Stopped' where id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getVersionsByServiceId" resultMap="ServiceVersionZsResult">
|
||||
|
|
|
|||
Loading…
Reference in New Issue