@@ -1490,6 +1490,8 @@ type GrampusTasks struct { | |||||
ReplicaNum int `json:"replicaNum"` | ReplicaNum int `json:"replicaNum"` | ||||
Datasets []GrampusDataset `json:"datasets"` | Datasets []GrampusDataset `json:"datasets"` | ||||
Models []GrampusDataset `json:"models"` | Models []GrampusDataset `json:"models"` | ||||
Code GrampusDataset `json:"code"` | |||||
BootFile string `json:"bootFile"` | |||||
} | } | ||||
type GrampusDataset struct { | type GrampusDataset struct { | ||||
@@ -2281,8 +2283,7 @@ func CloudbrainAllStatic(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, er | |||||
} | } | ||||
sess.OrderBy("cloudbrain.created_unix DESC") | sess.OrderBy("cloudbrain.created_unix DESC") | ||||
cloudbrains := make([]*CloudbrainInfo, 0, setting.UI.IssuePagingNum) | cloudbrains := make([]*CloudbrainInfo, 0, setting.UI.IssuePagingNum) | ||||
if err := sess.Cols("status", "type", "job_type", "train_job_duration", "duration", "compute_resource", | |||||
"created_unix", "start_time", "end_time").Table(&Cloudbrain{}).Unscoped().Where(cond). | |||||
if err := sess.Table(&Cloudbrain{}).Unscoped().Where(cond). | |||||
Find(&cloudbrains); err != nil { | Find(&cloudbrains); err != nil { | ||||
return nil, 0, fmt.Errorf("Find: %v", err) | return nil, 0, fmt.Errorf("Find: %v", err) | ||||
} | } | ||||
@@ -34,6 +34,7 @@ type TaskDetail struct { | |||||
CardDuration string `json:"CardDuration"` | CardDuration string `json:"CardDuration"` | ||||
AiCenter string `json:"AiCenter"` | AiCenter string `json:"AiCenter"` | ||||
FlavorName string `json:"FlavorName"` | FlavorName string `json:"FlavorName"` | ||||
WorkServerNum int64 `json:"WorkServerNum"` | |||||
Spec *Specification `json:"Spec"` | Spec *Specification `json:"Spec"` | ||||
} | } | ||||
@@ -44,16 +45,45 @@ func GetTodayCreatorCount(beginTime time.Time, endTime time.Time) (int64, error) | |||||
return x.SQL(countSql).Count() | return x.SQL(countSql).Count() | ||||
} | } | ||||
func GetTodayCloudbrainCount(beginTime time.Time, endTime time.Time) (int64, error) { | func GetTodayCloudbrainCount(beginTime time.Time, endTime time.Time) (int64, error) { | ||||
countSql := "SELECT count FROM " + | |||||
countSql := "SELECT count(*) FROM " + | |||||
"public.cloudbrain where created_unix >=" + strconv.FormatInt(beginTime.Unix(), 10) + | "public.cloudbrain where created_unix >=" + strconv.FormatInt(beginTime.Unix(), 10) + | ||||
" and created_unix<=" + strconv.FormatInt(endTime.Unix(), 10) | " and created_unix<=" + strconv.FormatInt(endTime.Unix(), 10) | ||||
return x.SQL(countSql).Count() | return x.SQL(countSql).Count() | ||||
} | } | ||||
func GetTodayRunningCount(beginTime time.Time, endTime time.Time) (int64, error) { | |||||
countSql := "SELECT count(*) FROM " + | |||||
"public.cloudbrain where created_unix >=" + strconv.FormatInt(beginTime.Unix(), 10) + | |||||
" and created_unix<=" + strconv.FormatInt(endTime.Unix(), 10) + " and (status='" + string(JobRunning) + "'" + | |||||
" or status='" + string(ModelArtsTrainJobInit) + "')" | |||||
return x.SQL(countSql).Count() | |||||
} | |||||
func GetTodayWaitingCount(beginTime time.Time, endTime time.Time) (int64, error) { | |||||
countSql := "SELECT count(*) FROM " + | |||||
"public.cloudbrain where created_unix >=" + strconv.FormatInt(beginTime.Unix(), 10) + | |||||
" and created_unix<=" + strconv.FormatInt(endTime.Unix(), 10) + " and status='" + string(JobWaiting) + "'" | |||||
return x.SQL(countSql).Count() | |||||
} | |||||
func GetCreatorCount() (int64, error) { | func GetCreatorCount() (int64, error) { | ||||
countSql := "SELECT count(distinct user_id) FROM public.cloudbrain" | countSql := "SELECT count(distinct user_id) FROM public.cloudbrain" | ||||
return x.SQL(countSql).Count() | return x.SQL(countSql).Count() | ||||
} | } | ||||
func GetCloudbrainTypeCount() ([]map[string]string, error) { | |||||
countSql := "SELECT type,count(*) num FROM public.cloudbrain group by type order by num desc" | |||||
return x.QueryString(countSql) | |||||
} | |||||
func GetCloudbrainStatusCount() ([]map[string]string, error) { | |||||
countSql := "SELECT status,count(*) num FROM public.cloudbrain group by status order by num desc" | |||||
return x.QueryString(countSql) | |||||
} | |||||
func GetCloudbrainTpyeDurationSum() ([]map[string]string, error) { | |||||
countSql := "SELECT type,sum(duration) FROM public.cloudbrain group by type order by sum(duration) desc" | |||||
return x.QueryString(countSql) | |||||
} | |||||
func GetRecordBeginTime() ([]*CloudbrainInfo, error) { | func GetRecordBeginTime() ([]*CloudbrainInfo, error) { | ||||
sess := x.NewSession() | sess := x.NewSession() | ||||
defer sess.Close() | defer sess.Close() | ||||
@@ -679,7 +679,7 @@ func (repo *Repository) getAssignees(e Engine) (_ []*User, err error) { | |||||
userIDs[i] = accesses[i].UserID | userIDs[i] = accesses[i].UserID | ||||
} | } | ||||
if err = e.In("id", userIDs).Find(&users); err != nil { | |||||
if err = e.In("id", userIDs).OrderBy("name asc").Find(&users); err != nil { | |||||
return nil, err | return nil, err | ||||
} | } | ||||
} | } | ||||
@@ -1,6 +1,7 @@ | |||||
package grampus | package grampus | ||||
import ( | import ( | ||||
"code.gitea.io/gitea/modules/cloudbrain" | |||||
"encoding/json" | "encoding/json" | ||||
"strings" | "strings" | ||||
@@ -73,6 +74,7 @@ type GenerateTrainJobReq struct { | |||||
PreTrainModelPath string | PreTrainModelPath string | ||||
PreTrainModelUrl string | PreTrainModelUrl string | ||||
Spec *models.Specification | Spec *models.Specification | ||||
CodeName string | |||||
} | } | ||||
func getEndPoint() string { | func getEndPoint() string { | ||||
@@ -102,6 +104,7 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error | |||||
centerID, centerName := getCentersParamter(ctx, req) | centerID, centerName := getCentersParamter(ctx, req) | ||||
var datasetGrampus, modelGrampus []models.GrampusDataset | var datasetGrampus, modelGrampus []models.GrampusDataset | ||||
var codeGrampus models.GrampusDataset | |||||
if ProcessorTypeNPU == req.ProcessType { | if ProcessorTypeNPU == req.ProcessType { | ||||
datasetGrampus = getDatasetGrampus(req.DatasetInfos) | datasetGrampus = getDatasetGrampus(req.DatasetInfos) | ||||
if len(req.ModelName) != 0 { | if len(req.ModelName) != 0 { | ||||
@@ -114,6 +117,12 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error | |||||
}, | }, | ||||
} | } | ||||
} | } | ||||
codeGrampus = models.GrampusDataset{ | |||||
Name: req.CodeName, | |||||
Bucket: setting.Bucket, | |||||
EndPoint: getEndPoint(), | |||||
ObjectKey: req.CodeObsPath + cloudbrain.DefaultBranchName + ".zip", | |||||
} | |||||
} | } | ||||
jobResult, err := createJob(models.CreateGrampusJobRequest{ | jobResult, err := createJob(models.CreateGrampusJobRequest{ | ||||
@@ -130,6 +139,8 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error | |||||
ReplicaNum: 1, | ReplicaNum: 1, | ||||
Datasets: datasetGrampus, | Datasets: datasetGrampus, | ||||
Models: modelGrampus, | Models: modelGrampus, | ||||
Code: codeGrampus, | |||||
BootFile: req.BootFile, | |||||
}, | }, | ||||
}, | }, | ||||
}) | }) | ||||
@@ -8,6 +8,7 @@ import ( | |||||
"fmt" | "fmt" | ||||
"os" | "os" | ||||
"strings" | "strings" | ||||
"text/template" | |||||
"code.gitea.io/gitea/models" | "code.gitea.io/gitea/models" | ||||
"code.gitea.io/gitea/modules/git" | "code.gitea.io/gitea/modules/git" | ||||
@@ -34,7 +35,7 @@ func CreateRepository(doer, u *models.User, opts models.CreateRepoOptions) (_ *m | |||||
Name: opts.Name, | Name: opts.Name, | ||||
Alias: opts.Alias, | Alias: opts.Alias, | ||||
LowerName: strings.ToLower(opts.Name), | LowerName: strings.ToLower(opts.Name), | ||||
Description: opts.Description, | |||||
Description: template.HTMLEscapeString(opts.Description), | |||||
OriginalURL: opts.OriginalURL, | OriginalURL: opts.OriginalURL, | ||||
OriginalServiceType: opts.GitServiceType, | OriginalServiceType: opts.GitServiceType, | ||||
IsPrivate: opts.IsPrivate, | IsPrivate: opts.IsPrivate, | ||||
@@ -394,7 +394,7 @@ var ( | |||||
DefaultGitTreesPerPage int | DefaultGitTreesPerPage int | ||||
DefaultMaxBlobSize int64 | DefaultMaxBlobSize int64 | ||||
}{ | }{ | ||||
EnableSwagger: true, | |||||
EnableSwagger: false, | |||||
SwaggerURL: "", | SwaggerURL: "", | ||||
MaxResponseItems: 50, | MaxResponseItems: 50, | ||||
DefaultPagingNum: 30, | DefaultPagingNum: 30, | ||||
@@ -1058,6 +1058,7 @@ modify_image=Modify Image | |||||
image_exist=Image name has been used, please use a new one. | image_exist=Image name has been used, please use a new one. | ||||
image_committing=Image is submitting, please try again later. | image_committing=Image is submitting, please try again later. | ||||
image_commit_fail=Failed to submit image, please try again later. | image_commit_fail=Failed to submit image, please try again later. | ||||
image_over_20g=Failed to submit image, the size of image can not be over 20GB. | |||||
image_not_exist=Image does not exits. | image_not_exist=Image does not exits. | ||||
image_edit_fail=Failed to edit image, please try again later. | image_edit_fail=Failed to edit image, please try again later. | ||||
image_delete_fail=Failed to delete image, please try again later. | image_delete_fail=Failed to delete image, please try again later. | ||||
@@ -1373,7 +1374,9 @@ fork_guest_user = Sign in to fork this repository. | |||||
copy_link = Copy | copy_link = Copy | ||||
copy_link_success = Link has been copied | copy_link_success = Link has been copied | ||||
copy_link_error = Use ⌘C or Ctrl-C to copy | copy_link_error = Use ⌘C or Ctrl-C to copy | ||||
copy = Copy | |||||
copied = Copied OK | copied = Copied OK | ||||
copied_error = Copied error | |||||
unwatch = Unwatch | unwatch = Unwatch | ||||
watch = Watch | watch = Watch | ||||
unstar = Unstar | unstar = Unstar | ||||
@@ -3207,11 +3210,11 @@ wrong_specification=You cannot use this specification, please choose another ite | |||||
resource_use=Resource Occupancy | resource_use=Resource Occupancy | ||||
job_name_rule = Please enter letters, numbers, _ and - up to 64 characters and cannot end with a dash (-). | job_name_rule = Please enter letters, numbers, _ and - up to 64 characters and cannot end with a dash (-). | ||||
train_dataset_path_rule = The dataset location is stored in the environment variable <strong style="color:#010101">data_url</strong>, the pre-trained model is storaged in the environment <strong style="color:#010101">ckpt_url</strong>, and the output path is stored in the environment variable <strong style="color:#010101">train_url</strong>. | |||||
infer_dataset_path_rule = The dataset location is stored in the environment variable <strong style="color:#010101">data_url</strong>, and the output path is stored in the environment variable <strong style="color:#010101">result_url</strong>. | |||||
train_dataset_path_rule = The dataset location is stored in the run parameter <strong style="color:#010101">data_url</strong>, the pre-trained model is storaged in the run parameter <strong style="color:#010101">ckpt_url</strong>, and the output path is stored in the run parameter <strong style="color:#010101">train_url</strong>. | |||||
infer_dataset_path_rule = The dataset location is stored in the run parameter <strong style="color:#010101">data_url</strong>, and the output path is stored in the run parameter <strong style="color:#010101">result_url</strong>. | |||||
view_sample = View sample | view_sample = View sample | ||||
inference_output_path_rule = The inference output path is stored in the environment variable result_url. | |||||
model_file_path_rule=The model file location is stored in the environment variable ckpt_url | |||||
inference_output_path_rule = The inference output path is stored in the run parameter result_url. | |||||
model_file_path_rule=The model file location is stored in the run parameter ckpt_url | |||||
model_file_postfix_rule = The supported format of the model file is [ckpt, pb, h5, json, pkl, pth, t7, pdparams, onnx, pbtxt, keras, mlmodel, cfg, pt] | model_file_postfix_rule = The supported format of the model file is [ckpt, pb, h5, json, pkl, pth, t7, pdparams, onnx, pbtxt, keras, mlmodel, cfg, pt] | ||||
model_convert_postfix_rule = The supported format of the model file is [.pth, .pkl, .onnx, .mindir, .ckpt, .pb] | model_convert_postfix_rule = The supported format of the model file is [.pth, .pkl, .onnx, .mindir, .ckpt, .pb] | ||||
delete_task = Delete task | delete_task = Delete task | ||||
@@ -3231,6 +3234,7 @@ point_hr = Point/hr | |||||
DEBUG = DEBUG | DEBUG = DEBUG | ||||
SNN4IMAGENET = BENCHMARK | SNN4IMAGENET = BENCHMARK | ||||
BRAINSCORE = BENCHMARK | BRAINSCORE = BENCHMARK | ||||
MODELSAFETY = BENCHMARK | |||||
TRAIN = TRAIN | TRAIN = TRAIN | ||||
INFERENCE = INFERENCE | INFERENCE = INFERENCE | ||||
BENCHMARK = BENCHMARK | BENCHMARK = BENCHMARK | ||||
@@ -3244,8 +3248,8 @@ Stopped_success_update_status_fail=Succeed in stopping th job, but failed to upd | |||||
load_code_failed=Fail to load code, please check if the right branch is selected. | load_code_failed=Fail to load code, please check if the right branch is selected. | ||||
error.dataset_select = dataset select error:the count exceed the limit or has same name | error.dataset_select = dataset select error:the count exceed the limit or has same name | ||||
new_train_gpu_tooltips = The code is storaged in <strong style="color:#010101">%s</strong>, the dataset is storaged in <strong style="color:#010101">%s</strong>, the pre-trained model is storaged in the environment <strong style="color:#010101">%s</strong>, and please put your model into <strong style="color:#010101">%s</strong> then you can download it online | |||||
new_train_npu_tooltips = The code is storaged in <strong style="color:#010101">%s</strong>, the pre-trained model is storaged in the environment <strong style="color:#010101">%s</strong>, and please put your model into <strong style="color:#010101">%s</strong> then you can download it online | |||||
new_train_gpu_tooltips = The code is storaged in <strong style="color:#010101">%s</strong>, the dataset is storaged in <strong style="color:#010101">%s</strong>, the pre-trained model is storaged in the run parameter <strong style="color:#010101">%s</strong>, and please put your model into <strong style="color:#010101">%s</strong> then you can download it online | |||||
new_train_npu_tooltips = The code is storaged in <strong style="color:#010101">%s</strong>, the pre-trained model is storaged in the run parameter <strong style="color:#010101">%s</strong>, and please put your model into <strong style="color:#010101">%s</strong> then you can download it online | |||||
new_infer_gpu_tooltips = The dataset is stored in <strong style="color:#010101">%s</strong>, the model file is stored in <strong style="color:#010101">%s</strong>, please store the inference output in <strong style="color:#010101">%s</strong> for subsequent downloads. | new_infer_gpu_tooltips = The dataset is stored in <strong style="color:#010101">%s</strong>, the model file is stored in <strong style="color:#010101">%s</strong>, please store the inference output in <strong style="color:#010101">%s</strong> for subsequent downloads. | ||||
[points] | [points] | ||||
@@ -1059,6 +1059,7 @@ modify_image=修改镜像 | |||||
image_exist=镜像Tag已被使用,请修改镜像Tag。 | image_exist=镜像Tag已被使用,请修改镜像Tag。 | ||||
image_committing=镜像正在提交中,请稍后再试。 | image_committing=镜像正在提交中,请稍后再试。 | ||||
image_commit_fail=提交镜像失败,请稍后再试。 | image_commit_fail=提交镜像失败,请稍后再试。 | ||||
image_over_20g=提交镜像失败,镜像大小不能超过20GB。 | |||||
image_not_exist=镜像不存在。 | image_not_exist=镜像不存在。 | ||||
image_edit_fail=编辑镜像失败,请稍后再试。 | image_edit_fail=编辑镜像失败,请稍后再试。 | ||||
image_delete_fail=删除镜像失败,请稍后再试。 | image_delete_fail=删除镜像失败,请稍后再试。 | ||||
@@ -1389,7 +1390,9 @@ fork_guest_user=登录并 派生 这个项目。 | |||||
copy_link=复制链接 | copy_link=复制链接 | ||||
copy_link_success=已复制链接 | copy_link_success=已复制链接 | ||||
copy_link_error=请按下 ⌘-C 或 Ctrl-C 复制 | copy_link_error=请按下 ⌘-C 或 Ctrl-C 复制 | ||||
copy=复制 | |||||
copied=复制成功 | copied=复制成功 | ||||
copied_error=复制失败 | |||||
unwatch=取消关注 | unwatch=取消关注 | ||||
watch=关注 | watch=关注 | ||||
unstar=取消点赞 | unstar=取消点赞 | ||||
@@ -2022,7 +2025,7 @@ settings.githooks=管理 Git 钩子 | |||||
settings.basic_settings=基本设置 | settings.basic_settings=基本设置 | ||||
settings.mirror_settings=镜像设置 | settings.mirror_settings=镜像设置 | ||||
settings.sync_mirror=同步 | settings.sync_mirror=同步 | ||||
settings.mirror_sync_in_progress=镜像同步正在进行中,请稍后后再试。 | |||||
settings.mirror_sync_in_progress=镜像同步正在进行中,请稍后再试。 | |||||
settings.email_notifications.enable=启用邮件通知 | settings.email_notifications.enable=启用邮件通知 | ||||
settings.email_notifications.onmention=只在被提到时邮件通知 | settings.email_notifications.onmention=只在被提到时邮件通知 | ||||
settings.email_notifications.disable=停用邮件通知 | settings.email_notifications.disable=停用邮件通知 | ||||
@@ -3225,11 +3228,11 @@ card_type = 卡类型 | |||||
wrong_specification=您目前不能使用这个资源规格,请选择其他资源规格。 | wrong_specification=您目前不能使用这个资源规格,请选择其他资源规格。 | ||||
job_name_rule = 请输入字母、数字、_和-,最长64个字符,且不能以中划线(-)结尾。 | job_name_rule = 请输入字母、数字、_和-,最长64个字符,且不能以中划线(-)结尾。 | ||||
train_dataset_path_rule = 数据集位置存储在环境变量<strong style="color:#010101">data_url</strong>中,预训练模型存放在环境变量<strong style="color:#010101">ckpt_url</strong>中,训练输出路径存储在环境变量<strong style="color:#010101">train_url</strong>中。 | |||||
infer_dataset_path_rule = 数据集位置存储在环境变量<strong style="color:#010101">data_url</strong>中,推理输出路径存储在环境变量<strong style="color:#010101">result_url</strong>中。 | |||||
train_dataset_path_rule = 数据集位置存储在运行参数 <strong style="color:#010101">data_url</strong> 中,预训练模型存放在运行参数 <strong style="color:#010101">ckpt_url</strong> 中,训练输出路径存储在运行参数 <strong style="color:#010101">train_url</strong> 中。 | |||||
infer_dataset_path_rule = 数据集位置存储在运行参数 <strong style="color:#010101">data_url</strong> 中,推理输出路径存储在运行参数 <strong style="color:#010101">result_url</strong> 中。 | |||||
view_sample = 查看样例 | view_sample = 查看样例 | ||||
inference_output_path_rule = 推理输出路径存储在环境变量result_url中。 | |||||
model_file_path_rule = 模型文件位置存储在环境变量ckpt_url中。 | |||||
inference_output_path_rule = 推理输出路径存储在运行参数 result_url 中。 | |||||
model_file_path_rule = 模型文件位置存储在运行参数 ckpt_url 中。 | |||||
model_file_postfix_rule = 模型文件支持的格式为 [ckpt, pb, h5, json, pkl, pth, t7, pdparams, onnx, pbtxt, keras, mlmodel, cfg, pt] | model_file_postfix_rule = 模型文件支持的格式为 [ckpt, pb, h5, json, pkl, pth, t7, pdparams, onnx, pbtxt, keras, mlmodel, cfg, pt] | ||||
model_convert_postfix_rule = 模型文件支持的格式为 [.pth, .pkl, .onnx, .mindir, .ckpt, .pb] | model_convert_postfix_rule = 模型文件支持的格式为 [.pth, .pkl, .onnx, .mindir, .ckpt, .pb] | ||||
delete_task = 删除任务 | delete_task = 删除任务 | ||||
@@ -3249,6 +3252,7 @@ point_hr = 积分/时 | |||||
DEBUG = 调试任务 | DEBUG = 调试任务 | ||||
SNN4IMAGENET = 评测任务 | SNN4IMAGENET = 评测任务 | ||||
BRAINSCORE = 评测任务 | BRAINSCORE = 评测任务 | ||||
MODELSAFETY = 评测任务 | |||||
TRAIN = 训练任务 | TRAIN = 训练任务 | ||||
INFERENCE = 推理任务 | INFERENCE = 推理任务 | ||||
BENCHMARK = 评测任务 | BENCHMARK = 评测任务 | ||||
@@ -3263,9 +3267,9 @@ load_code_failed=代码加载失败,请确认选择了正确的分支。 | |||||
error.dataset_select = 数据集选择错误:数量超过限制或者有同名数据集 | error.dataset_select = 数据集选择错误:数量超过限制或者有同名数据集 | ||||
new_train_gpu_tooltips =训练脚本存储在<strong style="color:#010101">%s</strong>中,数据集存储在<strong style="color:#010101">%s</strong>中,预训练模型存放在环境变量<strong style="color:#010101">%s</strong>中,训练输出请存储在<strong style="color:#010101">%s</strong>中以供后续下载。 | |||||
new_train_npu_tooltips =训练脚本存储在<strong style="color:#010101">%s</strong>中,预训练模型存放在环境变量<strong style="color:#010101">%s</strong>中,训练输出请存储在<strong style="color:#010101">%s</strong>中以供后续下载。 | |||||
new_infer_gpu_tooltips = 数据集存储在<strong style="color:#010101">%s</strong>中,模型文件存储在<strong style="color:#010101">%s</strong>中,推理输出请存储在<strong style="color:#010101">%s</strong>中以供后续下载。 | |||||
new_train_gpu_tooltips = 训练脚本存储在 <strong style="color:#010101">%s</strong> 中,数据集存储在 <strong style="color:#010101">%s</strong> 中,预训练模型存放在运行参数 <strong style="color:#010101">%s</strong> 中,训练输出请存储在 <strong style="color:#010101">%s</strong> 中以供后续下载。 | |||||
new_train_npu_tooltips = 训练脚本存储在 <strong style="color:#010101">%s</strong> 中,预训练模型存放在运行参数 <strong style="color:#010101">%s</strong> 中,训练输出请存储在 <strong style="color:#010101">%s</strong> 中以供后续下载。 | |||||
new_infer_gpu_tooltips = 数据集存储在 <strong style="color:#010101">%s</strong> 中,模型文件存储在 <strong style="color:#010101">%s</strong> 中,推理输出请存储在 <strong style="color:#010101">%s</strong> 中以供后续下载。 | |||||
[points] | [points] | ||||
points = 积分 | points = 积分 | ||||
@@ -98,8 +98,6 @@ func CloudBrains(ctx *context.Context) { | |||||
ciTasks[i].CanDebug = true | ciTasks[i].CanDebug = true | ||||
ciTasks[i].CanDel = true | ciTasks[i].CanDel = true | ||||
ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource | ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource | ||||
ciTasks[i].Cloudbrain.AiCenter = repo.GetCloudbrainAiCenter(task.Cloudbrain, ctx) | |||||
ciTasks[i].Cloudbrain.Cluster = repo.GetCloudbrainCluster(task.Cloudbrain, ctx) | |||||
} | } | ||||
pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, getTotalPage(count, setting.UI.IssuePagingNum)) | pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, getTotalPage(count, setting.UI.IssuePagingNum)) | ||||
@@ -179,6 +177,7 @@ func DownloadCloudBrains(ctx *context.Context) { | |||||
log.Warn("Can not get cloud brain info", err) | log.Warn("Can not get cloud brain info", err) | ||||
continue | continue | ||||
} | } | ||||
models.LoadSpecs4CloudbrainInfo(pageRecords) | |||||
for _, record := range pageRecords { | for _, record := range pageRecords { | ||||
for k, v := range allValues(row, record, ctx) { | for k, v := range allValues(row, record, ctx) { | ||||
@@ -208,8 +207,11 @@ func allValues(row int, rs *models.CloudbrainInfo, ctx *context.Context) map[str | |||||
} | } | ||||
func getCloudbrainCardType(rs *models.CloudbrainInfo) string { | func getCloudbrainCardType(rs *models.CloudbrainInfo) string { | ||||
_, cardType, _ := repo.GetCloudbrainCardNumAndType(rs.Cloudbrain) | |||||
return cardType | |||||
if rs.Cloudbrain.Spec != nil { | |||||
return rs.Cloudbrain.Spec.AccCardType | |||||
} else { | |||||
return "" | |||||
} | |||||
} | } | ||||
func getRepoPathName(rs *models.CloudbrainInfo) string { | func getRepoPathName(rs *models.CloudbrainInfo) string { | ||||
@@ -221,6 +221,7 @@ func GetResourceSceneList(ctx *context.Context) { | |||||
func AddResourceScene(ctx *context.Context, req models.ResourceSceneReq) { | func AddResourceScene(ctx *context.Context, req models.ResourceSceneReq) { | ||||
req.CreatorId = ctx.User.ID | req.CreatorId = ctx.User.ID | ||||
req.ExclusiveOrg = strings.ReplaceAll(req.ExclusiveOrg, " ", "") | |||||
err := resource.AddResourceScene(req) | err := resource.AddResourceScene(req) | ||||
if err != nil { | if err != nil { | ||||
log.Error("AddResourceScene error. %v", err) | log.Error("AddResourceScene error. %v", err) | ||||
@@ -238,6 +239,7 @@ func UpdateResourceScene(ctx *context.Context, req models.ResourceSceneReq) { | |||||
var err error | var err error | ||||
switch action { | switch action { | ||||
case "edit": | case "edit": | ||||
req.ExclusiveOrg = strings.ReplaceAll(req.ExclusiveOrg, " ", "") | |||||
err = resource.UpdateResourceScene(req) | err = resource.UpdateResourceScene(req) | ||||
case "delete": | case "delete": | ||||
err = resource.DeleteResourceScene(id) | err = resource.DeleteResourceScene(id) | ||||
@@ -590,6 +590,7 @@ func RegisterRoutes(m *macaron.Macaron) { | |||||
m.Get("/downloadAll", repo.DownloadCloudBrainBoard) | m.Get("/downloadAll", repo.DownloadCloudBrainBoard) | ||||
m.Group("/cloudbrain", func() { | m.Group("/cloudbrain", func() { | ||||
m.Get("/overview", repo.GetAllCloudbrainsOverview) | m.Get("/overview", repo.GetAllCloudbrainsOverview) | ||||
m.Get("/overview_duration", repo.GetOverviewDuration) | |||||
m.Get("/distribution", repo.GetAllCloudbrainsPeriodDistribution) | m.Get("/distribution", repo.GetAllCloudbrainsPeriodDistribution) | ||||
m.Get("/trend", repo.GetAllCloudbrainsTrend) | m.Get("/trend", repo.GetAllCloudbrainsTrend) | ||||
m.Get("/trend_detail_data", repo.GetAllCloudbrainsTrendDetail) | m.Get("/trend_detail_data", repo.GetAllCloudbrainsTrendDetail) | ||||
@@ -577,7 +577,6 @@ func getLogFromModelDir(jobName string, startLine int, endLine int, resultPath s | |||||
r := bufio.NewReader(reader) | r := bufio.NewReader(reader) | ||||
for i := 0; i < endLine; i++ { | for i := 0; i < endLine; i++ { | ||||
line, error := r.ReadString('\n') | line, error := r.ReadString('\n') | ||||
log.Info("line=" + line) | |||||
if error == io.EOF { | if error == io.EOF { | ||||
log.Info("read file completed.") | log.Info("read file completed.") | ||||
break | break | ||||
@@ -19,6 +19,7 @@ type DateCloudbrainNum struct { | |||||
CloudOneJobTypeRes map[string]int `json:"cloudOneJobTypeRes"` | CloudOneJobTypeRes map[string]int `json:"cloudOneJobTypeRes"` | ||||
CloudTwoJobTypeRes map[string]int `json:"cloudTwoJobTypeRes"` | CloudTwoJobTypeRes map[string]int `json:"cloudTwoJobTypeRes"` | ||||
IntelligentNetJobTypeRes map[string]int `json:"intelligentNetJobTypeRes"` | IntelligentNetJobTypeRes map[string]int `json:"intelligentNetJobTypeRes"` | ||||
CDCenterJobTypeRes map[string]int `json:"cDCenterJobTypeRes"` | |||||
CloudBrainPeriodNum map[int]int `json:"cloudBrainPeriodNum"` | CloudBrainPeriodNum map[int]int `json:"cloudBrainPeriodNum"` | ||||
CloudBrainComputeResource map[string]int `json:"cloudBrainComputeResource"` | CloudBrainComputeResource map[string]int `json:"cloudBrainComputeResource"` | ||||
} | } | ||||
@@ -53,20 +54,90 @@ func GetAllCloudbrainsOverview(ctx *context.Context) { | |||||
log.Error("Can not query todayCreatorCount.", err) | log.Error("Can not query todayCreatorCount.", err) | ||||
return | return | ||||
} | } | ||||
cloudbrainTypeCount, err := models.GetCloudbrainTypeCount() | |||||
log.Info("cloudbrainTypeCount:", cloudbrainTypeCount) | |||||
if err != nil { | |||||
log.Error("Can not query cloudbrainTypeCount.", err) | |||||
return | |||||
} | |||||
cloudbrainTpyeDurationSum, err := models.GetCloudbrainTpyeDurationSum() | |||||
log.Info("cloudbrainTpyeDurationSum:", cloudbrainTpyeDurationSum) | |||||
if err != nil { | |||||
log.Error("Can not query cloudbrainTpyeDurationSum.", err) | |||||
return | |||||
} | |||||
todayCloudbrainCount, err := models.GetTodayCloudbrainCount(beginTime, endTime) | |||||
log.Info("todayCloudbrainCount:", todayCloudbrainCount) | |||||
if err != nil { | |||||
log.Error("Can not query todayCloudbrainCount.", err) | |||||
return | |||||
} | |||||
todayRunningCount, err := models.GetTodayRunningCount(beginTime, endTime) | |||||
log.Info("todayRunningCount:", todayRunningCount) | |||||
if err != nil { | |||||
log.Error("Can not query todayRunningCount.", err) | |||||
return | |||||
} | |||||
todayWaitingCount, err := models.GetTodayWaitingCount(beginTime, endTime) | |||||
log.Info("todayWaittingCount:", todayWaitingCount) | |||||
if err != nil { | |||||
log.Error("Can not query todayWaitingCount.", err) | |||||
return | |||||
} | |||||
todayCompletedCount := todayCloudbrainCount - todayRunningCount - todayWaitingCount | |||||
log.Info("todayCompletedCount:", todayCompletedCount) | |||||
creatorCount, err := models.GetCreatorCount() | creatorCount, err := models.GetCreatorCount() | ||||
if err != nil { | if err != nil { | ||||
log.Error("Can not query creatorCount.", err) | log.Error("Can not query creatorCount.", err) | ||||
return | return | ||||
} | } | ||||
todayStatusResult := make(map[string]int) | |||||
cloudBrainNum := make(map[int]int) | |||||
cloudBrainOneDuration := int64(0) | |||||
cloudBrainTwoDuration := int64(0) | |||||
intelligentNetDuration := int64(0) | |||||
todayNewJobCount := 0 | |||||
ctx.JSON(http.StatusOK, map[string]interface{}{ | |||||
"recordBeginTime": recordBeginTime, | |||||
"updateTime": now.Unix(), | |||||
"todayCreatorCount": todayCreatorCount, | |||||
"creatorCount": creatorCount, | |||||
"todayRunningCount": todayRunningCount, | |||||
"todayCompletedCount": todayCompletedCount, | |||||
"todayWaitingCount": todayWaitingCount, | |||||
"todayNewJobCount": todayCloudbrainCount, | |||||
"cloudbrainTypeCount": cloudbrainTypeCount, | |||||
}) | |||||
} | |||||
func GetOverviewDuration(ctx *context.Context) { | |||||
recordCloudbrain, err := models.GetRecordBeginTime() | |||||
if err != nil { | |||||
log.Error("Can not get recordCloudbrain", err) | |||||
ctx.Error(http.StatusBadRequest, ctx.Tr("repo.record_begintime_get_err")) | |||||
return | |||||
} | |||||
recordBeginTime := recordCloudbrain[0].Cloudbrain.CreatedUnix | |||||
now := time.Now() | |||||
endTime := now | |||||
page := 1 | page := 1 | ||||
pagesize := 1000 | |||||
pagesize := 10000 | |||||
count := pagesize | count := pagesize | ||||
worker_server_num := 1 | |||||
cardNum := 1 | |||||
durationAllSum := int64(0) | |||||
cardDuSum := int64(0) | |||||
cloudBrainOneCardDuSum := int64(0) | |||||
cloudBrainTwoCardDuSum := int64(0) | |||||
c2NetCardDuSum := int64(0) | |||||
cDNetCardDuSum := int64(0) | |||||
cloudBrainOneDuration := int64(0) | |||||
cloudBrainTwoDuration := int64(0) | |||||
c2NetDuration := int64(0) | |||||
cDCenterDuration := int64(0) | |||||
for count == pagesize && count != 0 { | for count == pagesize && count != 0 { | ||||
cloudbrains, _, err := models.CloudbrainAllStatic(&models.CloudbrainsOptions{ | cloudbrains, _, err := models.CloudbrainAllStatic(&models.CloudbrainsOptions{ | ||||
ListOptions: models.ListOptions{ | ListOptions: models.ListOptions{ | ||||
@@ -81,72 +152,53 @@ func GetAllCloudbrainsOverview(ctx *context.Context) { | |||||
ctx.ServerError("Get cloudbrains failed:", err) | ctx.ServerError("Get cloudbrains failed:", err) | ||||
return | return | ||||
} | } | ||||
models.LoadSpecs4CloudbrainInfo(cloudbrains) | |||||
for _, cloudbrain := range cloudbrains { | for _, cloudbrain := range cloudbrains { | ||||
if int64(cloudbrain.Cloudbrain.CreatedUnix) >= beginTime.Unix() && int64(cloudbrain.Cloudbrain.CreatedUnix) < endTime.Unix() { | |||||
todayNewJobCount += 1 | |||||
if _, ok := todayStatusResult[cloudbrain.Status]; !ok { | |||||
todayStatusResult[cloudbrain.Status] = 1 | |||||
} else { | |||||
todayStatusResult[cloudbrain.Status] += 1 | |||||
} | |||||
if cloudbrain.Cloudbrain.WorkServerNumber >= 1 { | |||||
worker_server_num = cloudbrain.Cloudbrain.WorkServerNumber | |||||
} else { | |||||
worker_server_num = 1 | |||||
} | } | ||||
if _, ok := cloudBrainNum[cloudbrain.Cloudbrain.Type]; !ok { | |||||
cloudBrainNum[cloudbrain.Cloudbrain.Type] = 1 | |||||
if cloudbrain.Cloudbrain.Spec == nil { | |||||
cardNum = 1 | |||||
} else { | } else { | ||||
cloudBrainNum[cloudbrain.Cloudbrain.Type] += 1 | |||||
cardNum = cloudbrain.Cloudbrain.Spec.AccCardsNum | |||||
} | } | ||||
duration := cloudbrain.Duration | |||||
durationSum := cloudbrain.Duration * int64(worker_server_num) * int64(cardNum) | |||||
if cloudbrain.Cloudbrain.Type == models.TypeCloudBrainOne { | if cloudbrain.Cloudbrain.Type == models.TypeCloudBrainOne { | ||||
cloudBrainOneDuration = cloudBrainOneDuration + cloudbrain.Cloudbrain.Duration | |||||
} | |||||
if cloudbrain.Cloudbrain.Type == models.TypeCloudBrainTwo { | |||||
cloudBrainTwoDuration = cloudBrainTwoDuration + cloudbrain.Cloudbrain.Duration | |||||
cloudBrainOneDuration += duration | |||||
cloudBrainOneCardDuSum += durationSum | |||||
} else if cloudbrain.Cloudbrain.Type == models.TypeCloudBrainTwo { | |||||
cloudBrainTwoDuration += duration | |||||
cloudBrainTwoCardDuSum += durationSum | |||||
} else if cloudbrain.Cloudbrain.Type == models.TypeC2Net { | |||||
c2NetDuration += duration | |||||
c2NetCardDuSum += durationSum | |||||
} else if cloudbrain.Cloudbrain.Type == models.TypeCDCenter { | |||||
cDCenterDuration += duration | |||||
cDNetCardDuSum += durationSum | |||||
} | } | ||||
if cloudbrain.Cloudbrain.Type == models.TypeC2Net { | |||||
intelligentNetDuration = intelligentNetDuration + cloudbrain.Cloudbrain.Duration | |||||
} | |||||
} | |||||
count = len(cloudbrains) | |||||
page += 1 | |||||
} | |||||
statusNameList := []string{string(models.ModelArtsTrainJobCompleted), string(models.JobFailed), string(models.ModelArtsTrainJobInit), | |||||
string(models.JobRunning), string(models.ModelArtsStartFailed), string(models.JobStopped), string(models.JobSucceeded), | |||||
string(models.JobWaiting), string(models.ModelArtsTrainJobKilled)} | |||||
for _, v := range statusNameList { | |||||
if _, ok := todayStatusResult[v]; !ok { | |||||
todayStatusResult[v] = 0 | |||||
} | |||||
} | |||||
cloudBrainTypeList := []int{0, 1, 2} | |||||
for _, v := range cloudBrainTypeList { | |||||
if _, ok := cloudBrainNum[v]; !ok { | |||||
cloudBrainNum[v] = 0 | |||||
durationAllSum += duration | |||||
cardDuSum += durationSum | |||||
count = len(cloudbrains) | |||||
page += 1 | |||||
} | } | ||||
} | } | ||||
todayRunningCount := todayStatusResult[string(models.JobRunning)] | |||||
todayCompletedCount := todayStatusResult[string(models.ModelArtsTrainJobCompleted)] + todayStatusResult[string(models.JobFailed)] + | |||||
todayStatusResult[string(models.ModelArtsStartFailed)] + todayStatusResult[string(models.JobStopped)] + todayStatusResult[string(models.JobSucceeded)] + todayStatusResult[string(models.ModelArtsTrainJobKilled)] | |||||
todayWaitingCount := todayStatusResult[string(models.ModelArtsTrainJobInit)] + todayStatusResult[string(models.JobWaiting)] | |||||
ctx.JSON(http.StatusOK, map[string]interface{}{ | ctx.JSON(http.StatusOK, map[string]interface{}{ | ||||
"recordBeginTime": recordBeginTime, | |||||
"updateTime": now.Unix(), | |||||
"cloudBrainNum": cloudBrainNum, | |||||
"cloudBrainOneDuration": cloudBrainOneDuration, | |||||
"cloudBrainTwoDuration": cloudBrainTwoDuration, | |||||
"intelligentNetDuration": intelligentNetDuration, | |||||
"todayCreatorCount": todayCreatorCount, | |||||
"creatorCount": creatorCount, | |||||
"todayRunningCount": todayRunningCount, | |||||
"todayCompletedCount": todayCompletedCount, | |||||
"todayWaitingCount": todayWaitingCount, | |||||
"todayNewJobCount": todayNewJobCount, | |||||
"cloudBrainOneCardDuSum": cloudBrainOneCardDuSum, | |||||
"cloudBrainTwoCardDuSum": cloudBrainTwoCardDuSum, | |||||
"c2NetCardDuSum": c2NetCardDuSum, | |||||
"cDNetCardDuSum": cDNetCardDuSum, | |||||
"cardDuSum": cardDuSum, | |||||
"cloudBrainOneDuration": cloudBrainOneDuration, | |||||
"cloudBrainTwoDuration": cloudBrainTwoDuration, | |||||
"c2NetDuration": c2NetDuration, | |||||
"cDCenterDuration": cDCenterDuration, | |||||
"durationSum": durationAllSum, | |||||
}) | }) | ||||
} | } | ||||
@@ -500,6 +552,7 @@ func GetAllCloudbrainsPeriodDistribution(ctx *context.Context) { | |||||
cloudOneJobTypeRes := make(map[string]int) | cloudOneJobTypeRes := make(map[string]int) | ||||
cloudTwoJobTypeRes := make(map[string]int) | cloudTwoJobTypeRes := make(map[string]int) | ||||
intelligentNetJobTypeRes := make(map[string]int) | intelligentNetJobTypeRes := make(map[string]int) | ||||
cDCenterJobTypeRes := make(map[string]int) | |||||
cloudBrainPeriodNum := make(map[int]int) | cloudBrainPeriodNum := make(map[int]int) | ||||
cloudBrainComputeResource := make(map[string]int) | cloudBrainComputeResource := make(map[string]int) | ||||
beginTimeTemp := beginTime.Unix() | beginTimeTemp := beginTime.Unix() | ||||
@@ -508,9 +561,9 @@ func GetAllCloudbrainsPeriodDistribution(ctx *context.Context) { | |||||
} | } | ||||
page := 1 | page := 1 | ||||
pagesize := 1000 | |||||
pagesize := 10000 | |||||
count := pagesize | count := pagesize | ||||
//Each time a maximum of 1000 pieces of data are detected to the memory, batch processing | |||||
//Each time a maximum of 10000 pieces of data are detected to the memory, batch processing | |||||
for count == pagesize && count != 0 { | for count == pagesize && count != 0 { | ||||
cloudbrains, _, err := models.CloudbrainAllStatic(&models.CloudbrainsOptions{ | cloudbrains, _, err := models.CloudbrainAllStatic(&models.CloudbrainsOptions{ | ||||
ListOptions: models.ListOptions{ | ListOptions: models.ListOptions{ | ||||
@@ -548,6 +601,13 @@ func GetAllCloudbrainsPeriodDistribution(ctx *context.Context) { | |||||
intelligentNetJobTypeRes[cloudbrain.JobType] += 1 | intelligentNetJobTypeRes[cloudbrain.JobType] += 1 | ||||
} | } | ||||
} | } | ||||
if cloudbrain.Cloudbrain.Type == models.TypeCDCenter { | |||||
if _, ok := cDCenterJobTypeRes[cloudbrain.JobType]; !ok { | |||||
cDCenterJobTypeRes[cloudbrain.JobType] = 1 | |||||
} else { | |||||
cDCenterJobTypeRes[cloudbrain.JobType] += 1 | |||||
} | |||||
} | |||||
if _, ok := cloudBrainPeriodNum[cloudbrain.Cloudbrain.Type]; !ok { | if _, ok := cloudBrainPeriodNum[cloudbrain.Cloudbrain.Type]; !ok { | ||||
cloudBrainPeriodNum[cloudbrain.Cloudbrain.Type] = 1 | cloudBrainPeriodNum[cloudbrain.Cloudbrain.Type] = 1 | ||||
@@ -577,8 +637,11 @@ func GetAllCloudbrainsPeriodDistribution(ctx *context.Context) { | |||||
if _, ok := intelligentNetJobTypeRes[v]; !ok { | if _, ok := intelligentNetJobTypeRes[v]; !ok { | ||||
intelligentNetJobTypeRes[v] = 0 | intelligentNetJobTypeRes[v] = 0 | ||||
} | } | ||||
if _, ok := cDCenterJobTypeRes[v]; !ok { | |||||
cDCenterJobTypeRes[v] = 0 | |||||
} | |||||
} | } | ||||
cloudBrainTypeList := []int{0, 1, 2} | |||||
cloudBrainTypeList := []int{0, 1, 2, 3} | |||||
for _, v := range cloudBrainTypeList { | for _, v := range cloudBrainTypeList { | ||||
if _, ok := cloudBrainPeriodNum[v]; !ok { | if _, ok := cloudBrainPeriodNum[v]; !ok { | ||||
cloudBrainPeriodNum[v] = 0 | cloudBrainPeriodNum[v] = 0 | ||||
@@ -592,77 +655,30 @@ func GetAllCloudbrainsPeriodDistribution(ctx *context.Context) { | |||||
} | } | ||||
} | } | ||||
cloudOneJobTypeRes["EVALUATION"] = cloudOneJobTypeRes[string(models.JobTypeBenchmark)] + cloudOneJobTypeRes[string(models.JobTypeSnn4imagenet)] + cloudOneJobTypeRes[string(models.JobTypeBrainScore)] | |||||
cloudTwoJobTypeRes["EVALUATION"] = cloudTwoJobTypeRes[string(models.JobTypeBenchmark)] + cloudTwoJobTypeRes[string(models.JobTypeSnn4imagenet)] + cloudTwoJobTypeRes[string(models.JobTypeBrainScore)] | |||||
intelligentNetJobTypeRes["EVALUATION"] = intelligentNetJobTypeRes[string(models.JobTypeBenchmark)] + intelligentNetJobTypeRes[string(models.JobTypeSnn4imagenet)] + intelligentNetJobTypeRes[string(models.JobTypeBrainScore)] | |||||
cloudOneJobTypeRes["EVALUATION"] = cloudBrainPeriodNum[0] - cloudOneJobTypeRes[string(models.JobTypeTrain)] - cloudOneJobTypeRes[string(models.JobTypeInference)] - cloudOneJobTypeRes[string(models.JobTypeDebug)] | |||||
cloudTwoJobTypeRes["EVALUATION"] = cloudBrainPeriodNum[1] - cloudTwoJobTypeRes[string(models.JobTypeTrain)] - cloudTwoJobTypeRes[string(models.JobTypeInference)] - cloudTwoJobTypeRes[string(models.JobTypeDebug)] | |||||
intelligentNetJobTypeRes["EVALUATION"] = cloudBrainPeriodNum[2] - intelligentNetJobTypeRes[string(models.JobTypeTrain)] - intelligentNetJobTypeRes[string(models.JobTypeInference)] - intelligentNetJobTypeRes[string(models.JobTypeDebug)] | |||||
cDCenterJobTypeRes["EVALUATION"] = cloudBrainPeriodNum[3] - cDCenterJobTypeRes[string(models.JobTypeTrain)] - cDCenterJobTypeRes[string(models.JobTypeInference)] - cDCenterJobTypeRes[string(models.JobTypeDebug)] | |||||
ctx.JSON(http.StatusOK, map[string]interface{}{ | ctx.JSON(http.StatusOK, map[string]interface{}{ | ||||
"cloudOneJobTypeRes": cloudOneJobTypeRes, | "cloudOneJobTypeRes": cloudOneJobTypeRes, | ||||
"cloudTwoJobTypeRes": cloudTwoJobTypeRes, | "cloudTwoJobTypeRes": cloudTwoJobTypeRes, | ||||
"intelligentNetJobTypeRes": intelligentNetJobTypeRes, | "intelligentNetJobTypeRes": intelligentNetJobTypeRes, | ||||
"cDCenterJobTypeRes": cDCenterJobTypeRes, | |||||
"cloudBrainPeriodNum": cloudBrainPeriodNum, | "cloudBrainPeriodNum": cloudBrainPeriodNum, | ||||
"cloudBrainComputeResource": cloudBrainComputeResource, | "cloudBrainComputeResource": cloudBrainComputeResource, | ||||
}) | }) | ||||
} | } | ||||
func GetCloudbrainsStatusAnalysis(ctx *context.Context) { | func GetCloudbrainsStatusAnalysis(ctx *context.Context) { | ||||
recordCloudbrain, err := models.GetRecordBeginTime() | |||||
cloudbrainStatusCount, err := models.GetCloudbrainStatusCount() | |||||
log.Info("cloudbrainStatusCount:", cloudbrainStatusCount) | |||||
if err != nil { | if err != nil { | ||||
log.Error("Can not get recordCloudbrain", err) | |||||
ctx.Error(http.StatusBadRequest, ctx.Tr("repo.record_begintime_get_err")) | |||||
log.Error("Can not query cloudbrainStatusCount.", err) | |||||
return | return | ||||
} | } | ||||
recordBeginTime := recordCloudbrain[0].Cloudbrain.CreatedUnix | |||||
endTime := time.Now() | |||||
cloudBrainStatusResult := make(map[string]int) | |||||
cloudBrainStatusAnalysis := make(map[string]int) | |||||
totalCount := 0 | |||||
page := 1 | |||||
pagesize := 1000 | |||||
count := pagesize | |||||
for count == pagesize && count != 0 { | |||||
cloudbrains, _, err := models.CloudbrainAllStatic(&models.CloudbrainsOptions{ | |||||
ListOptions: models.ListOptions{ | |||||
Page: page, | |||||
PageSize: pagesize, | |||||
}, | |||||
Type: models.TypeCloudBrainAll, | |||||
BeginTimeUnix: int64(recordBeginTime), | |||||
EndTimeUnix: endTime.Unix(), | |||||
}) | |||||
if err != nil { | |||||
ctx.ServerError("Get cloudbrains failed:", err) | |||||
return | |||||
} | |||||
for _, cloudbrain := range cloudbrains { | |||||
if _, ok := cloudBrainStatusResult[cloudbrain.Status]; !ok { | |||||
cloudBrainStatusResult[cloudbrain.Status] = 1 | |||||
} else { | |||||
cloudBrainStatusResult[cloudbrain.Status] += 1 | |||||
} | |||||
} | |||||
count = len(cloudbrains) | |||||
totalCount = totalCount + count | |||||
page += 1 | |||||
} | |||||
var jobStatuses []string | |||||
jobStatuses = append(jobStatuses, string(models.ModelArtsTrainJobWaiting), string(models.ModelArtsTrainJobFailed), string(models.ModelArtsRunning), string(models.ModelArtsTrainJobCompleted), | |||||
string(models.ModelArtsStarting), string(models.ModelArtsRestarting), string(models.ModelArtsStartFailed), | |||||
string(models.ModelArtsStopping), string(models.ModelArtsStopped), string(models.JobSucceeded)) | |||||
jobStatusesCount := 0 | |||||
for _, v := range jobStatuses { | |||||
if _, ok := cloudBrainStatusResult[v]; !ok { | |||||
cloudBrainStatusAnalysis[v] = 0 | |||||
} else { | |||||
cloudBrainStatusAnalysis[v] = cloudBrainStatusResult[v] | |||||
} | |||||
jobStatusesCount = jobStatusesCount + cloudBrainStatusResult[v] | |||||
} | |||||
cloudBrainStatusAnalysis["OTHER"] = totalCount - jobStatusesCount | |||||
ctx.JSON(http.StatusOK, map[string]interface{}{ | ctx.JSON(http.StatusOK, map[string]interface{}{ | ||||
"cloudBrainStatusResult": cloudBrainStatusAnalysis, | |||||
"cloudbrainStatusCount": cloudbrainStatusCount, | |||||
}) | }) | ||||
} | } | ||||
@@ -738,7 +754,6 @@ func GetCloudbrainsDetailData(ctx *context.Context) { | |||||
tasks := []models.TaskDetail{} | tasks := []models.TaskDetail{} | ||||
for i, task := range ciTasks { | for i, task := range ciTasks { | ||||
ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource | ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource | ||||
var taskDetail models.TaskDetail | var taskDetail models.TaskDetail | ||||
taskDetail.ID = ciTasks[i].Cloudbrain.ID | taskDetail.ID = ciTasks[i].Cloudbrain.ID | ||||
taskDetail.JobID = ciTasks[i].Cloudbrain.JobID | taskDetail.JobID = ciTasks[i].Cloudbrain.JobID | ||||
@@ -758,11 +773,12 @@ func GetCloudbrainsDetailData(ctx *context.Context) { | |||||
taskDetail.RepoName = ciTasks[i].Repo.OwnerName + "/" + ciTasks[i].Repo.Name | taskDetail.RepoName = ciTasks[i].Repo.OwnerName + "/" + ciTasks[i].Repo.Name | ||||
taskDetail.RepoAlias = ciTasks[i].Repo.OwnerName + "/" + ciTasks[i].Repo.Alias | taskDetail.RepoAlias = ciTasks[i].Repo.OwnerName + "/" + ciTasks[i].Repo.Alias | ||||
} | } | ||||
taskDetail.CardNum, taskDetail.CardType, _ = repo.GetCloudbrainCardNumAndType(ciTasks[i].Cloudbrain) | |||||
if ciTasks[i].Cloudbrain.WorkServerNumber >= 1 { | |||||
taskDetail.WorkServerNum = int64(ciTasks[i].Cloudbrain.WorkServerNumber) | |||||
} else { | |||||
taskDetail.WorkServerNum = 1 | |||||
} | |||||
taskDetail.CardDuration = repo.GetCloudbrainCardDuration(ciTasks[i].Cloudbrain) | taskDetail.CardDuration = repo.GetCloudbrainCardDuration(ciTasks[i].Cloudbrain) | ||||
taskDetail.AiCenter = repo.GetCloudbrainAiCenter(ciTasks[i].Cloudbrain, ctx) | |||||
taskDetail.FlavorName, _ = repo.GetCloudbrainFlavorName(ciTasks[i].Cloudbrain) | |||||
taskDetail.WaitTime = repo.GetCloudbrainWaitTime(ciTasks[i].Cloudbrain) | taskDetail.WaitTime = repo.GetCloudbrainWaitTime(ciTasks[i].Cloudbrain) | ||||
if ciTasks[i].Cloudbrain.DeletedAt != nilTime || ciTasks[i].Repo == nil { | if ciTasks[i].Cloudbrain.DeletedAt != nilTime || ciTasks[i].Repo == nil { | ||||
@@ -787,17 +803,6 @@ func GetCloudbrainsDetailData(ctx *context.Context) { | |||||
}) | }) | ||||
} | } | ||||
func getCloudbrainAiCenter(task models.Cloudbrain, ctx *context.Context) string { | |||||
if task.Type == models.TypeCloudBrainOne { | |||||
return ctx.Tr("repo.cloudbrain1") | |||||
} else if task.Type == models.TypeCloudBrainTwo { | |||||
return ctx.Tr("repo.cloudbrain2") | |||||
} else if task.Type == models.TypeC2Net { | |||||
return task.AiCenter | |||||
} | |||||
return "" | |||||
} | |||||
func GetCloudbrainsCreateHoursData(ctx *context.Context) { | func GetCloudbrainsCreateHoursData(ctx *context.Context) { | ||||
recordCloudbrain, err := models.GetRecordBeginTime() | recordCloudbrain, err := models.GetRecordBeginTime() | ||||
if err != nil { | if err != nil { | ||||
@@ -958,11 +963,12 @@ func GetRunningTop(ctx *context.Context) { | |||||
}) | }) | ||||
} | } | ||||
func getCloudbrainCount(beginTime time.Time, endTime time.Time, cloudbrains []*models.CloudbrainInfo) (map[string]int, map[string]int, map[string]int, map[int]int, map[string]int) { | |||||
func getCloudbrainCount(beginTime time.Time, endTime time.Time, cloudbrains []*models.CloudbrainInfo) (map[string]int, map[string]int, map[string]int, map[string]int, map[int]int, map[string]int) { | |||||
cloudOneJobTypeRes := make(map[string]int) | cloudOneJobTypeRes := make(map[string]int) | ||||
cloudTwoJobTypeRes := make(map[string]int) | cloudTwoJobTypeRes := make(map[string]int) | ||||
intelligentNetJobTypeRes := make(map[string]int) | intelligentNetJobTypeRes := make(map[string]int) | ||||
cDCenterJobTypeRes := make(map[string]int) | |||||
cloudBrainPeriodNum := make(map[int]int) | cloudBrainPeriodNum := make(map[int]int) | ||||
cloudBrainComputeResource := make(map[string]int) | cloudBrainComputeResource := make(map[string]int) | ||||
for _, cloudbrain := range cloudbrains { | for _, cloudbrain := range cloudbrains { | ||||
@@ -1005,7 +1011,7 @@ func getCloudbrainCount(beginTime time.Time, endTime time.Time, cloudbrains []*m | |||||
} | } | ||||
jobTypeList := []string{"DEBUG", "BENCHMARK", "INFERENCE", "TRAIN", "SNN4IMAGENET", "BRAINSCORE"} | jobTypeList := []string{"DEBUG", "BENCHMARK", "INFERENCE", "TRAIN", "SNN4IMAGENET", "BRAINSCORE"} | ||||
cloudBrainTypeList := []int{0, 1, 2} | |||||
cloudBrainTypeList := []int{0, 1, 2, 3} | |||||
for _, v := range jobTypeList { | for _, v := range jobTypeList { | ||||
if _, ok := cloudOneJobTypeRes[v]; !ok { | if _, ok := cloudOneJobTypeRes[v]; !ok { | ||||
cloudOneJobTypeRes[v] = 0 | cloudOneJobTypeRes[v] = 0 | ||||
@@ -1016,14 +1022,17 @@ func getCloudbrainCount(beginTime time.Time, endTime time.Time, cloudbrains []*m | |||||
if _, ok := intelligentNetJobTypeRes[v]; !ok { | if _, ok := intelligentNetJobTypeRes[v]; !ok { | ||||
intelligentNetJobTypeRes[v] = 0 | intelligentNetJobTypeRes[v] = 0 | ||||
} | } | ||||
if _, ok := cDCenterJobTypeRes[v]; !ok { | |||||
cDCenterJobTypeRes[v] = 0 | |||||
} | |||||
} | } | ||||
for _, v := range cloudBrainTypeList { | for _, v := range cloudBrainTypeList { | ||||
if _, ok := cloudBrainPeriodNum[v]; !ok { | if _, ok := cloudBrainPeriodNum[v]; !ok { | ||||
cloudBrainPeriodNum[v] = 0 | cloudBrainPeriodNum[v] = 0 | ||||
} | } | ||||
} | } | ||||
cloudBrainPeriodNum[-1] = cloudBrainPeriodNum[0] + cloudBrainPeriodNum[1] + cloudBrainPeriodNum[2] | |||||
return cloudOneJobTypeRes, cloudTwoJobTypeRes, intelligentNetJobTypeRes, cloudBrainPeriodNum, cloudBrainComputeResource | |||||
cloudBrainPeriodNum[-1] = cloudBrainPeriodNum[0] + cloudBrainPeriodNum[1] + cloudBrainPeriodNum[2] + cloudBrainPeriodNum[3] | |||||
return cloudOneJobTypeRes, cloudTwoJobTypeRes, intelligentNetJobTypeRes, cDCenterJobTypeRes, cloudBrainPeriodNum, cloudBrainComputeResource | |||||
} | } | ||||
func getDayCloudbrainNum(beginTime time.Time, endTime time.Time) ([]DateCloudbrainNum, error) { | func getDayCloudbrainNum(beginTime time.Time, endTime time.Time) ([]DateCloudbrainNum, error) { | ||||
@@ -1040,12 +1049,13 @@ func getDayCloudbrainNum(beginTime time.Time, endTime time.Time) ([]DateCloudbra | |||||
} | } | ||||
dayCloudbrainNum := make([]DateCloudbrainNum, 0) | dayCloudbrainNum := make([]DateCloudbrainNum, 0) | ||||
for endTimeTemp.Before(endTime) || endTimeTemp.Equal(endTime) { | for endTimeTemp.Before(endTime) || endTimeTemp.Equal(endTime) { | ||||
cloudOneJobTypeRes, cloudTwoJobTypeRes, intelligentNetJobTypeRes, cloudBrainPeriodNum, cloudBrainComputeResource := getCloudbrainCount(beginTime, endTimeTemp, cloudbrains) | |||||
cloudOneJobTypeRes, cloudTwoJobTypeRes, intelligentNetJobTypeRes, cDCenterJobTypeRes, cloudBrainPeriodNum, cloudBrainComputeResource := getCloudbrainCount(beginTime, endTimeTemp, cloudbrains) | |||||
dayCloudbrainNum = append(dayCloudbrainNum, DateCloudbrainNum{ | dayCloudbrainNum = append(dayCloudbrainNum, DateCloudbrainNum{ | ||||
Date: beginTime.Format("2006/01/02"), | Date: beginTime.Format("2006/01/02"), | ||||
CloudOneJobTypeRes: cloudOneJobTypeRes, | CloudOneJobTypeRes: cloudOneJobTypeRes, | ||||
CloudTwoJobTypeRes: cloudTwoJobTypeRes, | CloudTwoJobTypeRes: cloudTwoJobTypeRes, | ||||
IntelligentNetJobTypeRes: intelligentNetJobTypeRes, | IntelligentNetJobTypeRes: intelligentNetJobTypeRes, | ||||
CDCenterJobTypeRes: cDCenterJobTypeRes, | |||||
CloudBrainPeriodNum: cloudBrainPeriodNum, | CloudBrainPeriodNum: cloudBrainPeriodNum, | ||||
CloudBrainComputeResource: cloudBrainComputeResource, | CloudBrainComputeResource: cloudBrainComputeResource, | ||||
}) | }) | ||||
@@ -1075,12 +1085,13 @@ func getMonthCloudbrainNum(beginTime time.Time, endTime time.Time) ([]DateCloudb | |||||
return nil, err | return nil, err | ||||
} | } | ||||
for endTimeTemp.Before(endTime) || endTimeTemp.Equal(endTime) { | for endTimeTemp.Before(endTime) || endTimeTemp.Equal(endTime) { | ||||
cloudOneJobTypeRes, cloudTwoJobTypeRes, intelligentNetJobTypeRes, cloudBrainPeriodNum, cloudBrainComputeResource := getCloudbrainCount(beginTime, endTimeTemp, cloudbrains) | |||||
cloudOneJobTypeRes, cloudTwoJobTypeRes, intelligentNetJobTypeRes, cDCenterJobTypeRes, cloudBrainPeriodNum, cloudBrainComputeResource := getCloudbrainCount(beginTime, endTimeTemp, cloudbrains) | |||||
monthCloudbrainNum = append(monthCloudbrainNum, DateCloudbrainNum{ | monthCloudbrainNum = append(monthCloudbrainNum, DateCloudbrainNum{ | ||||
Date: beginTime.Format("2006/01"), | Date: beginTime.Format("2006/01"), | ||||
CloudOneJobTypeRes: cloudOneJobTypeRes, | CloudOneJobTypeRes: cloudOneJobTypeRes, | ||||
CloudTwoJobTypeRes: cloudTwoJobTypeRes, | CloudTwoJobTypeRes: cloudTwoJobTypeRes, | ||||
IntelligentNetJobTypeRes: intelligentNetJobTypeRes, | IntelligentNetJobTypeRes: intelligentNetJobTypeRes, | ||||
CDCenterJobTypeRes: cDCenterJobTypeRes, | |||||
CloudBrainPeriodNum: cloudBrainPeriodNum, | CloudBrainPeriodNum: cloudBrainPeriodNum, | ||||
CloudBrainComputeResource: cloudBrainComputeResource, | CloudBrainComputeResource: cloudBrainComputeResource, | ||||
}) | }) | ||||
@@ -1113,7 +1124,7 @@ func getDayCloudbrainInfo(beginTime time.Time, endTime time.Time) ([]DateCloudbr | |||||
dayCloudbrainInfo := make([]DateCloudbrainInfo, 0) | dayCloudbrainInfo := make([]DateCloudbrainInfo, 0) | ||||
count := 0 | count := 0 | ||||
for beginTime.Before(endTimeTemp) || beginTime.Equal(endTimeTemp) { | for beginTime.Before(endTimeTemp) || beginTime.Equal(endTimeTemp) { | ||||
_, _, _, cloudBrainPeriodNum, cloudBrainComputeResource := getCloudbrainCount(endTimeTemp, endTime, cloudbrains) | |||||
_, _, _, _, cloudBrainPeriodNum, cloudBrainComputeResource := getCloudbrainCount(endTimeTemp, endTime, cloudbrains) | |||||
dayCloudbrainInfo = append(dayCloudbrainInfo, DateCloudbrainInfo{ | dayCloudbrainInfo = append(dayCloudbrainInfo, DateCloudbrainInfo{ | ||||
Date: endTimeTemp.Format("2006/01/02"), | Date: endTimeTemp.Format("2006/01/02"), | ||||
CloudBrainPeriodNum: cloudBrainPeriodNum, | CloudBrainPeriodNum: cloudBrainPeriodNum, | ||||
@@ -1144,7 +1155,7 @@ func getMonthCloudbrainInfo(beginTime time.Time, endTime time.Time) ([]DateCloud | |||||
dayCloudbrainInfo := make([]DateCloudbrainInfo, 0) | dayCloudbrainInfo := make([]DateCloudbrainInfo, 0) | ||||
count := 0 | count := 0 | ||||
for beginTime.Before(endTimeTemp) || beginTime.Equal(endTimeTemp) || (endTimeTemp.Before(beginTime) && beginTime.Before(endTime)) { | for beginTime.Before(endTimeTemp) || beginTime.Equal(endTimeTemp) || (endTimeTemp.Before(beginTime) && beginTime.Before(endTime)) { | ||||
_, _, _, cloudBrainPeriodNum, cloudBrainComputeResource := getCloudbrainCount(endTimeTemp, endTime, cloudbrains) | |||||
_, _, _, _, cloudBrainPeriodNum, cloudBrainComputeResource := getCloudbrainCount(endTimeTemp, endTime, cloudbrains) | |||||
dayCloudbrainInfo = append(dayCloudbrainInfo, DateCloudbrainInfo{ | dayCloudbrainInfo = append(dayCloudbrainInfo, DateCloudbrainInfo{ | ||||
Date: endTimeTemp.Format("2006/01"), | Date: endTimeTemp.Format("2006/01"), | ||||
CloudBrainPeriodNum: cloudBrainPeriodNum, | CloudBrainPeriodNum: cloudBrainPeriodNum, | ||||
@@ -1205,6 +1216,7 @@ func DownloadCloudBrainBoard(ctx *context.Context) { | |||||
log.Warn("Can not get cloud brain info", err) | log.Warn("Can not get cloud brain info", err) | ||||
continue | continue | ||||
} | } | ||||
models.LoadSpecs4CloudbrainInfo(pageRecords) | |||||
for _, record := range pageRecords { | for _, record := range pageRecords { | ||||
for k, v := range allCloudbrainValues(row, record, ctx) { | for k, v := range allCloudbrainValues(row, record, ctx) { | ||||
@@ -1235,10 +1247,9 @@ func allCloudbrainHeader(ctx *context.Context) map[string]string { | |||||
"H1": ctx.Tr("cloudbrain.card_duration"), | "H1": ctx.Tr("cloudbrain.card_duration"), | ||||
"I1": ctx.Tr("repo.modelarts.train_job.start_time"), "J1": ctx.Tr("repo.modelarts.train_job.end_time"), | "I1": ctx.Tr("repo.modelarts.train_job.start_time"), "J1": ctx.Tr("repo.modelarts.train_job.end_time"), | ||||
"K1": ctx.Tr("repo.modelarts.computing_resources"), "L1": ctx.Tr("cloudbrain.card_type"), | "K1": ctx.Tr("repo.modelarts.computing_resources"), "L1": ctx.Tr("cloudbrain.card_type"), | ||||
"M1": ctx.Tr("repo.grampus.train_job.ai_center"), "N1": ctx.Tr("cloudbrain.resource_specification"), | |||||
"O1": ctx.Tr("repo.cloudbrain_creator"), "P1": ctx.Tr("repo.repo_name"), "Q1": ctx.Tr("repo.cloudbrain_task_name"), | |||||
"R1": ctx.Tr("repo.modelarts.deletetime")} | |||||
"M1": ctx.Tr("repo.modelarts.train_job.amount_of_compute_node"), "N1": ctx.Tr("repo.grampus.train_job.ai_center"), | |||||
"O1": ctx.Tr("cloudbrain.resource_specification"), "P1": ctx.Tr("repo.cloudbrain_creator"), "Q1": ctx.Tr("repo.repo_name"), | |||||
"R1": ctx.Tr("repo.cloudbrain_task_name"), "S1": ctx.Tr("repo.modelarts.deletetime")} | |||||
} | } | ||||
func allCloudbrainValues(row int, rs *models.CloudbrainInfo, ctx *context.Context) map[string]string { | func allCloudbrainValues(row int, rs *models.CloudbrainInfo, ctx *context.Context) map[string]string { | ||||
return map[string]string{getCellName("A", row): rs.DisplayJobName, getCellName("B", row): getCloudbrainType(rs, ctx), getCellName("C", row): rs.Status, getCellName("D", row): rs.JobType, | return map[string]string{getCellName("A", row): rs.DisplayJobName, getCellName("B", row): getCloudbrainType(rs, ctx), getCellName("C", row): rs.Status, getCellName("D", row): rs.JobType, | ||||
@@ -1246,9 +1257,16 @@ func allCloudbrainValues(row int, rs *models.CloudbrainInfo, ctx *context.Contex | |||||
getCellName("G", row): rs.TrainJobDuration, getCellName("H", row): repo.GetCloudbrainCardDuration(rs.Cloudbrain), | getCellName("G", row): rs.TrainJobDuration, getCellName("H", row): repo.GetCloudbrainCardDuration(rs.Cloudbrain), | ||||
getCellName("I", row): getBrainStartTime(rs), | getCellName("I", row): getBrainStartTime(rs), | ||||
getCellName("J", row): getBrainEndTime(rs), getCellName("K", row): rs.ComputeResource, getCellName("L", row): getCloudbrainCardType(rs), | getCellName("J", row): getBrainEndTime(rs), getCellName("K", row): rs.ComputeResource, getCellName("L", row): getCloudbrainCardType(rs), | ||||
getCellName("M", row): repo.GetCloudbrainAiCenter(rs.Cloudbrain, ctx), getCellName("N", row): getCloudbrainFlavorName(rs), | |||||
getCellName("O", row): rs.Name, getCellName("P", row): getBrainRepo(rs), | |||||
getCellName("Q", row): rs.JobName, getCellName("R", row): getBrainDeleteTime(rs), | |||||
getCellName("M", row): getWorkServerNum(rs), getCellName("N", row): repo.GetCloudbrainAiCenter(rs.Cloudbrain, ctx), | |||||
getCellName("O", row): getCloudbrainFlavorName(rs), getCellName("P", row): rs.Name, | |||||
getCellName("Q", row): getBrainRepo(rs), getCellName("R", row): rs.JobName, getCellName("S", row): getBrainDeleteTime(rs), | |||||
} | |||||
} | |||||
func getWorkServerNum(rs *models.CloudbrainInfo) string { | |||||
if rs.Cloudbrain.WorkServerNumber >= 1 { | |||||
return fmt.Sprint(rs.Cloudbrain.WorkServerNumber) | |||||
} else { | |||||
return "1" | |||||
} | } | ||||
} | } | ||||
func getBrainRepo(rs *models.CloudbrainInfo) string { | func getBrainRepo(rs *models.CloudbrainInfo) string { | ||||
@@ -1287,11 +1305,14 @@ func getCloudbrainType(rs *models.CloudbrainInfo, ctx *context.Context) string { | |||||
} | } | ||||
} | } | ||||
func getCloudbrainCardType(rs *models.CloudbrainInfo) string { | func getCloudbrainCardType(rs *models.CloudbrainInfo) string { | ||||
_, cardType, _ := repo.GetCloudbrainCardNumAndType(rs.Cloudbrain) | |||||
return cardType | |||||
if rs.Cloudbrain.Spec != nil { | |||||
return rs.Cloudbrain.Spec.AccCardType | |||||
} else { | |||||
return "" | |||||
} | |||||
} | } | ||||
func getCloudbrainFlavorName(rs *models.CloudbrainInfo) string { | func getCloudbrainFlavorName(rs *models.CloudbrainInfo) string { | ||||
flavorName, _ := repo.GetCloudbrainFlavorName(rs.Cloudbrain) | |||||
flavorName := repo.GetCloudbrainFlavorName(rs.Cloudbrain) | |||||
return flavorName | return flavorName | ||||
} | } | ||||
@@ -7,6 +7,7 @@ package repo | |||||
import ( | import ( | ||||
"fmt" | "fmt" | ||||
"html/template" | |||||
"net/http" | "net/http" | ||||
"code.gitea.io/gitea/models" | "code.gitea.io/gitea/models" | ||||
@@ -118,7 +119,7 @@ func CreateFork(ctx *context.APIContext, form api.CreateForkOption) { | |||||
forker = org | forker = org | ||||
} | } | ||||
fork, err := repo_service.ForkRepository(ctx.User, forker, repo, repo.Name, repo.Description, repo.Alias) | |||||
fork, err := repo_service.ForkRepository(ctx.User, forker, repo, repo.Name, template.HTMLEscapeString(repo.Description), repo.Alias) | |||||
if err != nil { | if err != nil { | ||||
ctx.Error(http.StatusInternalServerError, "ForkRepository", err) | ctx.Error(http.StatusInternalServerError, "ForkRepository", err) | ||||
return | return | ||||
@@ -8,6 +8,7 @@ import ( | |||||
"net/http" | "net/http" | ||||
"net/url" | "net/url" | ||||
"path" | "path" | ||||
"regexp" | |||||
"strings" | "strings" | ||||
"code.gitea.io/gitea/models" | "code.gitea.io/gitea/models" | ||||
@@ -85,6 +86,7 @@ func saveModelByParameters(jobId string, versionName string, name string, versio | |||||
accuracy["Precision"] = "" | accuracy["Precision"] = "" | ||||
accuracyJson, _ := json.Marshal(accuracy) | accuracyJson, _ := json.Marshal(accuracy) | ||||
log.Info("accuracyJson=" + string(accuracyJson)) | log.Info("accuracyJson=" + string(accuracyJson)) | ||||
aiTask.ContainerIp = "" | |||||
aiTaskJson, _ := json.Marshal(aiTask) | aiTaskJson, _ := json.Marshal(aiTask) | ||||
model := &models.AiModelManage{ | model := &models.AiModelManage{ | ||||
@@ -635,6 +637,7 @@ func ShowSingleModel(ctx *context.Context) { | |||||
userNameMap := queryUserName(userIds) | userNameMap := queryUserName(userIds) | ||||
for _, model := range models { | for _, model := range models { | ||||
removeIpInfo(model) | |||||
value := userNameMap[model.UserId] | value := userNameMap[model.UserId] | ||||
if value != nil { | if value != nil { | ||||
model.UserName = value.Name | model.UserName = value.Name | ||||
@@ -644,6 +647,13 @@ func ShowSingleModel(ctx *context.Context) { | |||||
ctx.JSON(http.StatusOK, models) | ctx.JSON(http.StatusOK, models) | ||||
} | } | ||||
func removeIpInfo(model *models.AiModelManage) { | |||||
reg, _ := regexp.Compile(`[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}`) | |||||
taskInfo := model.TrainTaskInfo | |||||
taskInfo = reg.ReplaceAllString(taskInfo, "") | |||||
model.TrainTaskInfo = taskInfo | |||||
} | |||||
func queryUserName(intSlice []int64) map[int64]*models.User { | func queryUserName(intSlice []int64) map[int64]*models.User { | ||||
keys := make(map[int64]string) | keys := make(map[int64]string) | ||||
uniqueElements := []int64{} | uniqueElements := []int64{} | ||||
@@ -677,6 +687,7 @@ func ShowOneVersionOtherModel(ctx *context.Context) { | |||||
userNameMap := queryUserName(userIds) | userNameMap := queryUserName(userIds) | ||||
for _, model := range aimodels { | for _, model := range aimodels { | ||||
removeIpInfo(model) | |||||
value := userNameMap[model.UserId] | value := userNameMap[model.UserId] | ||||
if value != nil { | if value != nil { | ||||
model.UserName = value.Name | model.UserName = value.Name | ||||
@@ -793,6 +804,7 @@ func ShowModelPageInfo(ctx *context.Context) { | |||||
userNameMap := queryUserName(userIds) | userNameMap := queryUserName(userIds) | ||||
for _, model := range modelResult { | for _, model := range modelResult { | ||||
removeIpInfo(model) | |||||
value := userNameMap[model.UserId] | value := userNameMap[model.UserId] | ||||
if value != nil { | if value != nil { | ||||
model.UserName = value.Name | model.UserName = value.Name | ||||
@@ -866,6 +878,7 @@ func QueryModelListForPredict(ctx *context.Context) { | |||||
nameMap := make(map[string][]*models.AiModelManage) | nameMap := make(map[string][]*models.AiModelManage) | ||||
for _, model := range modelResult { | for _, model := range modelResult { | ||||
removeIpInfo(model) | |||||
if _, value := nameMap[model.Name]; !value { | if _, value := nameMap[model.Name]; !value { | ||||
models := make([]*models.AiModelManage, 0) | models := make([]*models.AiModelManage, 0) | ||||
models = append(models, model) | models = append(models, model) | ||||
@@ -760,8 +760,8 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo | |||||
ctx.Data["ExitDiagnostics"] = taskRes.TaskStatuses[0].ExitDiagnostics | ctx.Data["ExitDiagnostics"] = taskRes.TaskStatuses[0].ExitDiagnostics | ||||
oldStatus := task.Status | oldStatus := task.Status | ||||
task.Status = taskRes.TaskStatuses[0].State | task.Status = taskRes.TaskStatuses[0].State | ||||
task.ContainerIp = "" | |||||
task.ContainerID = taskRes.TaskStatuses[0].ContainerID | task.ContainerID = taskRes.TaskStatuses[0].ContainerID | ||||
task.ContainerIp = taskRes.TaskStatuses[0].ContainerIP | |||||
models.ParseAndSetDurationFromCloudBrainOne(jobRes, task) | models.ParseAndSetDurationFromCloudBrainOne(jobRes, task) | ||||
if task.DeletedAt.IsZero() { //normal record | if task.DeletedAt.IsZero() { //normal record | ||||
@@ -1147,6 +1147,8 @@ func CloudBrainCommitImage(ctx *context.Context, form auth.CommitImageCloudBrain | |||||
} else if models.IsErrorImageCommitting(err) { | } else if models.IsErrorImageCommitting(err) { | ||||
ctx.JSON(200, models.BaseErrorMessage(ctx.Tr("repo.image_committing"))) | ctx.JSON(200, models.BaseErrorMessage(ctx.Tr("repo.image_committing"))) | ||||
} else if isOver20GError(err) { | |||||
ctx.JSON(200, models.BaseErrorMessage(ctx.Tr("repo.image_over_20g"))) | |||||
} else { | } else { | ||||
ctx.JSON(200, models.BaseErrorMessage(ctx.Tr("repo.image_commit_fail"))) | ctx.JSON(200, models.BaseErrorMessage(ctx.Tr("repo.image_commit_fail"))) | ||||
} | } | ||||
@@ -1156,6 +1158,10 @@ func CloudBrainCommitImage(ctx *context.Context, form auth.CommitImageCloudBrain | |||||
ctx.JSON(200, models.BaseOKMessage) | ctx.JSON(200, models.BaseOKMessage) | ||||
} | } | ||||
func isOver20GError(err error) bool { | |||||
return strings.Contains(err.Error(), "over max image size 20GB") | |||||
} | |||||
func checkTopics(Topics string) ([]string, string) { | func checkTopics(Topics string) ([]string, string) { | ||||
var topics = make([]string, 0) | var topics = make([]string, 0) | ||||
var topicsStr = strings.TrimSpace(Topics) | var topicsStr = strings.TrimSpace(Topics) | ||||
@@ -2813,16 +2819,11 @@ func GetBenchmarkTypes(ctx *context.Context) *models.BenchmarkTypes { | |||||
} | } | ||||
func GetCloudbrainAiCenter(task models.Cloudbrain, ctx *context.Context) string { | func GetCloudbrainAiCenter(task models.Cloudbrain, ctx *context.Context) string { | ||||
if task.Type == models.TypeCloudBrainOne { | |||||
return ctx.Tr("repo.cloudbrain1") | |||||
} else if task.Type == models.TypeCloudBrainTwo { | |||||
return ctx.Tr("repo.cloudbrain2") | |||||
} else if task.Type == models.TypeCDCenter { | |||||
return ctx.Tr("repo.cdCenter") | |||||
} else if task.Type == models.TypeC2Net { | |||||
return getCutStringAiCenterByAiCenter(task.AiCenter) | |||||
if task.Spec != nil { | |||||
return task.Spec.AiCenterName | |||||
} else { | |||||
return "" | |||||
} | } | ||||
return "" | |||||
} | } | ||||
func getCutStringAiCenterByAiCenter(aiCenter string) string { | func getCutStringAiCenterByAiCenter(aiCenter string) string { | ||||
if aiCenter == "" { | if aiCenter == "" { | ||||
@@ -2841,8 +2842,24 @@ func GetCloudbrainCluster(task models.Cloudbrain, ctx *context.Context) string { | |||||
return "" | return "" | ||||
} | } | ||||
func GetCloudbrainCardDuration(task models.Cloudbrain) string { | func GetCloudbrainCardDuration(task models.Cloudbrain) string { | ||||
cardNum, _, _ := GetCloudbrainCardNumAndType(task) | |||||
cardDuration := models.ConvertDurationToStr(int64(cardNum) * task.Duration) | |||||
cardNum := int(0) | |||||
spec, err := resource.GetCloudbrainSpec(task.ID) | |||||
if err != nil { | |||||
log.Info("error:" + err.Error()) | |||||
return "" | |||||
} | |||||
if spec != nil { | |||||
cardNum = spec.AccCardsNum | |||||
} else { | |||||
cardNum = 1 | |||||
} | |||||
var workServerNumber int64 | |||||
if task.WorkServerNumber >= 1 { | |||||
workServerNumber = int64(task.WorkServerNumber) | |||||
} else { | |||||
workServerNumber = 1 | |||||
} | |||||
cardDuration := models.ConvertDurationToStr(workServerNumber * int64(cardNum) * task.Duration) | |||||
return cardDuration | return cardDuration | ||||
} | } | ||||
func GetCloudbrainWaitTime(task models.Cloudbrain) string { | func GetCloudbrainWaitTime(task models.Cloudbrain) string { | ||||
@@ -2869,114 +2886,12 @@ func GetCloudbrainWaitTime(task models.Cloudbrain) string { | |||||
} | } | ||||
return waitTime | return waitTime | ||||
} | } | ||||
func GetCloudbrainCardNumAndType(task models.Cloudbrain) (int, string, error) { | |||||
if !models.SpecsMapInitFlag { | |||||
models.InitCloudbrainOneResourceSpecMap() | |||||
} | |||||
if !models.GpuInfosMapInitFlag { | |||||
models.InitCloudbrainOneGpuInfoMap() | |||||
} | |||||
flavorName, err := GetCloudbrainFlavorName(task) | |||||
if err != nil { | |||||
return 0, "", nil | |||||
} | |||||
return getCardNumAndTypeByFlavorname(flavorName) | |||||
} | |||||
func getCardNumAndTypeByFlavorname(FlavorName string) (int, string, error) { | |||||
if FlavorName == "" { | |||||
return 0, "", nil | |||||
} else { | |||||
var beginIndex = strings.Index(FlavorName, ":") | |||||
var lastIndex = strings.LastIndex(FlavorName, ":") | |||||
var endIndex = strings.Index(FlavorName, "*") | |||||
if endIndex >= (beginIndex+1) && lastIndex >= (endIndex+1) { | |||||
cardNum, err := strconv.Atoi(strings.TrimSpace(FlavorName[beginIndex+1 : endIndex])) | |||||
if err != nil { | |||||
log.Error("strconv.Atoi failed: %v", err) | |||||
return 0, "", err | |||||
} | |||||
cardType := strings.TrimSpace(FlavorName[endIndex+1 : lastIndex]) | |||||
return cardNum, cardType, err | |||||
} | |||||
return 0, "", nil | |||||
} | |||||
} | |||||
func GetCloudbrainFlavorName(task models.Cloudbrain) (string, error) { | |||||
if task.Type == models.TypeCloudBrainOne { | |||||
resourceSpec, gpuInfo, err := getCloudBrainOneResourceSpec(task) | |||||
if err != nil { | |||||
log.Info("getCloudBrainOneResourceSpec err:", err) | |||||
return "", err | |||||
} else { | |||||
if resourceSpec == nil || gpuInfo == nil { | |||||
err := errors.New("resourceSpec or gpuInfo is nil") | |||||
return "", err | |||||
} else { | |||||
CloudbrainOneFlavorName := "GPU:" + strconv.Itoa(resourceSpec.GpuNum) + "*Nvidia-" + gpuInfo.Value + | |||||
" | CPU:" + strconv.Itoa(resourceSpec.CpuNum) + "核" + strconv.Itoa(resourceSpec.MemMiB) + "MB" | |||||
return CloudbrainOneFlavorName, nil | |||||
} | |||||
} | |||||
} else if (task.Type == models.TypeCloudBrainTwo || task.Type == models.TypeC2Net || task.Type == models.TypeCDCenter) && task.FlavorName != "" { | |||||
replaceFlavorName := strings.ReplaceAll(task.FlavorName, ":", ":") | |||||
return replaceFlavorName, nil | |||||
} else if (task.Type == models.TypeCloudBrainTwo || task.Type == models.TypeCDCenter) && task.FlavorName == "" && task.FlavorCode != "" { | |||||
cloudbrainTwoFlavorName := getFlavorNameByFlavorCode(task.FlavorCode) | |||||
return cloudbrainTwoFlavorName, nil | |||||
} else if task.Type == models.TypeCloudBrainTwo && task.JobType == string(models.JobTypeDebug) && task.FlavorName == "" && task.FlavorCode == "" { | |||||
tasks, err := models.GetModelartsReDebugTaskByJobId(task.JobID) | |||||
if err != nil { | |||||
return "", err | |||||
} | |||||
if len(tasks) >= 1 { | |||||
return getFlavorNameByFlavorCode(tasks[0].FlavorCode), nil | |||||
} | |||||
return "", nil | |||||
} | |||||
return "", nil | |||||
} | |||||
func getCloudBrainOneResourceSpec(task models.Cloudbrain) (*models.ResourceSpec, *models.GpuInfo, error) { | |||||
gpuQueueDefault := "openidebug" | |||||
if task.GpuQueue != "" { | |||||
gpuQueueDefault = task.GpuQueue | |||||
} | |||||
if task.ResourceSpecId >= 0 { | |||||
if task.JobType == string(models.JobTypeTrain) { | |||||
if models.CloudbrainTrainResourceSpecsMap[task.ResourceSpecId] != nil { | |||||
return models.CloudbrainTrainResourceSpecsMap[task.ResourceSpecId], models.CloudbrainTrainGpuInfosMap[gpuQueueDefault], nil | |||||
} else { | |||||
return models.CloudbrainSpecialResourceSpecsMap[task.ResourceSpecId], models.CloudbrainSpecialGpuInfosMap[gpuQueueDefault], nil | |||||
} | |||||
} else if task.JobType == string(models.JobTypeDebug) { | |||||
if models.CloudbrainDebugResourceSpecsMap[task.ResourceSpecId] != nil { | |||||
return models.CloudbrainDebugResourceSpecsMap[task.ResourceSpecId], models.CloudbrainDebugGpuInfosMap[gpuQueueDefault], nil | |||||
} else { | |||||
return models.CloudbrainSpecialResourceSpecsMap[task.ResourceSpecId], models.CloudbrainSpecialGpuInfosMap[gpuQueueDefault], nil | |||||
} | |||||
} else if task.JobType == string(models.JobTypeInference) { | |||||
return models.CloudbrainInferenceResourceSpecsMap[task.ResourceSpecId], models.CloudbrainInferenceGpuInfosMap[gpuQueueDefault], nil | |||||
} else if task.JobType == string(models.JobTypeBenchmark) || task.JobType == string(models.JobTypeSnn4imagenet) || task.JobType == string(models.JobTypeBrainScore) { | |||||
return models.CloudbrainBenchmarkResourceSpecsMap[task.ResourceSpecId], models.CloudbrainBenchmarkGpuInfosMap[gpuQueueDefault], nil | |||||
} | |||||
func GetCloudbrainFlavorName(task models.Cloudbrain) string { | |||||
if task.Spec != nil { | |||||
flavorName := task.Spec.ComputeResource + ":" + fmt.Sprint(task.Spec.AccCardsNum) + "*" + task.Spec.AccCardType + | |||||
",内存:" + strconv.FormatInt(int64(task.Spec.MemGiB), 10) + "GB,共享内存:" + strconv.FormatInt(int64(task.Spec.ShareMemGiB), 10) + "GB" | |||||
return flavorName | |||||
} else { | } else { | ||||
err := errors.New("ResourceSpecId is null") | |||||
return nil, nil, err | |||||
} | |||||
return nil, nil, nil | |||||
} | |||||
func getFlavorNameByFlavorCode(flavorCode string) string { | |||||
index := strings.LastIndex(flavorCode, ".") | |||||
cardNum, err := strconv.Atoi(strings.TrimSpace(flavorCode[index+1 : len(flavorCode)])) | |||||
if err != nil { | |||||
log.Error("strconv.Atoi failed: %v", err) | |||||
return "" | return "" | ||||
} | } | ||||
cloudbrainTwoFlavorName := "Ascend:" + strings.TrimSpace(flavorCode[index+1:len(flavorCode)]) + | |||||
"*Ascend-910(" + strconv.Itoa(cardNum*32) + "GB)|ARM:" + strconv.Itoa(cardNum*24) + | |||||
"核" + strconv.Itoa(cardNum*256) + "GB" | |||||
return cloudbrainTwoFlavorName | |||||
} | } |
@@ -303,7 +303,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo | |||||
} | } | ||||
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests) { | if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests) { | ||||
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + ctx.Repo.BranchName + "..." + form.NewBranchName) | |||||
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + util.PathEscapeSegments(ctx.Repo.BranchName) + "..." + util.PathEscapeSegments(form.NewBranchName)) | |||||
} else { | } else { | ||||
ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName) + "/" + util.PathEscapeSegments(form.TreePath)) | ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName) + "/" + util.PathEscapeSegments(form.TreePath)) | ||||
} | } | ||||
@@ -475,7 +475,7 @@ func DeleteFilePost(ctx *context.Context, form auth.DeleteRepoFileForm) { | |||||
ctx.Flash.Success(ctx.Tr("repo.editor.file_delete_success", ctx.Repo.TreePath)) | ctx.Flash.Success(ctx.Tr("repo.editor.file_delete_success", ctx.Repo.TreePath)) | ||||
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests) { | if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests) { | ||||
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + ctx.Repo.BranchName + "..." + form.NewBranchName) | |||||
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + util.PathEscapeSegments(ctx.Repo.BranchName) + "..." + util.PathEscapeSegments(form.NewBranchName)) | |||||
} else { | } else { | ||||
treePath := filepath.Dir(ctx.Repo.TreePath) | treePath := filepath.Dir(ctx.Repo.TreePath) | ||||
if treePath == "." { | if treePath == "." { | ||||
@@ -686,7 +686,7 @@ func UploadFilePost(ctx *context.Context, form auth.UploadRepoFileForm) { | |||||
} | } | ||||
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests) { | if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests) { | ||||
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + ctx.Repo.BranchName + "..." + form.NewBranchName) | |||||
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + util.PathEscapeSegments(ctx.Repo.BranchName) + "..." + util.PathEscapeSegments(form.NewBranchName)) | |||||
} else { | } else { | ||||
ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName) + "/" + util.PathEscapeSegments(form.TreePath)) | ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName) + "/" + util.PathEscapeSegments(form.TreePath)) | ||||
} | } | ||||
@@ -713,6 +713,7 @@ func grampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain | |||||
DatasetNames: datasetNames, | DatasetNames: datasetNames, | ||||
DatasetInfos: datasetInfos, | DatasetInfos: datasetInfos, | ||||
Spec: spec, | Spec: spec, | ||||
CodeName: strings.ToLower(repo.Name), | |||||
} | } | ||||
if form.ModelName != "" { //使用预训练模型训练 | if form.ModelName != "" { //使用预训练模型训练 | ||||
req.ModelName = form.ModelName | req.ModelName = form.ModelName | ||||
@@ -837,6 +838,7 @@ func GrampusTrainJobShow(ctx *context.Context) { | |||||
ctx.NotFound(ctx.Req.URL.RequestURI(), nil) | ctx.NotFound(ctx.Req.URL.RequestURI(), nil) | ||||
return | return | ||||
} | } | ||||
task.ContainerIp = "" | |||||
if task.DeletedAt.IsZero() { //normal record | if task.DeletedAt.IsZero() { //normal record | ||||
result, err := grampus.GetJob(task.JobID) | result, err := grampus.GetJob(task.JobID) | ||||
@@ -976,8 +978,7 @@ func generateCommand(repoName, processorType, codeRemotePath, dataRemotePath, bo | |||||
command += "pwd;cd " + workDir + fmt.Sprintf(grampus.CommandPrepareScript, setting.Grampus.SyncScriptProject, setting.Grampus.SyncScriptProject) | command += "pwd;cd " + workDir + fmt.Sprintf(grampus.CommandPrepareScript, setting.Grampus.SyncScriptProject, setting.Grampus.SyncScriptProject) | ||||
//download code & dataset | //download code & dataset | ||||
if processorType == grampus.ProcessorTypeNPU { | if processorType == grampus.ProcessorTypeNPU { | ||||
commandDownload := "./downloader_for_obs " + setting.Bucket + " " + codeRemotePath + " " + grampus.CodeArchiveName + ";" | |||||
command += commandDownload | |||||
//no need to download code & dataset by internet | |||||
} else if processorType == grampus.ProcessorTypeGPU { | } else if processorType == grampus.ProcessorTypeGPU { | ||||
commandDownload := "./downloader_for_minio " + setting.Grampus.Env + " " + codeRemotePath + " " + grampus.CodeArchiveName + " '" + dataRemotePath + "' '" + datasetName + "'" | commandDownload := "./downloader_for_minio " + setting.Grampus.Env + " " + codeRemotePath + " " + grampus.CodeArchiveName + " '" + dataRemotePath + "' '" + datasetName + "'" | ||||
commandDownload = processPretrainModelParameter(pretrainModelPath, pretrainModelFileName, commandDownload) | commandDownload = processPretrainModelParameter(pretrainModelPath, pretrainModelFileName, commandDownload) | ||||
@@ -986,8 +987,7 @@ func generateCommand(repoName, processorType, codeRemotePath, dataRemotePath, bo | |||||
//unzip code & dataset | //unzip code & dataset | ||||
if processorType == grampus.ProcessorTypeNPU { | if processorType == grampus.ProcessorTypeNPU { | ||||
commandUnzip := "cd " + workDir + "code;unzip -q master.zip;" | |||||
command += commandUnzip | |||||
//no need to process | |||||
} else if processorType == grampus.ProcessorTypeGPU { | } else if processorType == grampus.ProcessorTypeGPU { | ||||
unZipDatasetCommand := generateDatasetUnzipCommand(datasetName) | unZipDatasetCommand := generateDatasetUnzipCommand(datasetName) | ||||
commandUnzip := "cd " + workDir + "code;unzip -q master.zip;echo \"start to unzip dataset\";cd " + workDir + "dataset;" + unZipDatasetCommand | commandUnzip := "cd " + workDir + "code;unzip -q master.zip;echo \"start to unzip dataset\";cd " + workDir + "dataset;" + unZipDatasetCommand | ||||
@@ -1024,7 +1024,7 @@ func generateCommand(repoName, processorType, codeRemotePath, dataRemotePath, bo | |||||
var commandCode string | var commandCode string | ||||
if processorType == grampus.ProcessorTypeNPU { | if processorType == grampus.ProcessorTypeNPU { | ||||
commandCode = "/bin/bash /home/work/run_train_for_openi.sh " + workDir + "code/" + strings.ToLower(repoName) + "/" + bootFile + " /tmp/log/train.log" + paramCode + ";" | |||||
commandCode = "/bin/bash /home/work/run_train_for_openi.sh /home/work/openi.py /tmp/log/train.log" + paramCode + ";" | |||||
} else if processorType == grampus.ProcessorTypeGPU { | } else if processorType == grampus.ProcessorTypeGPU { | ||||
if pretrainModelFileName != "" { | if pretrainModelFileName != "" { | ||||
paramCode += " --ckpt_url" + "=" + workDir + "pretrainmodel/" + pretrainModelFileName | paramCode += " --ckpt_url" + "=" + workDir + "pretrainmodel/" + pretrainModelFileName | ||||
@@ -985,7 +985,7 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) | |||||
//isSaveParam := form.IsSaveParam | //isSaveParam := form.IsSaveParam | ||||
repo := ctx.Repo.Repository | repo := ctx.Repo.Repository | ||||
codeLocalPath := setting.JobPath + jobName + modelarts.CodePath | codeLocalPath := setting.JobPath + jobName + modelarts.CodePath | ||||
codeObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.CodePath | |||||
codeObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.CodePath + VersionOutputPath + "/" | |||||
outputObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.OutputPath + VersionOutputPath + "/" | outputObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.OutputPath + VersionOutputPath + "/" | ||||
logObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.LogPath + VersionOutputPath + "/" | logObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.LogPath + VersionOutputPath + "/" | ||||
// dataPath := "/" + setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + uuid + uuid + "/" | // dataPath := "/" + setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + uuid + uuid + "/" | ||||
@@ -1108,8 +1108,8 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) | |||||
return | return | ||||
} | } | ||||
// parentDir := VersionOutputPath + "/" | |||||
if err := uploadCodeToObs(codeLocalPath, jobName, ""); err != nil { | |||||
parentDir := VersionOutputPath + "/" | |||||
if err := uploadCodeToObs(codeLocalPath, jobName, parentDir); err != nil { | |||||
// if err := uploadCodeToObs(codeLocalPath, jobName, parentDir); err != nil { | // if err := uploadCodeToObs(codeLocalPath, jobName, parentDir); err != nil { | ||||
log.Error("Failed to uploadCodeToObs: %s (%v)", repo.FullName(), err) | log.Error("Failed to uploadCodeToObs: %s (%v)", repo.FullName(), err) | ||||
trainJobNewDataPrepare(ctx) | trainJobNewDataPrepare(ctx) | ||||
@@ -1795,7 +1795,7 @@ func TrainJobShow(ctx *context.Context) { | |||||
datasetList = append(datasetList, GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false)) | datasetList = append(datasetList, GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false)) | ||||
VersionListTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) | VersionListTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) | ||||
VersionListTasks[i].CanModify = cloudbrain.CanModifyJob(ctx, &task.Cloudbrain) | VersionListTasks[i].CanModify = cloudbrain.CanModifyJob(ctx, &task.Cloudbrain) | ||||
VersionListTasks[i].ContainerIp = "" | |||||
//add spec | //add spec | ||||
s, err := resource.GetCloudbrainSpec(task.Cloudbrain.ID) | s, err := resource.GetCloudbrainSpec(task.Cloudbrain.ID) | ||||
if err != nil { | if err != nil { | ||||
@@ -12,6 +12,7 @@ import ( | |||||
"path" | "path" | ||||
"regexp" | "regexp" | ||||
"strings" | "strings" | ||||
"text/template" | |||||
"unicode/utf8" | "unicode/utf8" | ||||
"code.gitea.io/gitea/modules/validation" | "code.gitea.io/gitea/modules/validation" | ||||
@@ -212,7 +213,7 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) { | |||||
opts := models.GenerateRepoOptions{ | opts := models.GenerateRepoOptions{ | ||||
Name: form.RepoName, | Name: form.RepoName, | ||||
Alias: form.Alias, | Alias: form.Alias, | ||||
Description: form.Description, | |||||
Description: template.HTMLEscapeString(form.Description), | |||||
Private: form.Private, | Private: form.Private, | ||||
GitContent: form.GitContent, | GitContent: form.GitContent, | ||||
Topics: form.Topics, | Topics: form.Topics, | ||||
@@ -8,6 +8,7 @@ package repo | |||||
import ( | import ( | ||||
"errors" | "errors" | ||||
"fmt" | "fmt" | ||||
"html/template" | |||||
"io/ioutil" | "io/ioutil" | ||||
"net/url" | "net/url" | ||||
"regexp" | "regexp" | ||||
@@ -129,7 +130,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) { | |||||
// In case it's just a case change. | // In case it's just a case change. | ||||
repo.Name = newRepoName | repo.Name = newRepoName | ||||
repo.LowerName = strings.ToLower(newRepoName) | repo.LowerName = strings.ToLower(newRepoName) | ||||
repo.Description = form.Description | |||||
repo.Description = template.HTMLEscapeString(form.Description) | |||||
repo.Website = form.Website | repo.Website = form.Website | ||||
repo.IsTemplate = form.Template | repo.IsTemplate = form.Template | ||||
repo.Alias = newAlias | repo.Alias = newAlias | ||||
@@ -5,6 +5,7 @@ | |||||
package repo | package repo | ||||
import ( | import ( | ||||
"code.gitea.io/gitea/modules/util" | |||||
"fmt" | "fmt" | ||||
"strings" | "strings" | ||||
"time" | "time" | ||||
@@ -192,7 +193,7 @@ func SettingsProtectedBranchPost(ctx *context.Context, f auth.ProtectBranchForm) | |||||
} | } | ||||
if f.RequiredApprovals < 0 { | if f.RequiredApprovals < 0 { | ||||
ctx.Flash.Error(ctx.Tr("repo.settings.protected_branch_required_approvals_min")) | ctx.Flash.Error(ctx.Tr("repo.settings.protected_branch_required_approvals_min")) | ||||
ctx.Redirect(fmt.Sprintf("%s/settings/branches/%s", ctx.Repo.RepoLink, branch)) | |||||
ctx.Redirect(fmt.Sprintf("%s/settings/branches/%s", ctx.Repo.RepoLink, util.PathEscapeSegments(branch))) | |||||
} | } | ||||
var whitelistUsers, whitelistTeams, mergeWhitelistUsers, mergeWhitelistTeams, approvalsWhitelistUsers, approvalsWhitelistTeams []int64 | var whitelistUsers, whitelistTeams, mergeWhitelistUsers, mergeWhitelistTeams, approvalsWhitelistUsers, approvalsWhitelistTeams []int64 | ||||
@@ -263,7 +264,7 @@ func SettingsProtectedBranchPost(ctx *context.Context, f auth.ProtectBranchForm) | |||||
return | return | ||||
} | } | ||||
ctx.Flash.Success(ctx.Tr("repo.settings.update_protect_branch_success", branch)) | ctx.Flash.Success(ctx.Tr("repo.settings.update_protect_branch_success", branch)) | ||||
ctx.Redirect(fmt.Sprintf("%s/settings/branches/%s", ctx.Repo.RepoLink, branch)) | |||||
ctx.Redirect(fmt.Sprintf("%s/settings/branches/%s", ctx.Repo.RepoLink, util.PathEscapeSegments(branch))) | |||||
} else { | } else { | ||||
if protectBranch != nil { | if protectBranch != nil { | ||||
if err := ctx.Repo.Repository.DeleteProtectedBranch(protectBranch.ID); err != nil { | if err := ctx.Repo.Repository.DeleteProtectedBranch(protectBranch.ID); err != nil { | ||||
@@ -23,7 +23,6 @@ import ( | |||||
"code.gitea.io/gitea/modules/modelarts" | "code.gitea.io/gitea/modules/modelarts" | ||||
"code.gitea.io/gitea/modules/setting" | "code.gitea.io/gitea/modules/setting" | ||||
"code.gitea.io/gitea/modules/util" | "code.gitea.io/gitea/modules/util" | ||||
"code.gitea.io/gitea/routers/repo" | |||||
issue_service "code.gitea.io/gitea/services/issue" | issue_service "code.gitea.io/gitea/services/issue" | ||||
pull_service "code.gitea.io/gitea/services/pull" | pull_service "code.gitea.io/gitea/services/pull" | ||||
@@ -841,9 +840,6 @@ func Cloudbrains(ctx *context.Context) { | |||||
ciTasks[i].CanDebug = true | ciTasks[i].CanDebug = true | ||||
ciTasks[i].CanDel = true | ciTasks[i].CanDel = true | ||||
ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource | ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource | ||||
ciTasks[i].Cloudbrain.AiCenter = repo.GetCloudbrainAiCenter(task.Cloudbrain, ctx) | |||||
ciTasks[i].Cloudbrain.Cluster = repo.GetCloudbrainCluster(task.Cloudbrain, ctx) | |||||
} | } | ||||
pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, getTotalPage(count, setting.UI.IssuePagingNum)) | pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, getTotalPage(count, setting.UI.IssuePagingNum)) | ||||
@@ -89,7 +89,7 @@ | |||||
<div class="row"> | <div class="row"> | ||||
<!-- 任务名 --> | <!-- 任务名 --> | ||||
{{$JobID := '0'}} | {{$JobID := '0'}} | ||||
{{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK"}} | |||||
{{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK" "MODELSAFETY"}} | |||||
{{$JobID = .Cloudbrain.ID}} | {{$JobID = .Cloudbrain.ID}} | ||||
{{else}} | {{else}} | ||||
{{$JobID = .JobID}} | {{$JobID = .JobID}} | ||||
@@ -110,6 +110,13 @@ | |||||
<span class="fitted" | <span class="fitted" | ||||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | ||||
</a> | </a> | ||||
{{else if eq .JobType "MODELSAFETY"}} | |||||
<a class="title" | |||||
href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/modelsafety/{{$JobID}}/show" | |||||
title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||||
<span class="fitted" | |||||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||||
</a> | |||||
{{else if eq .JobType "INFERENCE"}} | {{else if eq .JobType "INFERENCE"}} | ||||
<a class="title" | <a class="title" | ||||
href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/{{if eq .Cloudbrain.Type 1}}modelarts{{else if eq .Cloudbrain.Type 0}}cloudbrain{{end}}/inference-job/{{$JobID}}" | href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/{{if eq .Cloudbrain.Type 1}}modelarts{{else if eq .Cloudbrain.Type 0}}cloudbrain{{end}}/inference-job/{{$JobID}}" | ||||
@@ -135,8 +142,7 @@ | |||||
</div> | </div> | ||||
<!-- 集群 --> | <!-- 集群 --> | ||||
<div class="one wide column text center nowrap" style="width:6% !important;"> | <div class="one wide column text center nowrap" style="width:6% !important;"> | ||||
<span | |||||
style="font-size: 12px;">{{if .Cluster}}{{.Cluster}}{{else}}--{{end}}</span> | |||||
<span style="font-size: 12px;" class="cluster_{{.DisplayJobName}}_{{$JobID}}">{{if .Cluster}}{{.Cluster}}{{else}}--{{end}}</span> | |||||
</div> | </div> | ||||
<!-- 任务状态 --> | <!-- 任务状态 --> | ||||
<div class="two wide column text center nowrap" | <div class="two wide column text center nowrap" | ||||
@@ -171,8 +177,7 @@ | |||||
</div> | </div> | ||||
<!-- 智算中心 --> | <!-- 智算中心 --> | ||||
<div class="one wide column text center nowrap" style="width:8% !important;"> | <div class="one wide column text center nowrap" style="width:8% !important;"> | ||||
<span | |||||
style="font-size: 12px;">{{if .AiCenter}}{{.AiCenter}}{{else}}--{{end}}</span> | |||||
<span style="font-size: 12px;" class="aicenter_{{.DisplayJobName}}_{{$JobID}}">{{if .AiCenter}}{{.AiCenter}}{{else}}--{{end}}</span> | |||||
</div> | </div> | ||||
<!-- XPU类型 --> | <!-- XPU类型 --> | ||||
<div class="one wide column text center nowrap" style="width:8% !important;"> | <div class="one wide column text center nowrap" style="width:8% !important;"> | ||||
@@ -185,6 +190,17 @@ | |||||
var spanEl = document.querySelector('.card_type_{{.DisplayJobName}}_{{$JobID}}'); | var spanEl = document.querySelector('.card_type_{{.DisplayJobName}}_{{$JobID}}'); | ||||
spanEl.setAttribute('title', cardType); | spanEl.setAttribute('title', cardType); | ||||
spanEl.innerText = cardType; | spanEl.innerText = cardType; | ||||
var cluster = spec.Cluster || '--'; | |||||
var clusterName = document.querySelector('.cloudbrain_debug').dataset['cluster' + cluster[0] + cluster.toLocaleLowerCase().slice(1)] || '--'; | |||||
spanEl = document.querySelector('.cluster_{{.DisplayJobName}}_{{$JobID}}'); | |||||
spanEl.setAttribute('title', cluster); | |||||
spanEl.innerText = clusterName; | |||||
var aiCenter = spec.AiCenterName || '--'; | |||||
spanEl = document.querySelector('.aicenter_{{.DisplayJobName}}_{{$JobID}}'); | |||||
spanEl.setAttribute('title', aiCenter); | |||||
spanEl.innerText = aiCenter; | |||||
})(); | })(); | ||||
</script> | </script> | ||||
<!-- 创建者 --> | <!-- 创建者 --> | ||||
@@ -205,11 +221,12 @@ | |||||
<!-- 云脑侧名称 --> | <!-- 云脑侧名称 --> | ||||
<div class="two wide column text center nowrap" | <div class="two wide column text center nowrap" | ||||
style="overflow: hidden;text-overflow:ellipsis;width:10% !important;"> | style="overflow: hidden;text-overflow:ellipsis;width:10% !important;"> | ||||
<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-{{.JobName}}" style="cursor:pointer" | |||||
data-clipboard-text="{{.JobName}}" | data-clipboard-text="{{.JobName}}" | ||||
data-success="{{$.i18n.Tr "repo.copy_link_success"}}" | |||||
data-error="{{$.i18n.Tr "repo.copy_link_error"}}" | |||||
data-content="{{$.i18n.Tr "repo.copy_link"}}" | |||||
data-original="{{$.i18n.Tr "repo.copy"}}" | |||||
data-success="{{$.i18n.Tr "repo.copied"}}" | |||||
data-error="{{$.i18n.Tr "repo.copied_error"}}" | |||||
data-content="{{$.i18n.Tr "repo.copy"}}" | |||||
data-variation="inverted tiny" | data-variation="inverted tiny" | ||||
> | > | ||||
<span class="fitted" title="{{.JobName}}">{{.JobName}}</span> | <span class="fitted" title="{{.JobName}}">{{.JobName}}</span> | ||||
@@ -238,8 +255,19 @@ | |||||
</form> | </form> | ||||
</div> | </div> | ||||
{{end}} | {{end}} | ||||
<!-- 停止任务 --> | |||||
<!-- 停止任务 --> | |||||
<div class="ui compact buttons"> | <div class="ui compact buttons"> | ||||
{{if eq .JobType "MODELSAFETY"}} | |||||
<form id="stopForm-{{$JobID}}" style="margin-left:-1px;"> | |||||
{{$.CsrfTokenHtml}} | |||||
<a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" | |||||
class='ui basic ai_stop {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "SUCCEEDED" "STOPPED" "STOPPING"}}disabled {{else}} blue {{end}}button' | |||||
data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/modelsafety/{{$JobID}}/stop' | |||||
data-jobid="{{$JobID}}"> | |||||
{{$.i18n.Tr "repo.stop"}} | |||||
</a> | |||||
</form> | |||||
{{else}} | |||||
{{if eq .JobType "DEBUG" "BENCHMARK" "SNN4IMAGENET" "BRAINSCORE"}} | {{if eq .JobType "DEBUG" "BENCHMARK" "SNN4IMAGENET" "BRAINSCORE"}} | ||||
<form id="stopForm-{{$JobID}}" style="margin-left:-1px;"> | <form id="stopForm-{{$JobID}}" style="margin-left:-1px;"> | ||||
{{$.CsrfTokenHtml}} | {{$.CsrfTokenHtml}} | ||||
@@ -258,6 +286,7 @@ | |||||
{{$.i18n.Tr "repo.stop"}} | {{$.i18n.Tr "repo.stop"}} | ||||
</a> | </a> | ||||
{{end}} | {{end}} | ||||
{{end}} | |||||
</div> | </div> | ||||
<!-- 修改任务 --> | <!-- 修改任务 --> | ||||
{{if eq .JobType "TRAIN"}} | {{if eq .JobType "TRAIN"}} | ||||
@@ -268,17 +297,30 @@ | |||||
</div> | </div> | ||||
{{end}} | {{end}} | ||||
<!-- 删除任务 --> | <!-- 删除任务 --> | ||||
<form class="ui compact buttons" id="delForm-{{$JobID}}" | |||||
action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "BENCHMARK"}}/cloudbrain/benchmark{{else if or (eq .JobType "SNN4IMAGENET") (eq .JobType "BRAINSCORE")}}/cloudbrain{{else if eq .JobType "DEBUG"}}{{if eq .ComputeResource "NPU"}}/modelarts/notebook{{else}}/cloudbrain{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .Cloudbrain.Type 1}}/modelarts/train-job{{else if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{else if eq .Cloudbrain.Type 2}}/grampus/train-job{{end}}{{else if eq .JobType "INFERENCE"}}{{if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{end}}{{end}}/{{$JobID}}/del?isadminpage=true' | |||||
method="post"> | |||||
{{$.CsrfTokenHtml}} | |||||
<a style="padding: 0.5rem 1rem;margin-left:0.2rem" id="ai-delete-{{$JobID}}" | |||||
data-repopath="{{.Repo.OwnerName}}/{{.Repo.Name}}/modelarts/inference-job/{{$JobID}}/del_version?isadminpage=true" | |||||
data-version="" class="ui basic ai_delete blue button" | |||||
style="border-radius: .28571429rem;"> | |||||
{{$.i18n.Tr "repo.delete"}} | |||||
</a> | |||||
</form> | |||||
{{if eq .JobType "MODELSAFETY"}} | |||||
<form class="ui compact buttons" id="delForm-{{$JobID}}" | |||||
action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/modelsafety/{{$JobID}}/del?isadminpage=true' | |||||
method="post"> | |||||
{{$.CsrfTokenHtml}} | |||||
<a style="padding: 0.5rem 1rem;margin-left:0.2rem" id="ai-delete-{{$JobID}}" | |||||
class="ui basic ai_delete blue button" | |||||
style="border-radius: .28571429rem;"> | |||||
{{$.i18n.Tr "repo.delete"}} | |||||
</a> | |||||
</form> | |||||
{{else}} | |||||
<form class="ui compact buttons" id="delForm-{{$JobID}}" | |||||
action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "BENCHMARK"}}/cloudbrain/benchmark{{else if or (eq .JobType "SNN4IMAGENET") (eq .JobType "BRAINSCORE")}}/cloudbrain{{else if eq .JobType "DEBUG"}}{{if eq .ComputeResource "NPU"}}/modelarts/notebook{{else}}/cloudbrain{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .Cloudbrain.Type 1}}/modelarts/train-job{{else if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{else if eq .Cloudbrain.Type 2}}/grampus/train-job{{end}}{{else if eq .JobType "INFERENCE"}}{{if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{end}}{{end}}/{{$JobID}}/del?isadminpage=true' | |||||
method="post"> | |||||
{{$.CsrfTokenHtml}} | |||||
<a style="padding: 0.5rem 1rem;margin-left:0.2rem" id="ai-delete-{{$JobID}}" | |||||
data-repopath="{{.Repo.OwnerName}}/{{.Repo.Name}}/modelarts/inference-job/{{$JobID}}/del_version?isadminpage=true" | |||||
data-version="" class="ui basic ai_delete blue button" | |||||
style="border-radius: .28571429rem;"> | |||||
{{$.i18n.Tr "repo.delete"}} | |||||
</a> | |||||
</form> | |||||
{{end}} | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
@@ -253,7 +253,7 @@ | |||||
<div style="float: right;"> | <div style="float: right;"> | ||||
{{if and ($.canDownload) (ne .Status "WAITING") ($.Permission.CanWrite $.UnitTypeModelManage) }} | {{if and ($.canDownload) (ne .Status "WAITING") ($.Permission.CanWrite $.UnitTypeModelManage) }} | ||||
<a class="ti-action-menu-item" id="{{.VersionName}}-create-model" | <a class="ti-action-menu-item" id="{{.VersionName}}-create-model" | ||||
onclick="showcreate({{.}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | |||||
onclick="showcreate({DisplayJobName:{{.DisplayJobName}},JobName:{{.JobName}},JobID:{{.JobID}},VersionName:{{.VersionName}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | |||||
{{else}} | {{else}} | ||||
<a class="ti-action-menu-item disabled" id="{{.VersionName}}-create-model">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | <a class="ti-action-menu-item disabled" id="{{.VersionName}}-create-model">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | ||||
{{end}} | {{end}} | ||||
@@ -265,7 +265,7 @@ | |||||
<div style="float: right;"> | <div style="float: right;"> | ||||
{{if and ($.canDownload) (ne .Status "WAITING") ($.Permission.CanWrite $.UnitTypeModelManage) }} | {{if and ($.canDownload) (ne .Status "WAITING") ($.Permission.CanWrite $.UnitTypeModelManage) }} | ||||
<a class="ti-action-menu-item" id="{{.VersionName}}-create-model" | <a class="ti-action-menu-item" id="{{.VersionName}}-create-model" | ||||
onclick="showcreate({{.}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | |||||
onclick="showcreate({DisplayJobName:{{.DisplayJobName}},JobName:{{.JobName}},JobID:{{.JobID}},VersionName:{{.VersionName}},EngineName:{{.EngineName}},ComputeResource:{{.ComputeResource}},Type:{{.Type}}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | |||||
{{else}} | {{else}} | ||||
<a class="ti-action-menu-item disabled" id="{{.VersionName}}-create-model">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | <a class="ti-action-menu-item disabled" id="{{.VersionName}}-create-model">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | ||||
{{end}} | {{end}} | ||||
@@ -207,6 +207,18 @@ | |||||
padding-left: 1rem; | padding-left: 1rem; | ||||
padding-top: 0.5rem; | padding-top: 0.5rem; | ||||
} | } | ||||
.dataset_nowrap_two_line{ | |||||
word-wrap: break-word; | |||||
word-break: break-all; | |||||
overflow: hidden; | |||||
text-overflow: ellipsis; | |||||
display: -webkit-box; | |||||
-webkit-box-orient: vertical; | |||||
line-clamp: 2; | |||||
-webkit-line-clamp: 2; | |||||
text-overflow: -o-ellipsis-lastline; | |||||
max-height: 50px; | |||||
} | |||||
</style> | </style> | ||||
<div class="repository"> | <div class="repository"> | ||||
{{template "repo/header" .}} | {{template "repo/header" .}} | ||||
@@ -437,15 +449,14 @@ | |||||
<tbody> | <tbody> | ||||
{{range $.datasetDownload}} | {{range $.datasetDownload}} | ||||
<tr> | <tr> | ||||
<td style="word-wrap: break-word;word-break: break-all;"> | |||||
<td class="dataset_nowrap_two_line"> | |||||
{{if eq .IsDelete true}} | {{if eq .IsDelete true}} | ||||
{{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) | {{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) | ||||
{{else}} | {{else}} | ||||
<a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a> | <a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a> | ||||
{{end}} | {{end}} | ||||
</td> | </td> | ||||
<td style="word-wrap: break-word;word-break: break-all;">{{.DatasetDownloadLink}}</td> | |||||
<td class="dataset_nowrap_two_line">{{.DatasetDownloadLink}}</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> | <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> | </tr> | ||||
{{end}} | {{end}} | ||||
@@ -249,7 +249,7 @@ | |||||
{{$.CsrfTokenHtml}} | {{$.CsrfTokenHtml}} | ||||
{{if and (.CanModify) (ne .Status "WAITING") ($.Permission.CanWrite $.UnitTypeModelManage) }} | {{if and (.CanModify) (ne .Status "WAITING") ($.Permission.CanWrite $.UnitTypeModelManage) }} | ||||
<a class="ti-action-menu-item" id="{{.VersionName}}-create-model" | <a class="ti-action-menu-item" id="{{.VersionName}}-create-model" | ||||
onclick="showcreate({{.}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | |||||
onclick="showcreate({DisplayJobName:{{.DisplayJobName}},JobName:{{.JobName}},JobID:{{.JobID}},VersionName:{{.VersionName}},EngineID:{{.EngineID}}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | |||||
{{else}} | {{else}} | ||||
<a class="ti-action-menu-item disabled" id="{{.VersionName}}-create-model">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | <a class="ti-action-menu-item disabled" id="{{.VersionName}}-create-model">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | ||||
{{end}} | {{end}} | ||||
@@ -783,7 +783,6 @@ | |||||
} | } | ||||
let dirKey="isOnlyDir--:&"; | let dirKey="isOnlyDir--:&"; | ||||
function loadSelectedModelFile(trainJob){ | function loadSelectedModelFile(trainJob){ | ||||
console.log("trainJob=" + trainJob); | |||||
$('#choice_file').dropdown('clear') | $('#choice_file').dropdown('clear') | ||||
$("#model-file").empty() | $("#model-file").empty() | ||||
if(trainJob ==null || trainJob ==""){ | if(trainJob ==null || trainJob ==""){ | ||||
@@ -15,11 +15,11 @@ | |||||
data-all-compute="{{.i18n.Tr "admin.cloudbrain.all_computing_resources"}}" | data-all-compute="{{.i18n.Tr "admin.cloudbrain.all_computing_resources"}}" | ||||
data-all-status="{{.i18n.Tr "admin.cloudbrain.all_status"}}"></div> | data-all-status="{{.i18n.Tr "admin.cloudbrain.all_status"}}"></div> | ||||
{{template "admin/cloudbrain/search_dashboard" .}} | {{template "admin/cloudbrain/search_dashboard" .}} | ||||
<div class="ui container" style="width: 90%;"> | |||||
<div class="ui container" style="width:90%;overflow-x:auto;overflow-y:hidden"> | |||||
{{template "base/alert" .}} | {{template "base/alert" .}} | ||||
<div class="ui grid"> | |||||
<div class="ui grid" style="min-width:1700px;"> | |||||
<div class="row"> | <div class="row"> | ||||
<div class="ui sixteen wide column"> | |||||
<div class="ui sixteen wide column" style="margin-bottom:15px;"> | |||||
<!-- 任务展示 --> | <!-- 任务展示 --> | ||||
<div class="dataset list"> | <div class="dataset list"> | ||||
<!-- 表头 --> | <!-- 表头 --> | ||||
@@ -71,7 +71,7 @@ | |||||
<div class="row"> | <div class="row"> | ||||
<!-- 任务名 --> | <!-- 任务名 --> | ||||
{{$JobID := '0'}} | {{$JobID := '0'}} | ||||
{{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK"}} | |||||
{{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK" "MODELSAFETY"}} | |||||
{{$JobID = .Cloudbrain.ID}} | {{$JobID = .Cloudbrain.ID}} | ||||
{{else}} | {{else}} | ||||
{{$JobID = .JobID}} | {{$JobID = .JobID}} | ||||
@@ -92,6 +92,13 @@ | |||||
<span class="fitted" | <span class="fitted" | ||||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | ||||
</a> | </a> | ||||
{{else if eq .JobType "MODELSAFETY"}} | |||||
<a class="title" | |||||
href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/modelsafety/{{$JobID}}/show" | |||||
title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||||
<span class="fitted" | |||||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||||
</a> | |||||
{{else if eq .JobType "INFERENCE"}} | {{else if eq .JobType "INFERENCE"}} | ||||
<a class="title" | <a class="title" | ||||
href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/{{if eq .Cloudbrain.Type 1}}modelarts{{else if eq .Cloudbrain.Type 0}}cloudbrain{{end}}/inference-job/{{$JobID}}" | href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/{{if eq .Cloudbrain.Type 1}}modelarts{{else if eq .Cloudbrain.Type 0}}cloudbrain{{end}}/inference-job/{{$JobID}}" | ||||
@@ -117,8 +124,7 @@ | |||||
</div> | </div> | ||||
<!-- 集群 --> | <!-- 集群 --> | ||||
<div class="one wide column text center nowrap" style="width:8% !important;"> | <div class="one wide column text center nowrap" style="width:8% !important;"> | ||||
<span | |||||
style="font-size: 12px;">{{if .Cluster}}{{.Cluster}}{{else}}--{{end}}</span> | |||||
<span style="font-size: 12px;" class="cluster_{{.DisplayJobName}}_{{$JobID}}">{{if .Cluster}}{{.Cluster}}{{else}}--{{end}}</span> | |||||
</div> | </div> | ||||
<!-- 任务状态 --> | <!-- 任务状态 --> | ||||
<div class="two wide column text center nowrap" | <div class="two wide column text center nowrap" | ||||
@@ -155,8 +161,7 @@ | |||||
<!-- 智算中心 --> | <!-- 智算中心 --> | ||||
<div class="one wide column text center nowrap" style="width:8% !important;"> | <div class="one wide column text center nowrap" style="width:8% !important;"> | ||||
<span | |||||
style="font-size: 12px;">{{if .AiCenter}}{{.AiCenter}}{{else}}--{{end}}</span> | |||||
<span style="font-size: 12px;" class="aicenter_{{.DisplayJobName}}_{{$JobID}}">{{if .AiCenter}}{{.AiCenter}}{{else}}--{{end}}</span> | |||||
</div> | </div> | ||||
<!-- XPU类型 --> | <!-- XPU类型 --> | ||||
<div class="one wide column text center nowrap" style="width:10% !important;"> | <div class="one wide column text center nowrap" style="width:10% !important;"> | ||||
@@ -169,6 +174,17 @@ | |||||
var spanEl = document.querySelector('.card_type_{{.DisplayJobName}}_{{$JobID}}'); | var spanEl = document.querySelector('.card_type_{{.DisplayJobName}}_{{$JobID}}'); | ||||
spanEl.setAttribute('title', cardType); | spanEl.setAttribute('title', cardType); | ||||
spanEl.innerText = cardType; | spanEl.innerText = cardType; | ||||
var cluster = spec.Cluster || '--'; | |||||
var clusterName = document.querySelector('.cloudbrain_debug').dataset['cluster' + cluster[0] + cluster.toLocaleLowerCase().slice(1)] || '--'; | |||||
spanEl = document.querySelector('.cluster_{{.DisplayJobName}}_{{$JobID}}'); | |||||
spanEl.setAttribute('title', cluster); | |||||
spanEl.innerText = clusterName; | |||||
var aiCenter = spec.AiCenterName || '--'; | |||||
spanEl = document.querySelector('.aicenter_{{.DisplayJobName}}_{{$JobID}}'); | |||||
spanEl.setAttribute('title', aiCenter); | |||||
spanEl.innerText = aiCenter; | |||||
})(); | })(); | ||||
</script> | </script> | ||||
<!-- 项目 --> | <!-- 项目 --> | ||||
@@ -202,23 +218,35 @@ | |||||
{{end}} | {{end}} | ||||
<!-- 停止任务 --> | <!-- 停止任务 --> | ||||
<div class="ui compact buttons"> | <div class="ui compact buttons"> | ||||
{{if eq .JobType "DEBUG" "BENCHMARK" "SNN4IMAGENET" "BRAINSCORE"}} | |||||
<form id="stopForm-{{$JobID}}" style="margin-left:-1px;"> | |||||
{{$.CsrfTokenHtml}} | |||||
{{if eq .JobType "MODELSAFETY"}} | |||||
<form id="stopForm-{{$JobID}}" style="margin-left:-1px;"> | |||||
{{$.CsrfTokenHtml}} | |||||
<a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" | |||||
class='ui basic ai_stop {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "SUCCEEDED" "STOPPED" "STOPPING" "CREATE_FAILED"}}disabled {{else}} blue {{end}}button' | |||||
data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/modelsafety/{{$JobID}}/stop' | |||||
data-jobid="{{$JobID}}"> | |||||
{{$.i18n.Tr "repo.stop"}} | |||||
</a> | |||||
</form> | |||||
{{else}} | |||||
{{if eq .JobType "DEBUG" "BENCHMARK" "SNN4IMAGENET" "BRAINSCORE"}} | |||||
<form id="stopForm-{{$JobID}}" style="margin-left:-1px;"> | |||||
{{$.CsrfTokenHtml}} | |||||
<a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" | |||||
class='ui basic ai_stop {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "SUCCEEDED" "STOPPED" "STOPPING" "CREATE_FAILED"}}disabled {{else}} blue {{end}}button' | |||||
data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else if eq .JobType "BENCHMARK" }}/cloudbrain/benchmark{{else if eq .ComputeResource "NPU" }}/modelarts/notebook{{end}}/{{$JobID}}/stop' | |||||
data-jobid="{{$JobID}}"> | |||||
{{$.i18n.Tr "repo.stop"}} | |||||
</a> | |||||
</form> | |||||
{{else}} | |||||
<a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" | <a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" | ||||
class='ui basic ai_stop {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "SUCCEEDED" "STOPPED" "STOPPING" "CREATE_FAILED"}}disabled {{else}} blue {{end}}button' | |||||
data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else if eq .JobType "BENCHMARK" }}/cloudbrain/benchmark{{else if eq .ComputeResource "NPU" }}/modelarts/notebook{{end}}/{{$JobID}}/stop' | |||||
data-jobid="{{$JobID}}"> | |||||
class='ui basic ai_stop_version {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "STOPPED" "SUCCEEDED" "CREATE_FAILED"}}disabled {{else}} blue {{end}}button' | |||||
data-repopath='{{.Repo.OwnerName}}/{{.Repo.Name}}/{{if eq .JobType "INFERENCE"}}{{if eq .Cloudbrain.Type 1}}modelarts/inference-job{{else}}cloudbrain/train-job{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .Cloudbrain.Type 1}}modelarts/train-job{{else if eq .Cloudbrain.Type 0}}cloudbrain/train-job{{else if eq .Cloudbrain.Type 2}}grampus/train-job{{end}}{{end}}' | |||||
data-jobid="{{$JobID}}" data-version="{{.VersionName}}"> | |||||
{{$.i18n.Tr "repo.stop"}} | {{$.i18n.Tr "repo.stop"}} | ||||
</a> | </a> | ||||
</form> | |||||
{{else}} | |||||
<a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" | |||||
class='ui basic ai_stop_version {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "STOPPED" "SUCCEEDED" "CREATE_FAILED"}}disabled {{else}} blue {{end}}button' | |||||
data-repopath='{{.Repo.OwnerName}}/{{.Repo.Name}}/{{if eq .JobType "INFERENCE"}}{{if eq .Cloudbrain.Type 1}}modelarts/inference-job{{else}}cloudbrain/train-job{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .Cloudbrain.Type 1}}modelarts/train-job{{else if eq .Cloudbrain.Type 0}}cloudbrain/train-job{{else if eq .Cloudbrain.Type 2}}grampus/train-job{{end}}{{end}}' | |||||
data-jobid="{{$JobID}}" data-version="{{.VersionName}}"> | |||||
{{$.i18n.Tr "repo.stop"}} | |||||
</a> | |||||
{{end}} | |||||
{{end}} | {{end}} | ||||
</div> | </div> | ||||
{{if eq .JobType "BENCHMARK"}} | {{if eq .JobType "BENCHMARK"}} | ||||
@@ -228,7 +256,6 @@ | |||||
{{$.i18n.Tr "repo.score"}} | {{$.i18n.Tr "repo.score"}} | ||||
</a> | </a> | ||||
</div> | </div> | ||||
{{end}} | {{end}} | ||||
<!-- 修改任务 --> | <!-- 修改任务 --> | ||||
{{if eq .JobType "TRAIN"}} | {{if eq .JobType "TRAIN"}} | ||||
@@ -239,6 +266,18 @@ | |||||
</div> | </div> | ||||
{{end}} | {{end}} | ||||
<!-- 删除任务 --> | <!-- 删除任务 --> | ||||
{{if eq .JobType "MODELSAFETY"}} | |||||
<form class="ui compact buttons" id="delForm-{{$JobID}}" | |||||
action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/modelsafety/{{$JobID}}/del?ishomepage=true' | |||||
method="post"> | |||||
{{$.CsrfTokenHtml}} | |||||
<a style="padding: 0.5rem 1rem;margin-left:0.2rem" id="ai-delete-{{$JobID}}" | |||||
class="ui basic ai_delete blue button" | |||||
style="border-radius: .28571429rem;"> | |||||
{{$.i18n.Tr "repo.delete"}} | |||||
</a> | |||||
</form> | |||||
{{else}} | |||||
<form class="ui compact buttons" id="delForm-{{$JobID}}" | <form class="ui compact buttons" id="delForm-{{$JobID}}" | ||||
action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "BENCHMARK"}}/cloudbrain/benchmark{{else if or (eq .JobType "SNN4IMAGENET") (eq .JobType "BRAINSCORE")}}/cloudbrain{{else if eq .JobType "DEBUG"}}{{if eq .ComputeResource "NPU"}}/modelarts/notebook{{else}}/cloudbrain{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .Cloudbrain.Type 1}}/modelarts/train-job{{else if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{else if eq .Cloudbrain.Type 2}}/grampus/train-job{{end}}{{else if eq .JobType "INFERENCE"}}{{if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{end}}{{end}}/{{$JobID}}/del?ishomepage=true' | action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "BENCHMARK"}}/cloudbrain/benchmark{{else if or (eq .JobType "SNN4IMAGENET") (eq .JobType "BRAINSCORE")}}/cloudbrain{{else if eq .JobType "DEBUG"}}{{if eq .ComputeResource "NPU"}}/modelarts/notebook{{else}}/cloudbrain{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .Cloudbrain.Type 1}}/modelarts/train-job{{else if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{else if eq .Cloudbrain.Type 2}}/grampus/train-job{{end}}{{else if eq .JobType "INFERENCE"}}{{if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{end}}{{end}}/{{$JobID}}/del?ishomepage=true' | ||||
method="post"> | method="post"> | ||||
@@ -250,6 +289,8 @@ | |||||
{{$.i18n.Tr "repo.delete"}} | {{$.i18n.Tr "repo.delete"}} | ||||
</a> | </a> | ||||
</form> | </form> | ||||
{{end}} | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
@@ -377,19 +418,18 @@ | |||||
</div> | </div> | ||||
{{end}} | {{end}} | ||||
{{end}} | |||||
<div id="app" style="margin-top: 2rem;"> | |||||
<div class="center"> | |||||
<el-pagination background @current-change="handleCurrentChange" :current-page="page" | |||||
:page-sizes="[10]" :page-size="10" layout="total, sizes, prev, pager, next, jumper" | |||||
:total="{{.Page.Paginater.Total}}"> | |||||
</el-pagination> | |||||
</div> | |||||
</div> | |||||
{{end}} | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | |||||
</div> | |||||
<div id="app" style="margin-top: 2rem;margin-bottom: 2rem;"> | |||||
<div class="center"> | |||||
<el-pagination background @current-change="handleCurrentChange" :current-page="page" | |||||
:page-sizes="[10]" :page-size="10" layout="total, sizes, prev, pager, next, jumper" | |||||
:total="{{.Page.Paginater.Total}}"> | |||||
</el-pagination> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
<!-- 确认模态框 --> | <!-- 确认模态框 --> | ||||
@@ -47,6 +47,7 @@ | |||||
type="text" | type="text" | ||||
:placeholder="i18n.image_search_placeholder" | :placeholder="i18n.image_search_placeholder" | ||||
v-model="search" | v-model="search" | ||||
@keydown.enter.stop.prevent="searchName" | |||||
/> | /> | ||||
</div> | </div> | ||||
<el-tabs v-model="activeName" @tab-click="handleClick"> | <el-tabs v-model="activeName" @tab-click="handleClick"> | ||||
@@ -21,16 +21,16 @@ | |||||
</div> | </div> | ||||
</div> | </div> | ||||
<div class="table-container"> | <div class="table-container"> | ||||
<div style="min-height:600px;"> | |||||
<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"> | |||||
<div style="min-height:600px;overflow-x:auto;"> | |||||
<el-table border :data="tableData" style="width:100%;" v-loading="loading" stripe> | |||||
<el-table-column prop="ID" label="ID" align="center" header-align="center" width="60" fixed></el-table-column> | |||||
<el-table-column prop="SpecStr" :label="$t('resourcesManagement.resourceSpecification')" align="left" fixed | |||||
header-align="center" min-width="200"> | |||||
</el-table-column> | </el-table-column> | ||||
<el-table-column prop="QueueInfo" :label="$t('resourcesManagement.resQueue')" align="center" | |||||
<el-table-column prop="QueueInfo" :label="$t('resourcesManagement.resQueue')" align="center" fixed | |||||
header-align="center" min-width="100"> | header-align="center" min-width="100"> | ||||
</el-table-column> | </el-table-column> | ||||
<el-table-column prop="SourceSpecId" :label="$t('resourcesManagement.sourceSpecCode')" align="center" | |||||
<el-table-column prop="SourceSpecId" :label="$t('resourcesManagement.sourceSpecCode')" align="center" min-width="120" | |||||
header-align="center"> | header-align="center"> | ||||
</el-table-column> | </el-table-column> | ||||
<el-table-column prop="AccCardsNum" :label="$t('resourcesManagement.accCardsNum')" align="center" | <el-table-column prop="AccCardsNum" :label="$t('resourcesManagement.accCardsNum')" align="center" | ||||
@@ -43,7 +43,7 @@ | |||||
header-align="center"></el-table-column> | header-align="center"></el-table-column> | ||||
<el-table-column prop="ShareMemGiB" :label="`${$t('resourcesManagement.shareMem')}(GB)`" align="center" | <el-table-column prop="ShareMemGiB" :label="`${$t('resourcesManagement.shareMem')}(GB)`" align="center" | ||||
header-align="center"></el-table-column> | header-align="center"></el-table-column> | ||||
<el-table-column prop="UpdatedTimeStr" :label="$t('resourcesManagement.lastUpdateTime')" align="center" | |||||
<el-table-column prop="UpdatedTimeStr" :label="$t('resourcesManagement.lastUpdateTime')" align="center" min-width="140" | |||||
header-align="center"></el-table-column> | header-align="center"></el-table-column> | ||||
<el-table-column prop="UnitPrice" | <el-table-column prop="UnitPrice" | ||||
:label="`${$t('resourcesManagement.unitPrice')}(${$t('resourcesManagement.point_hr')})`" align="center" | :label="`${$t('resourcesManagement.unitPrice')}(${$t('resourcesManagement.point_hr')})`" align="center" | ||||