#4864 fix-4777

Merged
zouap merged 5 commits from fix-4777 into V20231102 6 months ago
  1. +5
    -1
      manager/client/grampus/grampus.go
  2. +12
    -0
      models/error.go
  3. +1
    -0
      options/locale/locale_en-US.ini
  4. +1
    -0
      options/locale/locale_zh-CN.ini
  5. +1
    -0
      routers/response/response_list.go
  6. +4
    -0
      services/ai_task_service/task/task_base.go
  7. +21
    -0
      web_src/js/features/cloudrbanin.js
  8. +1
    -1
      web_src/vuepages/components/cloudbrain/DialogTips.vue

+ 5
- 1
manager/client/grampus/grampus.go View File

@@ -30,7 +30,8 @@ const (
urlGetImages = urlOpenApiV1 + "image"
urlNotebookJob = urlOpenApiV1 + "notebook"

errorIllegalToken = 1005
errorIllegalToken = 1005
errorCannotStopCreatingJob = 5008
)

type GetTokenParams struct {
@@ -421,6 +422,9 @@ sendjob:

if result.ErrorCode != 0 {
log.Error("GetJob failed(%d): %s", result.ErrorCode, result.ErrorMsg)
if result.ErrorCode == errorCannotStopCreatingJob {
return &result, &models.ErrCannotStopCreatingGrampusJob{}
}
return &result, fmt.Errorf("GetJob failed(%d): %s", result.ErrorCode, result.ErrorMsg)
}



+ 12
- 0
models/error.go View File

@@ -2082,3 +2082,15 @@ func IsErrPretrainModelNotExist(err error) bool {
func (err ErrPretrainModelNotExist) Error() string {
return fmt.Sprintf("pretrain model is not exists")
}

type ErrCannotStopCreatingGrampusJob struct {
}

func IsErrCannotStopCreatingGrampusJob(err error) bool {
_, ok := err.(ErrCannotStopCreatingGrampusJob)
return ok
}

func (err ErrCannotStopCreatingGrampusJob) Error() string {
return fmt.Sprintf("job is creating, can not be stopped")
}

+ 1
- 0
options/locale/locale_en-US.ini View File

@@ -3479,6 +3479,7 @@ dataset_number_over_limit = The dataset count exceed the limit
result_cleared=The files of the task have been cleared, can not restart or retrain any more, please create a new task instead
model_not_exist=The model in the task does not exist or has been deleted
too_many_notebook=A user can have up to 5 debug tasks, please try again after delete some debug tasks.
can_not_stop_creating_job=AI task is creating, can not be stopped.
no_center_match=Can not match a AI center, please select other specification.

[common_error]


+ 1
- 0
options/locale/locale_zh-CN.ini View File

@@ -3502,6 +3502,7 @@ dataset_number_over_limit = 选择的数据集文件数量超出限制
result_cleared=源任务的文件已被清理,无法再次调试或复用训练结果,请新建任务。
model_not_exist=选择的预训练模型不存在或者已被删除
too_many_notebook=每个用户最多只能创建5个调试任务,请删除历史任务再新建。
can_not_stop_creating_job=任务正在创建中,请等创建完成后再尝试停止。
no_center_match=没有可分配的中心,请选择其他规格。




+ 1
- 0
routers/response/response_list.go View File

@@ -37,4 +37,5 @@ var BRANCH_NOT_EXISTS = &BizError{Code: 2020, DefaultMsg: "The branch does not e
var MODEL_NUM_OVER_LIMIT = &BizError{Code: 2021, DefaultMsg: "The number of models exceeds the limit of 30", TrCode: "repo.debug.manage.model_num_over_limit"}
var DATASET_NUMBER_OVER_LIMIT = &BizError{Code: 2022, DefaultMsg: "The dataset count exceed the limit", TrCode: "ai_task.dataset_number_over_limit"}
var NOTEBOOK_EXCEED_MAX_NUM = &BizError{Code: 2023, DefaultMsg: "You can have up to 5 Debug Tasks, please try again after delete some tasks. ", TrCode: "ai_task.too_many_notebook"}
var CAN_NOT_STOP_CREATING_JOB = &BizError{Code: 2024, DefaultMsg: "AI task is creating, can not be stopped", TrCode: "ai_task.can_not_stop_creating_job"}
var NO_CENTER_MATCH = &BizError{Code: 2024, DefaultMsg: "", TrCode: "ai_task.no_center_match"}

+ 4
- 0
services/ai_task_service/task/task_base.go View File

@@ -237,6 +237,10 @@ func (g DefaultAITaskTemplate) Stop(cloudbrainId int64) (*entity.AITaskBriefInfo
}

if err != nil {
log.Error("StopTask err.cloudbrainId=%d err=%v", cloudbrainId, err)
if models.IsErrCannotStopCreatingGrampusJob(err) {
return nil, response.CAN_NOT_STOP_CREATING_JOB
}
log.Error("StopTask err.cloudbrainId=%d err=%v", cloudbrainId, err)
return nil, response.NewBizError(err)
}


+ 21
- 0
web_src/js/features/cloudrbanin.js View File

@@ -423,6 +423,14 @@ export default async function initCloudrain() {
$("#ai-stop-" + ID).removeClass("blue");
$("#ai-stop-" + ID).addClass("disabled");
refreshStatus(version_name, ID, repoPath, cloudbrainID);
} else {
$(".alert")
.html(data.error_msg)
.removeClass("alert-success")
.addClass("alert-danger")
.show()
.delay(2000)
.fadeOut();
}
}).fail(function (err) {
console.log(err);
@@ -450,6 +458,19 @@ export default async function initCloudrain() {
.removeClass("disabled")
.addClass("blue");
}
const detailStatus = data.DetailedStatus
const dataMigrate = $(`${ID}`).data('datamigrate')
const centerPend = $(`${ID}`).data('centerpend')
if (detailStatus === 'dataMigrating' || detailStatus === 'centerPending') {
if (document.getElementById(`${ID}-icon-detail`)) {
document.getElementById(`${ID}-icon-detail`).remove()
}
$("#" + ID + "-text").parent().append(`<i id="${ID}-icon-detail" class="${detailStatus}" style="vertical-align: middle;" title="${detailStatus === 'dataMigrating'? dataMigrate:centerPend}"></i>`)
} else {
if (document.getElementById(`${ID}-icon-detail`)) {
document.getElementById(`${ID}-icon-detail`).remove()
}
}
}).fail(function (err) {
console.log(err);
});


+ 1
- 1
web_src/vuepages/components/cloudbrain/DialogTips.vue View File

@@ -5,7 +5,7 @@
<ul>
<li class="mr-1">{{$t('cloudbrainObj.dialogTips.tips1')}}</li>
<li class="mr-1">{{$t('cloudbrainObj.dialogTips.tips2')}}<br>
<pre>
<pre style="padding: 0 4rem;white-space: pre-line;">
<span class="cl-red">""" ********************************** """</span>
<span class="cl-333">from</span> fastapi <span class="cl-333">import</span> FastAPI
<span class="cl-333">import</span> os


Loading…
Cancel
Save