Browse Source

Merge remote-tracking branch 'origin/res-manage-v2' into point-v2

tags/v1.22.9.2^2
chenyifan01 3 years ago
parent
commit
7f8b23da8e
22 changed files with 203 additions and 88 deletions
  1. +1
    -1
      models/cloudbrain.go
  2. +15
    -10
      models/dataset.go
  3. +16
    -6
      models/resource_specification.go
  4. +1
    -1
      modules/cloudbrain/resty.go
  5. +2
    -2
      options/locale/locale_en-US.ini
  6. +6
    -4
      routers/admin/resources.go
  7. +4
    -0
      routers/repo/dataset.go
  8. +1
    -0
      routers/response/response_list.go
  9. +5
    -1
      services/cloudbrain/resource/resource_specification.go
  10. +1
    -1
      templates/admin/resources/queue.tmpl
  11. +1
    -1
      templates/admin/resources/scene.tmpl
  12. +1
    -1
      templates/admin/resources/specification.tmpl
  13. +1
    -1
      templates/repo/datasets/index.tmpl
  14. +7
    -7
      templates/repo/modelarts/notebook/show.tmpl
  15. +39
    -4
      templates/repo/modelarts/trainjob/version_new.tmpl
  16. +27
    -21
      web_src/js/components/dataset/referenceDataset.vue
  17. +23
    -17
      web_src/js/components/dataset/selectDataset.vue
  18. +4
    -4
      web_src/js/features/i18nVue.js
  19. +6
    -1
      web_src/vuepages/langs/config/en-US.js
  20. +5
    -0
      web_src/vuepages/langs/config/zh-CN.js
  21. +7
    -2
      web_src/vuepages/pages/resources/components/SpecificationDialog.vue
  22. +30
    -3
      web_src/vuepages/pages/resources/specification/index.vue

+ 1
- 1
models/cloudbrain.go View File

@@ -1993,7 +1993,7 @@ func GetCloudbrainCountByUserID(userID int64, jobType string) (int, error) {
func GetCloudbrainRunCountByRepoID(repoID int64) (int, error) {
count, err := x.In("status", JobWaiting, JobRunning, ModelArtsCreateQueue, ModelArtsCreating, ModelArtsStarting,
ModelArtsReadyToStart, ModelArtsResizing, ModelArtsStartQueuing, ModelArtsRunning, ModelArtsRestarting, ModelArtsTrainJobInit,
ModelArtsTrainJobImageCreating, ModelArtsTrainJobSubmitTrying, ModelArtsTrainJobWaiting, ModelArtsTrainJobRunning,
ModelArtsTrainJobImageCreating, ModelArtsTrainJobSubmitTrying, ModelArtsTrainJobWaiting, ModelArtsTrainJobRunning, ModelArtsStopping, ModelArtsResizing,
ModelArtsTrainJobScaling, ModelArtsTrainJobCheckInit, ModelArtsTrainJobCheckRunning, ModelArtsTrainJobCheckRunningCompleted).And("repo_id = ?", repoID).Count(new(Cloudbrain))
return int(count), err
}


+ 15
- 10
models/dataset.go View File

@@ -171,16 +171,17 @@ func (datasets DatasetList) loadAttachmentAttributes(opts *SearchDatasetOptions)
}

