|
|
@@ -240,26 +240,28 @@ func DelTrainJobVersion(ctx *context.APIContext) { |
|
|
|
ctx.ServerError("get VersionListCount faild", err) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 判断当前删掉的任务是否是最新版本,若是,将排序后的TotalVersionCount置为删掉的最新版本的TotalVersionCount,若不是,按时间排序后的版本列表的第一个版本设置为最新版本,TotalVersionCount不变 |
|
|
|
if task.IsLatestVersion == modelarts.IsLatestVersion { |
|
|
|
err = models.SetVersionCountAndLatestVersion(jobID, VersionTaskList[0].Cloudbrain.VersionName, VersionListCount, modelarts.IsLatestVersion, task.TotalVersionCount) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("UpdateJobVersionCount failed", err) |
|
|
|
return |
|
|
|
} |
|
|
|
} else { |
|
|
|
err = models.SetVersionCountAndLatestVersion(jobID, VersionTaskList[0].VersionName, VersionListCount, modelarts.IsLatestVersion, VersionTaskList[0].Cloudbrain.TotalVersionCount) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("UpdateJobVersionCount failed", err) |
|
|
|
return |
|
|
|
if VersionListCount > 0 { |
|
|
|
// 判断当前删掉的任务是否是最新版本,若是,将排序后的TotalVersionCount置为删掉的最新版本的TotalVersionCount,若不是,按时间排序后的版本列表的第一个版本设置为最新版本,TotalVersionCount不变 |
|
|
|
if task.IsLatestVersion == modelarts.IsLatestVersion { |
|
|
|
err = models.SetVersionCountAndLatestVersion(jobID, VersionTaskList[0].Cloudbrain.VersionName, VersionListCount, modelarts.IsLatestVersion, task.TotalVersionCount) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("UpdateJobVersionCount failed", err) |
|
|
|
return |
|
|
|
} |
|
|
|
} else { |
|
|
|
err = models.SetVersionCountAndLatestVersion(jobID, VersionTaskList[0].VersionName, VersionListCount, modelarts.IsLatestVersion, VersionTaskList[0].Cloudbrain.TotalVersionCount) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("UpdateJobVersionCount failed", err) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ctx.JSON(http.StatusOK, map[string]interface{}{ |
|
|
|
"JobID": jobID, |
|
|
|
"VersionName": versionName, |
|
|
|
"StatusOK": 0, |
|
|
|
"JobID": jobID, |
|
|
|
"VersionName": versionName, |
|
|
|
"StatusOK": 0, |
|
|
|
"VersionListCount": VersionListCount, |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|