type SearchDatasetOptions struct {
Keyword string
OwnerID int64
User *User
RepoID int64
IncludePublic bool
RecommendOnly bool
Category string
Task string
License string
DatasetIDs []int64
Keyword string
OwnerID int64
User *User
RepoID int64
IncludePublic bool
RecommendOnly bool
Category string
Task string
License string
DatasetIDs []int64
ExcludeDatasetId int64
ListOptions
SearchOrderBy
IsOwner bool
@@ -240,6 +241,10 @@ func SearchDatasetCondition(opts *SearchDatasetOptions) builder.Cond {
cond = cond.And(builder.Eq{"dataset.repo_id": opts.RepoID})
}

if opts.ExcludeDatasetId > 0 {
cond = cond.And(builder.Neq{"dataset.id": opts.ExcludeDatasetId})
}

if opts.PublicOnly {
cond = cond.And(builder.Eq{"dataset.status": DatasetStatusPublic})
cond = cond.And(builder.Eq{"attachment.is_private": false})


+ 16
- 6
models/resource_specification.go View File

@@ -23,6 +23,7 @@ type ResourceSpecification struct {
ShareMemGiB float32
UnitPrice int
Status int
IsAvailable bool
IsAutomaticSync bool
CreatedTime timeutil.TimeStamp `xorm:"created"`
CreatedBy int64
@@ -41,6 +42,7 @@ func (r ResourceSpecification) ConvertToRes() *ResourceSpecificationRes {
GPUMemGiB: r.GPUMemGiB,
UnitPrice: r.UnitPrice,
Status: r.Status,
IsAvailable: r.IsAvailable,
UpdatedTime: r.UpdatedTime,
}
}
@@ -73,14 +75,16 @@ func (r ResourceSpecificationReq) ToDTO() ResourceSpecification {
IsAutomaticSync: r.IsAutomaticSync,
CreatedBy: r.CreatorId,
UpdatedBy: r.CreatorId,
IsAvailable: true,
}
}

type SearchResourceSpecificationOptions struct {
ListOptions
QueueId int64
Status int
Cluster string
QueueId int64
Status int
Cluster string
AvailableCode int
}

type SearchResourceBriefSpecificationOptions struct {
@@ -114,6 +118,7 @@ type ResourceSpecificationRes struct {
ShareMemGiB float32
UnitPrice int
Status int
IsAvailable bool
UpdatedTime timeutil.TimeStamp
}

@@ -215,6 +220,11 @@ func SearchResourceSpecification(opts SearchResourceSpecificationOptions) (int64
if opts.Cluster != "" {
cond = cond.And(builder.Eq{"resource_queue.cluster": opts.Cluster})
}
if opts.AvailableCode == 1 {
cond = cond.And(builder.Eq{"resource_specification.is_available": true})
} else if opts.AvailableCode == 2 {
cond = cond.And(builder.Eq{"resource_specification.is_available": false})
}
//cond = cond.And(builder.Or(builder.Eq{"resource_queue.deleted_time": 0}).Or(builder.IsNull{"resource_queue.deleted_time"}))
n, err := x.Where(cond).Join("INNER", "resource_queue", "resource_queue.ID = resource_specification.queue_id").
Unscoped().Count(&ResourceSpecAndQueue{})
@@ -304,7 +314,7 @@ func SyncGrampusSpecs(updateList []ResourceSpecification, insertList []ResourceS
return err
}
if len(deleteIds) > 0 {
if _, err = sess.In("id", deleteIds).Update(&ResourceSpecification{Status: SpecOffShelf}); err != nil {
if _, err = sess.Cols("status", "is_available").In("id", deleteIds).Update(&ResourceSpecification{Status: SpecOffShelf, IsAvailable: false}); err != nil {
return err
}
if _, err = sess.In("spec_id", deleteIds).Delete(&ResourceSceneSpec{}); err != nil {
@@ -315,7 +325,7 @@ func SyncGrampusSpecs(updateList []ResourceSpecification, insertList []ResourceS
//update exists specs
if len(updateList) > 0 {
for _, v := range updateList {
if _, err = sess.ID(v.ID).Update(&v); err != nil {
if _, err = sess.ID(v.ID).UseBool("is_available").Update(&v); err != nil {
return err
}
}
@@ -382,7 +392,7 @@ func FindSpecs(opts FindSpecsOptions) ([]*Specification, error) {
s = s.Join("INNER", "resource_scene_spec", "resource_scene_spec.spec_id = resource_specification.id").
Join("INNER", "resource_scene", "resource_scene_spec.scene_id = resource_scene.id")
}
err := s.OrderBy("resource_queue.compute_resource asc,resource_queue.acc_card_type asc,resource_specification.acc_cards_num asc,resource_specification.cpu_cores asc").
err := s.OrderBy("resource_queue.compute_resource asc,resource_queue.acc_card_type asc,resource_specification.acc_cards_num asc,resource_specification.cpu_cores asc,resource_specification.mem_gi_b asc,resource_specification.share_mem_gi_b asc").
Unscoped().Find(&r)
if err != nil {
return nil, err


+ 1
- 1
modules/cloudbrain/resty.go View File

@@ -94,7 +94,7 @@ sendjob:
return nil, fmt.Errorf("resty get queues detail failed: %s", err)
}

if jobResult.Code == errInvalidToken && retry < 1 {
if (res.StatusCode() == http.StatusUnauthorized || jobResult.Code == errInvalidToken) && retry < 1 {
retry++
_ = loginCloudbrain()
goto sendjob


+ 2
- 2
options/locale/locale_en-US.ini View File

@@ -925,7 +925,7 @@ dataset_name_tooltips = Please enter letters, numbers, _ and - up to 100 charact
dataset_no_create = No dataset has been created yet
dataset_explain = Dataset: CloudBrain I provides CPU/GPU resources, Cloudbrain II provides Ascend NPU resources, and the data set used for debugging also needs to be uploaded to the corresponding environment;
dataset_instructions_for_use = Instructions for use: You can refer to Openi AI Collaboration Platform
dataset_camp_course = Newcomer Training Camp Course;
dataset_camp_course = OpenI_Learning;
dataset_upload = Upload
dataset_upload_status= Upload Status
dataset_file_name = File Name
@@ -1222,7 +1222,7 @@ model_Evaluation_not_created = Model evaluation has not been created
repo_not_initialized = Code version: You have not initialized the code repository, please <a href="%s"> initialized </a> first ;
debug_task_running_limit =Running time: no more than 4 hours, it will automatically stop if it exceeds 4 hours;
dataset_desc = Dataset: Cloud Brain 1 provides CPU/GPU,Cloud Brain 2 provides Ascend NPU.And dataset also needs to be uploaded to the corresponding environment;
platform_instructions = Instructions for use: You can refer to the <a href="https://git.openi.org.cn/zeizei/OpenI_Learning">Xiaobai training camp </a> course of Openi AI collaboration platform.
platform_instructions = Instructions for use: You can refer to the <a href="https://git.openi.org.cn/zeizei/OpenI_Learning"> OpenI_Learning </a> course of Openi AI collaboration platform.
model_not_exist = Model file: You do not have a model file yet, please generate and <a href="%s/modelmanage/show_model">export the model</a> through the <a href="%s/modelarts/train-job">training task</a> first ;
benchmark_leaderboards = Benchmark leaderboards



+ 6
- 4
routers/admin/resources.go View File

@@ -120,11 +120,13 @@ func GetResourceSpecificationList(ctx *context.Context) {
queue := ctx.QueryInt64("queue")
status := ctx.QueryInt("status")
cluster := ctx.Query("cluster")
available := ctx.QueryInt("available")
list, err := resource.GetResourceSpecificationList(models.SearchResourceSpecificationOptions{
ListOptions: models.ListOptions{Page: page, PageSize: 10},
QueueId: queue,
Status: status,
Cluster: cluster,
ListOptions: models.ListOptions{Page: page, PageSize: 10},
QueueId: queue,
Status: status,
Cluster: cluster,
AvailableCode: available,
})
if err != nil {
log.Error("GetResourceSpecificationList error.%v", err)


+ 4
- 0
routers/repo/dataset.go View File

@@ -529,6 +529,10 @@ func ReferenceDatasetAvailable(ctx *context.Context) {
NeedAttachment: false,
CloudBrainType: models.TypeCloudBrainAll,
}
dataset, _ := models.GetDatasetByRepo(&models.Repository{ID: ctx.Repo.Repository.ID})
if dataset != nil {
opts.ExcludeDatasetId = dataset.ID
}
datasetMultiple(ctx, opts)

}


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

@@ -2,3 +2,4 @@ package response

var RESOURCE_QUEUE_NOT_AVAILABLE = &BizError{Code: 1001, Err: "resource queue not available"}
var SPECIFICATION_NOT_EXIST = &BizError{Code: 1002, Err: "specification not exist"}
var SPECIFICATION_NOT_AVAILABLE = &BizError{Code: 1003, Err: "specification not available"}

+ 5
- 1
services/cloudbrain/resource/resource_specification.go View File

@@ -99,6 +99,7 @@ func SyncGrampusSpecs(doerId int64) error {
GPUMemGiB: gpuMemGiB,
Status: models.SpecNotVerified,
IsAutomaticSync: true,
IsAvailable: true,
CreatedBy: doerId,
UpdatedBy: doerId,
})
@@ -110,6 +111,7 @@ func SyncGrampusSpecs(doerId int64) error {
CpuCores: spec.SpecInfo.CpuCoreNum,
MemGiB: memGiB,
GPUMemGiB: gpuMemGiB,
IsAvailable: true,
UpdatedBy: doerId,
})
}
@@ -149,7 +151,9 @@ func ResourceSpecOnShelf(doerId int64, id int64, unitPrice int) *response.BizErr
if q, err := models.GetResourceQueue(&models.ResourceQueue{ID: spec.QueueId}); err != nil || q == nil {
return response.RESOURCE_QUEUE_NOT_AVAILABLE
}

if !spec.IsAvailable {
return response.SPECIFICATION_NOT_AVAILABLE
}
err = models.ResourceSpecOnShelf(id, unitPrice)
if err != nil {
return response.NewBizError(err)


+ 1
- 1
templates/admin/resources/queue.tmpl View File

@@ -4,7 +4,7 @@
{{template "admin/navbar" .}}
<div class="ui container">
<div id="__vue-root"></div>
</duv>
</div>
</div>
<script src="{{StaticUrlPrefix}}/js/vp-resources-queue.js?v={{MD5 AppVer}}"></script>
{{template "base/footer" .}}

+ 1
- 1
templates/admin/resources/scene.tmpl View File

@@ -4,7 +4,7 @@
{{template "admin/navbar" .}}
<div class="ui container">
<div id="__vue-root"></div>
</duv>
</div>
</div>
<script src="{{StaticUrlPrefix}}/js/vp-resources-scene.js?v={{MD5 AppVer}}"></script>
{{template "base/footer" .}}

+ 1
- 1
templates/admin/resources/specification.tmpl View File

@@ -4,7 +4,7 @@
{{template "admin/navbar" .}}
<div class="ui container">
<div id="__vue-root"></div>
</duv>
</div>
</div>
<script src="{{StaticUrlPrefix}}/js/vp-resources-specification.js?v={{MD5 AppVer}}"></script>
{{template "base/footer" .}}

+ 1
- 1
templates/repo/datasets/index.tmpl View File

@@ -417,7 +417,7 @@
<div class="bgtask-content">
<div class="bgtask-content-txt">{{.i18n.Tr "dataset.dataset_explain"}}</div>
<div class="bgtask-content-txt">{{.i18n.Tr "dataset.dataset_instructions_for_use"}}<a
href="https://git.openi.org.cn/zeizei/OpenI_Learning">{{.i18n.Tr "dataset.dataset_camp_course"}}</a></div>
href="https://git.openi.org.cn/zeizei/OpenI_Learning">&nbsp;{{.i18n.Tr "dataset.dataset_camp_course"}}</a></div>
</div>
</div>
</div>


+ 7
- 7
templates/repo/modelarts/notebook/show.tmpl View File

@@ -350,14 +350,14 @@

<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-mirror">
<span class="ui poping up clipboard" data-position="top center" id="clipboard-btn" style="cursor:pointer"
<span class="ui poping up clipboard" data-position="top center" id="clipboard-btn-image" style="cursor:pointer"
data-clipboard-text="{{.Image}}"
data-success="{{$.i18n.Tr "repo.copy_link_success"}}"
data-success="{{$.i18n.Tr "repo.copy_link_success"}}"
data-error="{{$.i18n.Tr "repo.copy_link_error"}}"
data-content="{{$.i18n.Tr "repo.copy_link"}}"
data-variation="inverted tiny"
>
<span title="{{.Image}}">{{.Image}}</span>
<span title="{{.Image}}">{{.Image}}</span>
</span>
</div>
</td>
@@ -427,7 +427,7 @@
</div>
</div>

</div>
<div style="clear:both">
<table style="border:none" class="ui fixed small stackable table">
@@ -437,11 +437,11 @@
<th style="color: #8a8e99;font-size:12px" class="two wide center aligned">{{$.i18n.Tr "dataset.download_oper"}}</th>
</tr></thead>
<tbody>
{{range $.datasetDownload}}
{{range $.datasetDownload}}
<tr>
<td style="word-wrap: break-word;word-break: break-all;"><a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a></td>
<td style="word-wrap: break-word;word-break: break-all;">{{.DatasetDownloadLink}}</td>
<td class="center aligned"><a class="ui poping up clipboard" id="clipboard-btn" data-original="{{$.i18n.Tr "repo.copy_link"}}" data-success="{{$.i18n.Tr "repo.copy_link_success"}}" data-error="{{$.i18n.Tr "repo.copy_link_error"}}" data-content="{{$.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-text="{{.DatasetDownloadLink}}">{{$.i18n.Tr "dataset.download_copy"}}</a></td>
<td class="center aligned"><a class="ui poping up clipboard" id="clipboard-btn-dataset" data-original="{{$.i18n.Tr "repo.copy_link"}}" data-success="{{$.i18n.Tr "repo.copy_link_success"}}" data-error="{{$.i18n.Tr "repo.copy_link_error"}}" data-content="{{$.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-text="{{.DatasetDownloadLink}}">{{$.i18n.Tr "dataset.download_copy"}}</a></td>
</tr>
{{end}}
</tbody>
@@ -506,4 +506,4 @@
$('td.ti-text-form-content.spec div').text(specStr);
$('td.ti-text-form-content.resorce_type div').text(getListValueWithKey(ACC_CARD_TYPE, SPEC.AccCardType));
})();
</script>
</script>

+ 39
- 4
templates/repo/modelarts/trainjob/version_new.tmpl View File

@@ -72,15 +72,50 @@
{{end}}
<input type="hidden" id="ai_engine_name" name="engine_names" value="">
<input type="hidden" id="ai_flaver_name" name="flaver_names" value="">
<input type="hidden" id="display_job_name" name="display_job_name" value="{{.display_job_name}}">
<div style="display: flex;align-items: center;margin-left: 156px;margin-top: 0.5rem;">
<input type="hidden" id="display_job_name" name="display_job_name" value="{{.display_job_name}}">
<h4 class="unite title ui header ">{{.i18n.Tr "repo.modelarts.train_job.basic_info"}}:</h4>
<div class="required min_title inline field">
<label class="" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_cluster"}}</label>
<div class="ui blue mini menu compact selectcloudbrain">
<a class="active item" href="javascript:void 0;" style="cursor:not-allowed;">
<svg class="svg" sxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z"></path></svg>
{{.i18n.Tr "cloudbrain.resource_cluster_openi"}}
</a>
<a class="item" href="javascript:void 0;" style="cursor:not-allowed;background:rgba(0,0,0,.03);">
<svg class="svg" sxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z"></path></svg>
{{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}(Beta)
</a>
</div>
</div>
<div class="required inline min_title field">
<label class="" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.compute_resource"}}</label>
<div class="ui blue mini menu compact selectcloudbrain">
<a class="item" href="javascript:void 0;" style="cursor:not-allowed;background:rgba(0,0,0,.03);">
<svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16"
height="16">
<path fill="none" d="M0 0h24v24H0z" />
<path
d="M3 2.992C3 2.444 3.445 2 3.993 2h16.014a1 1 0 0 1 .993.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 21.008V2.992zM19 11V4H5v7h14zm0 2H5v7h14v-7zM9 6h6v2H9V6zm0 9h6v2H9v-2z" />
</svg>
CPU/GPU
</a>
<a class="active item" href="javascript:void 0;" style="cursor:not-allowed;">
<svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16"
height="16">
<path fill="none" d="M0 0h24v24H0z" />
<path
d="M3 2.992C3 2.444 3.445 2 3.993 2h16.014a1 1 0 0 1 .993.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 21.008V2.992zM19 11V4H5v7h14zm0 2H5v7h14v-7zM9 6h6v2H9V6zm0 9h6v2H9v-2z" />
</svg>
Ascend NPU</a>
</div>
</div>
<div style="display: flex;align-items: center;margin-left: 156px;margin-top: -0.5rem;">
{{template "custom/task_wait_count" .}}
</div>
<div style="display: flex;align-items: center;margin-left: 156px;margin-top: 0.5rem;">
<div style="display: flex;align-items: center;margin-left: 156px;margin-top: 0.5rem;margin-bottom: 1.5rem;">
<i class="ri-error-warning-line" style="color: #f2711c;margin-right: 0.5rem;"></i>
<span style="color: #888;font-size: 12px;">{{.i18n.Tr "cloudbrain.train_dataset_path_rule" | Safe}}</span>
</div>
<h4 class="unite title ui header ">{{.i18n.Tr "repo.modelarts.train_job.basic_info"}}:</h4>
<div class="required unite min_title inline field">
<label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label>
<input type="hidden" style="width: 60%;" name="job_name" id="job_name" value="{{.job_name}}">


+ 27
- 21
web_src/js/components/dataset/referenceDataset.vue View File

@@ -339,19 +339,18 @@
overflow-y: auto;
"
>
<el-checkbox-group v-model="checkList">
<el-checkbox
v-for="(item, index) in selectDatasetArray"
:key="index"
:label="item.ID"
:title="item.Title"
@change="(checked) => changeCheckSelected(checked, item)"
style="display: flex; margin: 0.5rem 0"
><span class="select-data-right">{{
item.Title
}}</span></el-checkbox
>
</el-checkbox-group>
<el-checkbox
v-for="(item, index) in selectDatasetArray"
:key="index"
:label="item.ID"
:title="item.Title"
:value="item.isChecked"
@change="(checked) => changeCheckSelected(checked, item)"
style="display: flex; margin: 0.5rem 0"
><span class="select-data-right">{{
item.Title
}}</span></el-checkbox
>
</div>
<div style="text-align: end">
<el-button
@@ -406,7 +405,11 @@ export default {
methods: {
openDataset() {
this.checkList = this.datasetList.map((item) => {
this.selectDatasetArray.push({ ID: item.ID, Title: item.Title });
this.selectDatasetArray.push({
ID: item.ID,
Title: item.Title,
isChecked: true,
});
return item.ID;
});
this.dialogVisible = true;
@@ -473,7 +476,11 @@ export default {
return;
}
if (checked) {
this.selectDatasetArray.push({ ID: item.ID, Title: item.Title });
this.selectDatasetArray.push({
ID: item.ID,
Title: item.Title,
isChecked: true,
});
} else {
let index = this.selectDatasetArray.findIndex((element) => {
return element.ID === item.ID;
@@ -482,12 +489,11 @@ export default {
}
},
changeCheckSelected(checked, item) {
if (!checked) {
let index = this.selectDatasetArray.findIndex((element) => {
return element.ID === item.ID;
});
this.selectDatasetArray.splice(index, 1);
}
let index = this.selectDatasetArray.findIndex((element) => {
return element.ID === item.ID;
});
this.selectDatasetArray.splice(index, 1);
this.checkList.splice(index, 1);
},
postStar(item, isSigned) {
if (!isSigned) {


+ 23
- 17
web_src/js/components/dataset/selectDataset.vue View File

@@ -11,9 +11,9 @@
v-if="benchmarkNew"
class="label-fix-width"
style="font-weight: normal"
>{{i18n.dataset_label}}</label
>{{ i18n.dataset_label }}</label
>
<label v-else>{{i18n.dataset_label}}</label>
<label v-else>{{ i18n.dataset_label }}</label>
<span
:class="
benchmarkNew === true ? 'dataset-train-span' : 'dataset-debug-span'
@@ -59,7 +59,7 @@
? 'select-dataset-button'
: 'select-dataset-button-color'
"
>{{i18n.dataset_select}}
>{{ i18n.dataset_select }}
</el-button>
<el-dialog
:title="i18n.dataset_select"
@@ -90,7 +90,11 @@
>
<el-tabs v-model="activeName" @tab-click="handleClick">
<!-- 当前项目的数据集 -->
<el-tab-pane :label="i18n.dataset_current_repo" name="first" v-loading="loadingCurrent">
<el-tab-pane
:label="i18n.dataset_current_repo"
name="first"
v-loading="loadingCurrent"
>
<el-row>
<el-tree
:data="currentDatasetList"
@@ -172,13 +176,13 @@
class="zip-loading"
v-if="data.DecompressState === 2"
>
{{i18n.dataset_unziping}}
{{ i18n.dataset_unziping }}
</span>
<span
class="unzip-failed"
v-if="data.DecompressState === 3"
>
{{i18n.dataset_unzip_failed}}
{{ i18n.dataset_unzip_failed }}
</span>
</span>
</span>
@@ -201,7 +205,11 @@
</div>
</el-tab-pane>
<!-- 我上传的数据集 -->
<el-tab-pane :label="i18n.dataset_my_upload" name="second" v-loading="loadingMy">
<el-tab-pane
:label="i18n.dataset_my_upload"
name="second"
v-loading="loadingMy"
>
<el-row>
<el-tree
:data="myDatasetList"
@@ -274,13 +282,13 @@
class="zip-loading"
v-if="data.DecompressState === 2"
>
{{i18n.dataset_unziping}}
{{ i18n.dataset_unziping }}
</span>
<span
class="unzip-failed"
v-if="data.DecompressState === 3"
>
{{i18n.dataset_unzip_failed}}
{{ i18n.dataset_unzip_failed }}
</span>
</span>
</span>
@@ -380,13 +388,13 @@
class="zip-loading"
v-if="data.DecompressState === 2"
>
{{i18n.dataset_unziping}}
{{ i18n.dataset_unziping }}
</span>
<span
class="unzip-failed"
v-if="data.DecompressState === 3"
>
{{i18n.dataset_unzip_failed}}
{{ i18n.dataset_unzip_failed }}
</span>
</span>
</span>
@@ -486,13 +494,13 @@
class="zip-loading"
v-if="data.DecompressState === 2"
>
{{i18n.dataset_unziping}}
{{ i18n.dataset_unziping }}
</span>
<span
class="unzip-failed"
v-if="data.DecompressState === 3"
>
{{i18n.dataset_unzip_failed}}
{{ i18n.dataset_unzip_failed }}
</span>
</span>
</span>
@@ -536,7 +544,7 @@
line-height: 40px;
"
>
{{i18n.dataset_selected}}
{{ i18n.dataset_selected }}
</div>
<div style="flex: 1; margin-top: 1.5rem">
<el-checkbox-group v-model="checkList">
@@ -558,7 +566,7 @@
color: #fff;
border: 1px solid #389e0d;
"
>{{i18n.dataset_ok}}</el-button
>{{ i18n.dataset_ok }}</el-button
>
</div>
</el-col>
@@ -732,7 +740,6 @@ export default {
.then((res) => {
this.loadingCurrent = false;
let data = JSON.parse(res.data.data);
console.log(data);
this.currentDatasetList = this.transformeTreeData(
data,
"currentTree",
@@ -996,7 +1003,6 @@ export default {
location.href.indexOf("train-job") !== -1 ||
location.href.indexOf("inference") !== -1
) {
console.log("this.benchmarkNew");
this.benchmarkNew = true;
}
if (


+ 4
- 4
web_src/js/features/i18nVue.js View File

@@ -142,16 +142,16 @@ export const i18nVue = {
disassociate: "Unlink",
public_dataset: "Public Dataset",
selected_data_file: "Selected DataSets",
sure: "Ok",
sure: "OK",
search_dataset: "Search dataset name/description ...",
citations: "Citations",
downloads: "Downloads",
not_link_dataset: "No datasets have been associated yet",
not_link_dataset: "No datasets have been linked yet",
no_link_dataset_tips1:
"You can display public datasets on the platform here by clicking the New Linked Dataset button.",
"You can display public datasets on the platform here by clicking the Linked Datasets button.",

dataset_instructions_for_use:
"Instructions for use: You can refer to Openi AI Collaboration Platform ",
"Instructions for use: You can refer to OpenI AI Collaboration Platform ",
dataset_camp_course: " Newcomer Training Camp Course",
dataset_link_success: "Linked dataset succeeded!",
dataset_link_failed: "Linked dataset Failed!",


+ 6
- 1
web_src/vuepages/langs/config/en-US.js View File

@@ -132,6 +132,7 @@ const en = {
onShelfConfirm: 'Are you sure to on shelf the resources specification?',
offShelfConfirm: 'Are you sure to off shelf the resources specification?',
onShelfCode1001: 'On shelf failed, the resources queues not available.',
onShelfCode1003: 'On shelf failed, the resources specification not available.',
offShelfDlgTip1: 'The resources specification has already used in scene:',
offShelfDlgTip2: 'Please confirm to off shelf?',
resSceneManagement: 'Resources Scene Management',
@@ -150,7 +151,11 @@ const en = {
computeCluster: 'Compute Cluster',
resourceSpecification: 'Resource Specification',
lastUpdateTime: 'Last Update Time',
resSceneDeleteConfirm: 'Are you sure to delete the current Resource Scene?',
resSceneDeleteConfirm: 'Are you sure to delete the current Resource Scene?',
resourceSpecificationIsAvailable: 'Specification Is Available',
resourceSpecificationIsAvailableAll: 'Specification Is Available(All)',
available: 'Available',
notAvailable: 'Not Available',
},
}



+ 5
- 0
web_src/vuepages/langs/config/zh-CN.js View File

@@ -132,6 +132,7 @@ const zh = {
onShelfConfirm: '请确认上架该规格?',
offShelfConfirm: '请确认下架该规格?',
onShelfCode1001: '上架失败,资源池(队列)不可用。',
onShelfCode1003: '上架失败,资源规格不可用。',
offShelfDlgTip1: '当前资源规格已在以下场景中使用:',
offShelfDlgTip2: '请确认进行下架操作?',
resSceneManagement: '算力资源应用场景管理',
@@ -151,6 +152,10 @@ const zh = {
resourceSpecification: '资源规格',
lastUpdateTime: '最后更新时间',
resSceneDeleteConfirm: '是否确认删除当前应用场景?',
resourceSpecificationIsAvailable: '资源规格是否可用',
resourceSpecificationIsAvailableAll: '资源规格是否可用(全部)',
available: '可用',
notAvailable: '不可用',
},
}



+ 7
- 2
web_src/vuepages/pages/resources/components/SpecificationDialog.vue View File

@@ -20,8 +20,8 @@
<span>{{ $t('resourcesManagement.sourceSpecCode') }}</span>
</div>
<div class="content">
<el-input v-model="dataInfo.SourceSpecId" :placeholder="$t('resourcesManagement.sourceSpecCodeTips')" maxlength="255"
:disabled="type === 'edit'">
<el-input v-model="dataInfo.SourceSpecId" :placeholder="$t('resourcesManagement.sourceSpecCodeTips')"
maxlength="255" :disabled="type === 'edit'">
</el-input>
</div>
</div>
@@ -245,6 +245,11 @@ export default {
type: 'info',
message: this.$t('resourcesManagement.onShelfCode1001')
});
} else if (action === 'on-shelf' && res.Code === 1003) {
this.$message({
type: 'info',
message: this.$t('resourcesManagement.onShelfCode1003')
});
} else {
this.$message({
type: 'error',


+ 30
- 3
web_src/vuepages/pages/resources/specification/index.vue View File

@@ -9,6 +9,9 @@
<el-select class="select" size="medium" v-model="selStatus" @change="selectChange">
<el-option v-for="item in statusList" :key="item.k" :label="item.v" :value="item.k" />
</el-select>
<el-select class="select" size="medium" v-model="selAvailable" @change="selectChange">
<el-option v-for="item in availableList" :key="item.k" :label="item.v" :value="item.k" />
</el-select>
</div>
<div>
<el-button size="medium" icon="el-icon-refresh" @click="syncComputerNetwork" v-loading="syncLoading">
@@ -19,7 +22,7 @@
</div>
<div class="table-container">
<div style="min-height:600px;">
<el-table border :data="tableData" style="width: 100%" v-loading="loading" stripe>
<el-table border :data="tableData" style="width: 100%;min-width:1700px;" v-loading="loading" stripe>
<el-table-column prop="ID" label="ID" align="center" header-align="center" width="60"></el-table-column>
<el-table-column prop="SpecStr" :label="$t('resourcesManagement.resourceSpecification')" align="left"
header-align="center" min-width="160">
@@ -49,6 +52,14 @@
<span style="font-weight:600;font-size:14px;">{{ scope.row.UnitPrice }}</span>
</template>
</el-table-column>
<el-table-column prop="IsAvailableStr" :label="$t('resourcesManagement.resourceSpecificationIsAvailable')" align="center"
header-align="center" width="100">
<template slot-scope="scope">
<span :style="{ color: scope.row.IsAvailable ? 'rgb(82, 196, 26)' : 'rgb(245, 34, 45)' }">{{
scope.row.IsAvailableStr
}}</span>
</template>
</el-table-column>
<el-table-column prop="StatusStr" :label="$t('resourcesManagement.status')" align="center"
header-align="center" width="100">
<template slot-scope="scope">
@@ -60,7 +71,10 @@
<el-table-column :label="$t('operation')" align="center" header-align="center" width="100">
<template slot-scope="scope">
<span v-if="scope.row.Status == '1' && !scope.row.UnitPrice">
<span class="op-btn" @click="showDialog('edit', scope.row)">{{
<span v-if="scope.row.IsAvailable" class="op-btn" @click="showDialog('edit', scope.row)">{{
$t('resourcesManagement.toSetPriceAndOnShelf')
}}</span>
<span v-else class="op-btn" style="color: rgb(187, 187, 187); cursor: not-allowed;">{{
$t('resourcesManagement.toSetPriceAndOnShelf')
}}</span>
</span>
@@ -71,9 +85,12 @@
}}</span>
</span>
<span v-if="scope.row.Status == '3' || scope.row.Status == '1' && scope.row.UnitPrice">
<span class="op-btn" @click="onShelf(scope.row)">{{
<span v-if="scope.row.IsAvailable" class="op-btn" @click="onShelf(scope.row)">{{
$t('resourcesManagement.toOnShelf')
}}</span>
<span v-else class="op-btn" style="color: rgb(187, 187, 187); cursor: not-allowed;">{{
$t('resourcesManagement.toSetPriceAndOnShelf')
}}</span>
</span>
</template>
</el-table-column>
@@ -132,6 +149,8 @@ export default {
queueList: [{ k: '', v: this.$t('resourcesManagement.allResQueue') }],
selStatus: '',
statusList: [{ k: '', v: this.$t('resourcesManagement.allStatus') }, ...SPECIFICATION_STATUS],
selAvailable: '',
availableList: [{ k: '', v: this.$t('resourcesManagement.resourceSpecificationIsAvailableAll') }, { k: '1', v: this.$t('resourcesManagement.available') }, { k: '2', v: this.$t('resourcesManagement.notAvailable') }],
clusterList: [...CLUSTERS],
accCardTypeList: [...ACC_CARD_TYPE],
syncLoading: false,
@@ -178,6 +197,7 @@ export default {
const params = {
queue: this.selQueue,
status: this.selStatus,
available: this.selAvailable,
page: this.pageInfo.curpage,
pagesize: this.pageInfo.pageSize,
};
@@ -201,6 +221,8 @@ export default {
UpdatedTimeStr: formatDate(new Date(Spec.UpdatedTime * 1000), 'yyyy-MM-dd HH:mm:ss'),
Status: Spec.Status.toString(),
StatusStr: getListValueWithKey(this.statusList, Spec.Status.toString()),
IsAvailable: Spec.IsAvailable,
IsAvailableStr: Spec.IsAvailable ? this.$t('resourcesManagement.available') : this.$t('resourcesManagement.notAvailable'),
}
});
this.tableData = data;
@@ -280,6 +302,11 @@ export default {
type: 'info',
message: this.$t('resourcesManagement.onShelfCode1001')
});
} else if (type === 'on-shelf' && res.Code === 1003) {
this.$message({
type: 'info',
message: this.$t('resourcesManagement.onShelfCode1003')
});
} else {
this.$message({
type: 'error',


Loading…
Cancel
Save