Merge remote-tracking branch 'origin/master'
Former-commit-id: c2e19df4b8281893d5774b55754547b12e3e5ec9
This commit is contained in:
commit
0ab53fa6ca
|
@ -7,142 +7,6 @@ info(
|
|||
email: "450705171@qq.com"
|
||||
)
|
||||
|
||||
type (
|
||||
submitJobReq {
|
||||
SlurmVersion string `json:"slurmVersion"`
|
||||
|
||||
/****************parmas from ac********************/
|
||||
Apptype string `json:"apptype,optional"`
|
||||
Appname string `json:"appname,optional"`
|
||||
StrJobManagerID int64 `json:"strJobManagerID,optional"`
|
||||
MapAppJobInfo MapAppJobInfo `json:"mapAppJobInfo,optional"`
|
||||
/****************parmas from ac********************/
|
||||
|
||||
Account string `json:"account,optional"` //
|
||||
Acctg_freq string `json:"acctg_freq,optional"`
|
||||
Alloc_node string `json:"alloc_node,optional"`
|
||||
Alloc_resp_port int32 `json:"alloc_resp_port,optional"`
|
||||
Alloc_sid int32 `json:"alloc_sid,optional"`
|
||||
Argc int32 `json:"argc,optional"`
|
||||
Argv []Argv `json:"Argv,optional"`
|
||||
Array_inx string `json:"array_inx,optional"`
|
||||
Begin_time int64 `json:"begin_time,optional"`
|
||||
Ckpt_interval int32 `json:"ckpt_interval,optional"`
|
||||
Ckpt_dir string `json:"ckpt_dir,optional"`
|
||||
Comment string `json:"comment,optional"`
|
||||
Contiguous int32 `json:"contiguous,optional"`
|
||||
Cpu_bind string `json:"cpu_bind,optional"`
|
||||
Cpu_bind_type int32 `json:"cpu_bind_type,optional"`
|
||||
Dependency string `json:"dependency,optional"`
|
||||
End_time int64 `json:"end_time,optional"`
|
||||
Environment []Environment `json:"Environment,optional"`
|
||||
Env_size int32 `json:"env_size,optional"`
|
||||
Exc_nodes string `json:"exc_nodes,optional"`
|
||||
Features string `json:"features,optional"`
|
||||
Gres string `json:"gres,optional"`
|
||||
Group_id int32 `json:"group_id,optional"`
|
||||
Immediate int32 `json:"immediate,optional"`
|
||||
Job_id int32 `json:"job_id,optional"`
|
||||
Kill_on_node_fail int32 `json:"kill_on_node_fail,optional"`
|
||||
Licenses string `json:"licenses,optional"`
|
||||
Mail_type int32 `json:"mail_type,optional"`
|
||||
Mail_user string `json:"mail_user,optional"`
|
||||
Mem_bind string `json:"mem_bind,optional"`
|
||||
Mem_bind_type int32 `json:"mem_bind_type,optional"`
|
||||
Name string `json:"name,optional"` //
|
||||
Network string `json:"network,optional"`
|
||||
Nice int32 `json:"nice,optional"`
|
||||
Num_tasks int32 `json:"num_tasks,optional"`
|
||||
Open_mode int32 `json:"open_mode,optional"`
|
||||
Other_port int32 `json:"other_port,optional"`
|
||||
Overcommit int32 `json:"overcommit,optional"`
|
||||
Partition string `json:"partition,optional"`
|
||||
Plane_size int32 `json:"plane_size,optional"`
|
||||
Priority int32 `json:"priority,optional"`
|
||||
Profile int32 `json:"profile,optional"`
|
||||
Qos string `json:"qos,optional"`
|
||||
Resp_host string `json:"resp_host,optional"`
|
||||
Req_nodes string `json:"req_nodes,optional"`
|
||||
Requeue int32 `json:"requeue,optional"`
|
||||
Reservation string `json:"reservation,optional"`
|
||||
Script string `json:"script,optional"` //
|
||||
Shared int32 `json:"shared,optional"`
|
||||
Spank_job_env_size int32 `json:"spank_job_env_size,optional"`
|
||||
Task_dist int32 `json:"task_dist,optional"`
|
||||
Time_limit int32 `json:"time_limit,optional"`
|
||||
Time_min int32 `json:"time_min,optional"`
|
||||
User_id int32 `json:"user_id,optional"` //
|
||||
Wait_all_nodes int32 `json:"wait_all_nodes,optional"`
|
||||
Warn_signal int32 `json:"warn_signal,optional"`
|
||||
Warn_time int32 `json:"warn_time,optional"`
|
||||
Work_dir string `json:"work_dir,optional"`
|
||||
Cpus_per_task int32 `json:"cpus_per_task,optional"`
|
||||
Min_cpus int32 `json:"min_cpus,optional"` //
|
||||
Max_cpus int32 `json:"max_cpus,optional"`
|
||||
Min_nodes int32 `json:"min_nodes,optional"`
|
||||
Max_nodes int32 `json:"max_nodes,optional"`
|
||||
Boards_per_node int32 `json:"boards_per_node,optional"`
|
||||
Sockets_per_board int32 `json:"sockets_per_board,optional"`
|
||||
Sockets_per_node int32 `json:"sockets_per_node,optional"`
|
||||
Cores_per_socket int32 `json:"cores_per_socket,optional"`
|
||||
Threads_per_core int32 `json:"threads_per_core,optional"`
|
||||
Ntasks_per_node int32 `json:"ntasks_per_node,optional"`
|
||||
Ntasks_per_socket int32 `json:"ntasks_per_socket,optional"`
|
||||
Ntasks_per_core int32 `json:"ntasks_per_core,optional"`
|
||||
Ntasks_per_board int32 `json:"ntasks_per_board,optional"`
|
||||
Pn_min_cpus int32 `json:"pn_min_cpus,optional"`
|
||||
Pn_min_memory int32 `json:"pn_min_memory,optional"`
|
||||
Pn_min_tmp_disk int32 `json:"pn_min_tmp_disk,optional"`
|
||||
Reboot int32 `json:"reboot,optional"`
|
||||
Rotate int32 `json:"rotate,optional"`
|
||||
Req_switch int32 `json:"req_switch,optional"`
|
||||
Std_err string `json:"std_err,optional"`
|
||||
Std_in string `json:"std_in,optional"`
|
||||
Std_out string `json:"std_out,optional"`
|
||||
Wait4switch int32 `json:"wait4switch,optional"`
|
||||
Wckey string `json:"wckey,optional"`
|
||||
}
|
||||
|
||||
submitJobResp {
|
||||
//Job_id int32 `json:"job_id"`
|
||||
//Step_id int32 `json:"step_id"`
|
||||
//Error_code int32 `json:"error_code"`
|
||||
|
||||
Code string `json:"code"` //Error_code 返回码 in Tianhe
|
||||
Msg string `json:"msg"`
|
||||
Data string `json:"data"` //Job_id 作业id in Tianhe
|
||||
}
|
||||
|
||||
MapAppJobInfo {
|
||||
GAP_CMD_FILE string `json:"GAP_CMD_FILE"` //命令行内容
|
||||
GAP_NNODE string `json:"GAP_NNODE"` //节点个数(当指定该参数时,GAP_NODE_STRING必须为"")
|
||||
GAP_NODE_STRING string `json:"GAP_NODE_STRING,optional"` //指定节点(当指定该参数时,GAP_NNODE必须为"")
|
||||
GAP_SUBMIT_TYPE string `json:"GAP_SUBMIT_TYPE"` //cmd(命令行模式)
|
||||
GAP_JOB_NAME string `json:"GAP_JOB_NAME"` //作业名称
|
||||
GAP_WORK_DIR string `json:"GAP_WORK_DIR"` //工作路径
|
||||
GAP_QUEUE string `json:"GAP_QUEUE"` //队列名称
|
||||
GAP_NPROC string `json:"GAP_NPROC,optional"` //总核心数(GAP_NPROC和GAP_PPN选其一填写)
|
||||
GAP_PPN string `json:"GAP_PPN,optional"` //CPU核心/节点(GAP_NPROC和GAP_PPN选其一填写)
|
||||
GAP_NGPU string `json:"GAP_NGPU,optional"` //GPU卡数/节点
|
||||
GAP_NDCU string `json:"GAP_NDCU,optional"` //DCU卡数/节点
|
||||
GAP_JOB_MEM string `json:"GAP_JOB_MEM,optional"` //每个节点内存值,单位为MB/GB
|
||||
GAP_WALL_TIME string `json:"GAP_WALL_TIME"` //最大运行时长(HH:MM:ss)
|
||||
GAP_EXCLUSIVE string `json:"GAP_EXCLUSIVE,optional"` // 是否独占节点,1为独占,空为非独占
|
||||
GAP_APPNAME string `json:"GAP_APPNAME"` //BASE(基础应用),支持填写具体的应用英文名称
|
||||
GAP_MULTI_SUB string `json:"GAP_MULTI_SUB,optional"` //作业组长度,建议为小于等于50的正整数
|
||||
GAP_STD_OUT_FILE string `json:"GAP_STD_OUT_FILE"` //工作路径/std.out.%j
|
||||
GAP_STD_ERR_FILE string `json:"GAP_STD_ERR_FILE"` //工作路径/std.err.%j
|
||||
}
|
||||
|
||||
Argv {
|
||||
Argv string `json:"argv,optional"`
|
||||
}
|
||||
|
||||
Environment {
|
||||
Environment string `json:"environment,optional"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
getRegionResp {
|
||||
Code int32 `json:"code"`
|
||||
|
@ -163,6 +27,7 @@ type (
|
|||
cpu float32 `json:"cpu"`
|
||||
memory float32 `json:"memory"`
|
||||
storage float32 `json:"storage"`
|
||||
centerType string `json:"centerType"`
|
||||
}
|
||||
)
|
||||
type (
|
||||
|
@ -220,36 +85,6 @@ type (
|
|||
}
|
||||
)
|
||||
|
||||
type (
|
||||
commitHpcTaskReq {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,optional"`
|
||||
tenantId int64 `json:"tenantId,optional"`
|
||||
TaskId int64 `json:"taskId,optional"`
|
||||
participantId int64 `json:"participantId,optional"`
|
||||
matchLabels map[string]string `json:"matchLabels,optional"`
|
||||
cardCount int64 `json:"cardCount,optional"`
|
||||
workDir string `json:"workDir,optional"`
|
||||
wallTime string `json:"wallTime,optional"`
|
||||
cmdScript string `json:"cmdScript,optional"`
|
||||
appType string `json:"appType,optional"`
|
||||
appName string `json:"appName,optional"`
|
||||
queue string `json:"queue,optional"`
|
||||
nNode string `json:"nNode,optional"`
|
||||
submitType string `json:"submitType,optional"`
|
||||
stdOutFile string `json:"stdOutFile,optional"`
|
||||
stdErrFile string `json:"stdErrFile,optional"`
|
||||
stdInput string `json:"stdInput,optional"`
|
||||
environment map[string]string `json:"environment,optional"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
commitHpcTaskResp {
|
||||
TaskId int64 `json:"taskId"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
commitVmTaskReq {
|
||||
server ServerCommit `json:"server,optional"`
|
||||
|
@ -726,8 +561,8 @@ type (
|
|||
)
|
||||
|
||||
type ClusterReq {
|
||||
Id string `json:"id,optional"`
|
||||
AdapterId string `json:"adapterId,optional"`
|
||||
Id string `form:"id,optional"`
|
||||
AdapterId string `form:"adapterId,optional"`
|
||||
Name string `json:"name,optional"`
|
||||
Nickname string `json:"nickname,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
|
@ -819,3 +654,114 @@ type ClusterRelationInfo {
|
|||
CAuthType string `json:"cAuthType,omitempty" db:"auth_type"`
|
||||
CCreateTime string `json:"cCreateTime,omitempty" db:"created_time" gorm:"autoCreateTime"`
|
||||
}
|
||||
|
||||
type (
|
||||
DictInfo {
|
||||
Id string `json:"id,omitempty"`
|
||||
DictName string `json:"dictName,omitempty"`
|
||||
DictCode string `json:"dictCode,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Type string `json:"type,omitempty" db:"type"`
|
||||
Status string `json:"status,omitempty" db:"status"`
|
||||
CreateTime string `json:"createTime,omitempty" db:"created_time" gorm:"autoCreateTime"`
|
||||
}
|
||||
|
||||
DictReq {
|
||||
Id string `form:"id,optional"`
|
||||
DictName string `form:"dictName,optional"`
|
||||
DictCode string `form:"dictCode,optional"`
|
||||
Description string `form:"description,optional"`
|
||||
Type string `form:"type,optional"`
|
||||
Status string `form:"status,optional"`
|
||||
}
|
||||
|
||||
DictEditReq {
|
||||
Id string `json:"id,optional"`
|
||||
DictName string `json:"dictName,optional"`
|
||||
DictCode string `json:"dictCode,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
Type string `json:"type,optional"`
|
||||
Status string `json:"status,optional"`
|
||||
}
|
||||
|
||||
DictResp {
|
||||
Id string `json:"id,omitempty"`
|
||||
DictName string `json:"dictName,omitempty"`
|
||||
DictCode string `json:"dictCode,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
CreateTime string `json:"createTime,omitempty" db:"created_time" gorm:"autoCreateTime"`
|
||||
DictItemInfo []*DictItemInfo `json:"dictItemInfo,omitempty"`
|
||||
}
|
||||
|
||||
Dicts {
|
||||
List []DictInfo `json:"list,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
DictItemInfo {
|
||||
Id string `json:"id,omitempty"`
|
||||
DictId string `json:"dictId,omitempty"`
|
||||
ItemText string `json:"itemText,omitempty"`
|
||||
ItemValue string `json:"itemValue,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
SortOrder string `json:"sortOrder,omitempty"`
|
||||
Type string `json:"type,omitempty" db:"type"`
|
||||
ParentId string `json:"parentId,omitempty"`
|
||||
Status string `json:"status,omitempty" db:"status"`
|
||||
CreateTime string `json:"createTime,omitempty" db:"created_time" gorm:"autoCreateTime"`
|
||||
}
|
||||
|
||||
DictItemReq {
|
||||
Id string `form:"id,optional"`
|
||||
DictId string `form:"dictId,optional"`
|
||||
ItemText string `form:"itemText,optional"`
|
||||
ItemValue string `form:"itemValue,optional"`
|
||||
Description string `form:"description,optional"`
|
||||
SortOrder string `form:"sortOrder,optional"`
|
||||
Type string `form:"type,optional"`
|
||||
ParentId string `form:"parentId,optional"`
|
||||
Status string `form:"status,optional"`
|
||||
}
|
||||
|
||||
DictItemEditReq {
|
||||
Id string `json:"id,optional"`
|
||||
DictId string `json:"dictId,optional"`
|
||||
ItemText string `json:"itemText,optional"`
|
||||
ItemValue string `json:"itemValue,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
SortOrder string `json:"sortOrder,optional"`
|
||||
Type string `json:"type,optional"`
|
||||
ParentId string `json:"parentId,optional"`
|
||||
Status string `json:"status,optional"`
|
||||
}
|
||||
|
||||
DictItemResp {
|
||||
Id string `json:"id,omitempty"`
|
||||
DictId string `json:"dictId,omitempty"`
|
||||
ItemText string `json:"itemText,omitempty"`
|
||||
ItemValue string `json:"itemValue,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
SortOrder string `json:"sortOrder,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
ParentId string `json:"parentId,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
CreateTime string `json:"createTime,omitempty" db:"created_time" gorm:"autoCreateTime"`
|
||||
DictInfo *DictInfo `json:"dictInfo,omitempty"`
|
||||
}
|
||||
|
||||
DictItems {
|
||||
List []DictItemInfo `json:"list,omitempty"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
CId {
|
||||
Id string `path:"id":"id,omitempty" validate:"required"`
|
||||
}
|
||||
|
||||
CIds {
|
||||
Ids []string `json:"ids,omitempty" validate:"required"`
|
||||
}
|
||||
)
|
|
@ -16,6 +16,37 @@ type Job {
|
|||
StateofJob string `json:"StateofJob"`
|
||||
}
|
||||
|
||||
|
||||
type (
|
||||
commitHpcTaskReq {
|
||||
Name string `json:"name"` // paratera:jobName
|
||||
Description string `json:"description,optional"`
|
||||
tenantId int64 `json:"tenantId,optional"`
|
||||
TaskId int64 `json:"taskId,optional"`
|
||||
participantId int64 `json:"participantId,optional"`
|
||||
matchLabels map[string]string `json:"matchLabels,optional"`
|
||||
cardCount int64 `json:"cardCount,optional"`
|
||||
workDir string `json:"workDir,optional"` //paratera:workingDir
|
||||
wallTime string `json:"wallTime,optional"`
|
||||
cmdScript string `json:"cmdScript,optional"` // paratera:bootScript
|
||||
appType string `json:"appType,optional"`
|
||||
appName string `json:"appName,optional"` // paratera:jobGroupName ac:appname
|
||||
queue string `json:"queue,optional"`
|
||||
nNode string `json:"nNode,optional"`
|
||||
submitType string `json:"submitType,optional"`
|
||||
stdOutFile string `json:"stdOutFile,optional"`
|
||||
stdErrFile string `json:"stdErrFile,optional"`
|
||||
stdInput string `json:"stdInput,optional"`
|
||||
environment map[string]string `json:"environment,optional"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
commitHpcTaskResp {
|
||||
TaskId int64 `json:"taskId"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
listJobReq {
|
||||
}
|
||||
|
|
|
@ -37,10 +37,6 @@ service pcm {
|
|||
@handler commitTaskHandler
|
||||
post /core/commitTask (commitTaskReq)
|
||||
|
||||
@doc "提交超算任务"
|
||||
@handler commitHpcTaskHandler
|
||||
post /core/commitHpcTask (commitHpcTaskReq) returns (commitHpcTaskResp)
|
||||
|
||||
@doc "提交虚拟机任务"
|
||||
@handler commitVmTaskHandler
|
||||
post /core/commitVmTask (commitVmTaskReq) returns (commitVmTaskResp)
|
||||
|
@ -69,10 +65,6 @@ service pcm {
|
|||
@handler listClusterHandler
|
||||
get /core/listCluster/:centerId (listClusterReq) returns (listClusterResp)
|
||||
|
||||
@doc "提交任务(超算)"
|
||||
@handler submitJobHandler
|
||||
post /core/submitJob (submitJobReq) returns (submitJobResp)
|
||||
|
||||
@doc "获取region"
|
||||
@handler getRegionHandler
|
||||
get /core/getRegion returns (getRegionResp)
|
||||
|
@ -120,6 +112,10 @@ service pcm {
|
|||
group : hpc
|
||||
)
|
||||
service pcm {
|
||||
@doc "提交超算任务"
|
||||
@handler commitHpcTaskHandler
|
||||
post /hpc/commitHpcTask (commitHpcTaskReq) returns (commitHpcTaskResp)
|
||||
|
||||
@doc "超算查询任务列表"
|
||||
@handler listJobHandler
|
||||
get /hpc/listJob (listJobReq) returns (listJobResp)
|
||||
|
@ -130,7 +126,7 @@ service pcm {
|
|||
|
||||
@doc "超算查询资产列表"
|
||||
@handler queueAssetsHandler
|
||||
get /queue/assets returns (QueueAssetsResp)
|
||||
get /hpc/queueAssets returns (QueueAssetsResp)
|
||||
}
|
||||
|
||||
//cloud二级接口
|
||||
|
@ -866,4 +862,41 @@ service pcm {
|
|||
|
||||
@handler ScheduleSubmitHandler
|
||||
post /schedule/submit (ScheduleReq) returns (ScheduleResp)
|
||||
}
|
||||
|
||||
@server(
|
||||
prefix: pcm/v1
|
||||
group : dictionary
|
||||
)
|
||||
|
||||
service pcm {
|
||||
@handler GetDict
|
||||
get /dict/:id (CId) returns (DictResp)
|
||||
|
||||
@handler ListDict
|
||||
get /dicts (DictReq) returns (Dicts)
|
||||
|
||||
@handler AddDict
|
||||
post /dict (DictEditReq) returns (DictResp)
|
||||
|
||||
@handler EditDict
|
||||
put /dict (DictEditReq) returns (DictResp)
|
||||
|
||||
@handler DeleteDict
|
||||
delete /dict/:id (CId) returns (DictResp)
|
||||
|
||||
@handler GetDictItem
|
||||
get /dictItem/:id (CId) returns (DictItemResp)
|
||||
|
||||
@handler ListDictItem
|
||||
get /dictItems (DictItemReq) returns (DictItems)
|
||||
|
||||
@handler AddDictItem
|
||||
post /dictItem (DictItemEditReq) returns (DictItemResp)
|
||||
|
||||
@handler EditDictItem
|
||||
put /dictItem (DictItemEditReq) returns (DictItemResp)
|
||||
|
||||
@handler DeleteDictItem
|
||||
delete /dictItem/:id (CId) returns (DictItemResp)
|
||||
}
|
|
@ -5,7 +5,7 @@ Port: 8999
|
|||
Timeout: 50000
|
||||
|
||||
DB:
|
||||
DataSource: root:uJpLd6u-J?HC1@(10.206.0.12:3306)/pcm?parseTime=true&loc=Local
|
||||
DataSource: root:uJpLd6u-J?HC1@(47.92.88.143:3306)/pcm?parseTime=true&loc=Local
|
||||
|
||||
Redis:
|
||||
Host: 10.206.0.12:6379
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) [2023] [pcm]
|
||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
You may obtain a copy of Mulan PSL v2 at:
|
||||
http://license.coscl.org.cn/MulanPSL2
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
See the Mulan PSL v2 for more details.
|
||||
|
||||
*/
|
||||
|
||||
package core
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func SubmitJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.SubmitJobReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := core.NewSubmitJobLogic(r.Context(), svcCtx)
|
||||
resp, err := l.SubmitJob(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func AddDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DictEditReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := dictionary.NewAddDictLogic(r.Context(), svcCtx)
|
||||
resp, err := l.AddDict(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func AddDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DictItemEditReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := dictionary.NewAddDictItemLogic(r.Context(), svcCtx)
|
||||
resp, err := l.AddDictItem(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func DeleteDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CId
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := dictionary.NewDeleteDictLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DeleteDict(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func DeleteDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CId
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := dictionary.NewDeleteDictItemLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DeleteDictItem(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func EditDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DictEditReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := dictionary.NewEditDictLogic(r.Context(), svcCtx)
|
||||
resp, err := l.EditDict(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func EditDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DictItemEditReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := dictionary.NewEditDictItemLogic(r.Context(), svcCtx)
|
||||
resp, err := l.EditDictItem(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func GetDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CId
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := dictionary.NewGetDictLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetDict(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func GetDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CId
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := dictionary.NewGetDictItemLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetDictItem(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func ListDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DictReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := dictionary.NewListDictLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ListDict(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func ListDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DictItemReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := dictionary.NewListDictItemLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ListDictItem(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
package core
|
||||
package hpc
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
@ -17,7 +17,7 @@ func CommitHpcTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||
return
|
||||
}
|
||||
|
||||
l := core.NewCommitHpcTaskLogic(r.Context(), svcCtx)
|
||||
l := hpc.NewCommitHpcTaskLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CommitHpcTask(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
|
@ -9,6 +9,7 @@ import (
|
|||
apps "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/apps"
|
||||
cloud "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/cloud"
|
||||
core "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/core"
|
||||
dictionary "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/dictionary"
|
||||
hpc "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/hpc"
|
||||
image "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/image"
|
||||
schedule "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/schedule"
|
||||
|
@ -1076,4 +1077,60 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||
},
|
||||
rest.WithPrefix("/pcm/v1"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/dict/:id",
|
||||
Handler: dictionary.GetDictHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/dicts",
|
||||
Handler: dictionary.ListDictHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/dict",
|
||||
Handler: dictionary.AddDictHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPut,
|
||||
Path: "/dict",
|
||||
Handler: dictionary.EditDictHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/dict/:id",
|
||||
Handler: dictionary.DeleteDictHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/dictItem/:id",
|
||||
Handler: dictionary.GetDictItemHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/dictItems",
|
||||
Handler: dictionary.ListDictItemHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/dictItem",
|
||||
Handler: dictionary.AddDictItemHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPut,
|
||||
Path: "/dictItem",
|
||||
Handler: dictionary.EditDictItemHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/dictItem/:id",
|
||||
Handler: dictionary.DeleteDictItemHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/pcm/v1"),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -26,7 +26,11 @@ func NewClusterListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Clust
|
|||
|
||||
func (l *ClusterListLogic) ClusterList(req *types.ClusterReq) (resp *types.ClusterListResp, err error) {
|
||||
resp = &types.ClusterListResp{}
|
||||
|
||||
sql := fmt.Sprintf(`select c.* from t_cluster c left join t_adapter a on c.adapter_id = a.id where c.deleted_at is null`)
|
||||
if req.AdapterId != "" {
|
||||
sql = fmt.Sprintf(`select * from t_cluster where adapter_id = %s and deleted_at is null `, req.AdapterId)
|
||||
}
|
||||
if req.Type != "" {
|
||||
sql = fmt.Sprintf(`select c.* from t_cluster c left join t_adapter a on c.adapter_id = a.id where c.deleted_at is null and a.type = %s`, req.Type)
|
||||
}
|
||||
|
|
|
@ -26,22 +26,25 @@ func NewCenterResourcesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *C
|
|||
func (l *CenterResourcesLogic) CenterResources() (resp *types.CenterResourcesResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
centerIndex1 := types.CenterIndex{
|
||||
Name: "阿里云",
|
||||
Cpu: float32(12.33),
|
||||
Memory: float32(64.55),
|
||||
Storage: float32(33.90),
|
||||
Name: "阿里云",
|
||||
Cpu: float32(12.33),
|
||||
Memory: float32(64.55),
|
||||
Storage: float32(33.90),
|
||||
CenterType: "cloud",
|
||||
}
|
||||
centerIndex2 := types.CenterIndex{
|
||||
Name: "A超算中心",
|
||||
Cpu: float32(42.36),
|
||||
Memory: float32(66.55),
|
||||
Storage: float32(23.231),
|
||||
Name: "A超算中心",
|
||||
Cpu: float32(42.36),
|
||||
Memory: float32(66.55),
|
||||
Storage: float32(23.231),
|
||||
CenterType: "hpc",
|
||||
}
|
||||
centerIndex3 := types.CenterIndex{
|
||||
Name: "智算中心",
|
||||
Cpu: float32(78.33),
|
||||
Memory: float32(36.55),
|
||||
Storage: float32(88.93),
|
||||
Name: "智算中心",
|
||||
Cpu: float32(78.33),
|
||||
Memory: float32(36.55),
|
||||
Storage: float32(88.93),
|
||||
CenterType: "ai",
|
||||
}
|
||||
resp = &types.CenterResourcesResp{}
|
||||
resp.CentersIndex = append(resp.CentersIndex, centerIndex1)
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) [2023] [pcm]
|
||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
You may obtain a copy of Mulan PSL v2 at:
|
||||
http://license.coscl.org.cn/MulanPSL2
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
See the Mulan PSL v2 for more details.
|
||||
|
||||
*/
|
||||
|
||||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
slurmClient "gitlink.org.cn/JointCloud/pcm-slurm/slurmclient"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-ac/hpcAC"
|
||||
"strconv"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type SubmitJobLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewSubmitJobLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SubmitJobLogic {
|
||||
return &SubmitJobLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *SubmitJobLogic) SubmitJob(req *types.SubmitJobReq) (resp *types.SubmitJobResp, err error) {
|
||||
|
||||
coreResp := &types.SubmitJobResp{}
|
||||
|
||||
version := req.SlurmVersion
|
||||
switch version {
|
||||
case "ac":
|
||||
acReq := &hpcAC.SubmitJobReq{}
|
||||
err = copier.CopyWithOption(acReq, req, copier.Option{Converters: utils.Converters})
|
||||
acResp, err := l.svcCtx.ACRpc.SubmitJob(l.ctx, acReq)
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("Failed to submit job to AC"), "Failed to submit job to Shuguang err : %v ,req:%+v", err, req)
|
||||
}
|
||||
|
||||
if acResp.Data == "" {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("Failed to submit job to AC, job id is empty"), "Failed to submit job to Shuguang err : %v", err)
|
||||
}
|
||||
|
||||
coreResp.Msg = acResp.Msg
|
||||
coreResp.Code = acResp.Code
|
||||
coreResp.Data = acResp.Data
|
||||
|
||||
case "th":
|
||||
thReq := &slurmClient.SubmitJobReq{}
|
||||
err = copier.CopyWithOption(thReq, req, copier.Option{Converters: utils.Converters})
|
||||
tianheResp, err := l.svcCtx.THRpc.SubmitJob(l.ctx, thReq)
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("Failed to submit job to Tianhe"), "Failed to submit job to Tianhe err : %v ,req:%+v", err, req)
|
||||
}
|
||||
|
||||
coreResp.Msg = "success"
|
||||
coreResp.Code = strconv.Itoa(200)
|
||||
coreResp.Data = strconv.Itoa(int(tianheResp.JobId))
|
||||
}
|
||||
|
||||
return coreResp, nil
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type AddDictItemLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewAddDictItemLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddDictItemLogic {
|
||||
return &AddDictItemLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *AddDictItemLogic) AddDictItem(req *types.DictItemEditReq) (resp *types.DictItemResp, err error) {
|
||||
dict := &types.DictInfo{}
|
||||
result := l.svcCtx.DbEngin.Table("t_dict").First(&dict, req.DictId)
|
||||
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return nil, errors.New("Dictionary does not exist")
|
||||
}
|
||||
var dictItem types.DictItemInfo
|
||||
dictItem.DictId = req.DictId
|
||||
dictItem.ItemText = req.ItemText
|
||||
dictItem.ItemValue = req.ItemValue
|
||||
dictItem.Description = req.Description
|
||||
dictItem.SortOrder = req.SortOrder
|
||||
dictItem.Type = req.Type
|
||||
if req.ParentId != "" {
|
||||
dictItem.ParentId = req.ParentId
|
||||
}
|
||||
dictItem.ParentId = "0"
|
||||
dictItem.Status = req.Status
|
||||
dictItem.Id = utils.GenSnowflakeIDStr()
|
||||
dictItem.CreateTime = time.Now().Format("2006-01-02 15:04:05")
|
||||
result = l.svcCtx.DbEngin.Table("t_dict_item").Create(&dictItem)
|
||||
if result.Error != nil {
|
||||
logx.Errorf("Failed to create dictionary item , errors: %s", result.Error)
|
||||
return nil, result.Error
|
||||
}
|
||||
return
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"time"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type AddDictLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewAddDictLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddDictLogic {
|
||||
return &AddDictLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *AddDictLogic) AddDict(req *types.DictEditReq) (resp *types.DictResp, err error) {
|
||||
dict := &types.DictInfo{}
|
||||
dict.DictName = req.DictName
|
||||
dict.DictCode = req.DictCode
|
||||
dict.Type = req.Type
|
||||
dict.Description = req.Description
|
||||
dict.Id = utils.GenSnowflakeIDStr()
|
||||
dict.CreateTime = time.Now().Format("2006-01-02 15:04:05")
|
||||
dict.Status = req.Status
|
||||
result := l.svcCtx.DbEngin.Table("t_dict").Create(&dict)
|
||||
if result.Error != nil {
|
||||
logx.Errorf("Failed to create dictionary , errors: %s", result.Error)
|
||||
return nil, result.Error
|
||||
}
|
||||
return
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteDictItemLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewDeleteDictItemLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteDictItemLogic {
|
||||
return &DeleteDictItemLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteDictItemLogic) DeleteDictItem(req *types.CId) (resp *types.DictItemResp, err error) {
|
||||
db := l.svcCtx.DbEngin.Table("t_dict_item").Where("id = ?", req.Id).First(&types.DictItemInfo{})
|
||||
if db.Error != nil {
|
||||
logx.Errorf("err %v", db.Error.Error())
|
||||
return nil, errors.New("Dictionary item does not exist")
|
||||
}
|
||||
tx := l.svcCtx.DbEngin.Table("t_dict_item").Delete(types.DictItemInfo{}, req.Id)
|
||||
if tx.Error != nil {
|
||||
logx.Errorf("err %v", db.Error.Error())
|
||||
return nil, errors.New("Delete dictionary item failed")
|
||||
}
|
||||
return
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteDictLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewDeleteDictLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteDictLogic {
|
||||
return &DeleteDictLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteDictLogic) DeleteDict(req *types.CId) (resp *types.DictResp, err error) {
|
||||
var sId int64
|
||||
l.svcCtx.DbEngin.Table("t_dict").Raw("select d.id from t_dict_item di left join t_dict d on di.dict_id=d.id where d.id=? limit 1", req.Id).Scan(&sId)
|
||||
if sId != 0 {
|
||||
return nil, errors.New("Delete failed,The dictionary is associated with a dictionary item")
|
||||
}
|
||||
db := l.svcCtx.DbEngin.Table("t_dict").Where("id = ?", req.Id).First(&types.DictInfo{})
|
||||
if db.Error != nil {
|
||||
logx.Errorf("err %v", db.Error.Error())
|
||||
return nil, errors.New("Dictionary does not exist")
|
||||
}
|
||||
tx := l.svcCtx.DbEngin.Table("t_dict").Delete(types.DictInfo{}, req.Id)
|
||||
if tx.Error != nil {
|
||||
logx.Errorf("err %v", db.Error.Error())
|
||||
return nil, errors.New("Delete dictionary failed")
|
||||
}
|
||||
return
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type EditDictItemLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewEditDictItemLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EditDictItemLogic {
|
||||
return &EditDictItemLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *EditDictItemLogic) EditDictItem(req *types.DictItemEditReq) (resp *types.DictItemResp, err error) {
|
||||
dictItem := &types.DictItemInfo{}
|
||||
result := l.svcCtx.DbEngin.Table("t_dict_item").First(&dictItem, req.Id)
|
||||
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return nil, errors.New("DictItem does not exist")
|
||||
}
|
||||
utils.Convert(req, &dictItem)
|
||||
l.svcCtx.DbEngin.Table("t_dict_item").Model(&dictItem).Updates(&dictItem)
|
||||
return
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type EditDictLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewEditDictLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EditDictLogic {
|
||||
return &EditDictLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *EditDictLogic) EditDict(req *types.DictEditReq) (resp *types.DictResp, err error) {
|
||||
dict := &types.DictInfo{}
|
||||
result := l.svcCtx.DbEngin.Table("t_dict").First(&dict, req.Id)
|
||||
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return nil, errors.New("Dict does not exist")
|
||||
}
|
||||
utils.Convert(req, &dict)
|
||||
tx := l.svcCtx.DbEngin.Table("t_dict").Model(&dict).Updates(&dict)
|
||||
fmt.Println(tx)
|
||||
return
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/pkg/errors"
|
||||
tool "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetDictItemLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewGetDictItemLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDictItemLogic {
|
||||
return &GetDictItemLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetDictItemLogic) GetDictItem(req *types.CId) (resp *types.DictItemResp, err error) {
|
||||
resp = &types.DictItemResp{}
|
||||
item := &types.DictItemInfo{}
|
||||
db := l.svcCtx.DbEngin.Table("t_dict_item").Where("id = ?", req.Id).First(&item)
|
||||
if db.Error != nil {
|
||||
logx.Errorf("err %v", db.Error.Error())
|
||||
return nil, errors.New("Dictionary item does not exist")
|
||||
}
|
||||
tool.Convert(item, &resp)
|
||||
return
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/pkg/errors"
|
||||
tool "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetDictLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewGetDictLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDictLogic {
|
||||
return &GetDictLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetDictLogic) GetDict(req *types.CId) (resp *types.DictResp, err error) {
|
||||
resp = &types.DictResp{}
|
||||
dict := &types.DictInfo{}
|
||||
db := l.svcCtx.DbEngin.Table("t_dict").Where("id = ?", req.Id).First(&dict)
|
||||
if db.Error != nil {
|
||||
logx.Errorf("err %v", db.Error.Error())
|
||||
return nil, errors.New("Dictionary does not exist")
|
||||
}
|
||||
tool.Convert(dict, &resp)
|
||||
return
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListDictItemLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewListDictItemLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListDictItemLogic {
|
||||
return &ListDictItemLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListDictItemLogic) ListDictItem(req *types.DictItemReq) (resp *types.DictItems, err error) {
|
||||
resp = &types.DictItems{}
|
||||
sql := fmt.Sprintf(`select c.* from t_dict_item c left join t_dict a on c.dict_id = a.id where c.deleted_at is null ORDER BY create_time Desc`)
|
||||
if req.ItemText != "" {
|
||||
sql = fmt.Sprintf(`select c.* from t_dict_item c left join t_dict a on c.dict_id = a.id where c.deleted_at is null and c.item_text like '%%%s%%'`, req.ItemText)
|
||||
}
|
||||
tx := l.svcCtx.DbEngin.Raw(sql).Scan(&resp.List)
|
||||
if tx.Error != nil {
|
||||
logx.Errorf(tx.Error.Error())
|
||||
return nil, tx.Error
|
||||
}
|
||||
return resp, nil
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package dictionary
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListDictLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewListDictLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListDictLogic {
|
||||
return &ListDictLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListDictLogic) ListDict(req *types.DictReq) (resp *types.Dicts, err error) {
|
||||
resp = &types.Dicts{}
|
||||
sqlStr := "select * from t_dict where `deleted_at` IS NULL ORDER BY create_time Desc"
|
||||
if req.DictName != "" {
|
||||
sqlStr = fmt.Sprintf("select * from t_dict where `deleted_at` IS NULL and dict_name like '%%%s%%' ORDER BY create_time Desc", req.DictName)
|
||||
}
|
||||
tx := l.svcCtx.DbEngin.Raw(sqlStr).Scan(&resp.List)
|
||||
if tx.Error != nil {
|
||||
logx.Errorf(tx.Error.Error())
|
||||
return nil, tx.Error
|
||||
}
|
||||
return resp, nil
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package hpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"time"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CommitHpcTaskLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCommitHpcTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommitHpcTaskLogic {
|
||||
return &CommitHpcTaskLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *types.CommitHpcTaskResp, err error) {
|
||||
// 构建主任务结构体
|
||||
taskModel := models.Task{
|
||||
Status: constants.Saved,
|
||||
Description: req.Description,
|
||||
Name: req.Name,
|
||||
CommitTime: time.Now(),
|
||||
}
|
||||
// 保存任务数据到数据库
|
||||
tx := l.svcCtx.DbEngin.Create(&taskModel)
|
||||
if tx.Error != nil {
|
||||
return nil, tx.Error
|
||||
}
|
||||
|
||||
env, _ := json.Marshal(req.Environment)
|
||||
hpcInfo := models.TaskHpc{
|
||||
TaskId: taskModel.Id,
|
||||
ClusterId: 1706858330967773111,
|
||||
Name: taskModel.Name,
|
||||
Status: "Saved",
|
||||
CmdScript: req.CmdScript,
|
||||
StartTime: time.Now().String(),
|
||||
CardCount: req.CardCount,
|
||||
WorkDir: req.WorkDir,
|
||||
WallTime: req.WallTime,
|
||||
AppType: req.AppType,
|
||||
AppName: req.AppName,
|
||||
Queue: req.Queue,
|
||||
SubmitType: req.SubmitType,
|
||||
NNode: req.NNode,
|
||||
StdOutFile: req.StdOutFile,
|
||||
StdErrFile: req.StdErrFile,
|
||||
StdInput: req.StdInput,
|
||||
DeletedFlag: 0,
|
||||
CreatedBy: req.ParticipantId,
|
||||
CreatedTime: time.Now(),
|
||||
UpdatedBy: req.ParticipantId,
|
||||
UpdatedTime: time.Now(),
|
||||
Environment: string(env),
|
||||
}
|
||||
|
||||
tx = l.svcCtx.DbEngin.Create(&hpcInfo)
|
||||
if tx.Error != nil {
|
||||
return nil, tx.Error
|
||||
}
|
||||
// 将任务数据转换成消息体
|
||||
//reqMessage, err := json.Marshal(mqInfo)
|
||||
//if err != nil {
|
||||
// logx.Error(err)
|
||||
// return nil, err
|
||||
//}
|
||||
//publish := l.svcCtx.RedisClient.Publish(context.Background(), mqInfo.TaskType, reqMessage)
|
||||
//if publish.Err() != nil {
|
||||
// return nil, publish.Err()
|
||||
//}
|
||||
return
|
||||
}
|
|
@ -1,132 +1,6 @@
|
|||
// Code generated by goctl. DO NOT EDIT.
|
||||
package types
|
||||
|
||||
type SubmitJobReq struct {
|
||||
SlurmVersion string `json:"slurmVersion"`
|
||||
Apptype string `json:"apptype,optional"`
|
||||
Appname string `json:"appname,optional"`
|
||||
StrJobManagerID int64 `json:"strJobManagerID,optional"`
|
||||
MapAppJobInfo MapAppJobInfo `json:"mapAppJobInfo,optional"`
|
||||
Account string `json:"account,optional"` //
|
||||
Acctg_freq string `json:"acctg_freq,optional"`
|
||||
Alloc_node string `json:"alloc_node,optional"`
|
||||
Alloc_resp_port int32 `json:"alloc_resp_port,optional"`
|
||||
Alloc_sid int32 `json:"alloc_sid,optional"`
|
||||
Argc int32 `json:"argc,optional"`
|
||||
Argv []Argv `json:"Argv,optional"`
|
||||
Array_inx string `json:"array_inx,optional"`
|
||||
Begin_time int64 `json:"begin_time,optional"`
|
||||
Ckpt_interval int32 `json:"ckpt_interval,optional"`
|
||||
Ckpt_dir string `json:"ckpt_dir,optional"`
|
||||
Comment string `json:"comment,optional"`
|
||||
Contiguous int32 `json:"contiguous,optional"`
|
||||
Cpu_bind string `json:"cpu_bind,optional"`
|
||||
Cpu_bind_type int32 `json:"cpu_bind_type,optional"`
|
||||
Dependency string `json:"dependency,optional"`
|
||||
End_time int64 `json:"end_time,optional"`
|
||||
Environment []Environment `json:"Environment,optional"`
|
||||
Env_size int32 `json:"env_size,optional"`
|
||||
Exc_nodes string `json:"exc_nodes,optional"`
|
||||
Features string `json:"features,optional"`
|
||||
Gres string `json:"gres,optional"`
|
||||
Group_id int32 `json:"group_id,optional"`
|
||||
Immediate int32 `json:"immediate,optional"`
|
||||
Job_id int32 `json:"job_id,optional"`
|
||||
Kill_on_node_fail int32 `json:"kill_on_node_fail,optional"`
|
||||
Licenses string `json:"licenses,optional"`
|
||||
Mail_type int32 `json:"mail_type,optional"`
|
||||
Mail_user string `json:"mail_user,optional"`
|
||||
Mem_bind string `json:"mem_bind,optional"`
|
||||
Mem_bind_type int32 `json:"mem_bind_type,optional"`
|
||||
Name string `json:"name,optional"` //
|
||||
Network string `json:"network,optional"`
|
||||
Nice int32 `json:"nice,optional"`
|
||||
Num_tasks int32 `json:"num_tasks,optional"`
|
||||
Open_mode int32 `json:"open_mode,optional"`
|
||||
Other_port int32 `json:"other_port,optional"`
|
||||
Overcommit int32 `json:"overcommit,optional"`
|
||||
Partition string `json:"partition,optional"`
|
||||
Plane_size int32 `json:"plane_size,optional"`
|
||||
Priority int32 `json:"priority,optional"`
|
||||
Profile int32 `json:"profile,optional"`
|
||||
Qos string `json:"qos,optional"`
|
||||
Resp_host string `json:"resp_host,optional"`
|
||||
Req_nodes string `json:"req_nodes,optional"`
|
||||
Requeue int32 `json:"requeue,optional"`
|
||||
Reservation string `json:"reservation,optional"`
|
||||
Script string `json:"script,optional"` //
|
||||
Shared int32 `json:"shared,optional"`
|
||||
Spank_job_env_size int32 `json:"spank_job_env_size,optional"`
|
||||
Task_dist int32 `json:"task_dist,optional"`
|
||||
Time_limit int32 `json:"time_limit,optional"`
|
||||
Time_min int32 `json:"time_min,optional"`
|
||||
User_id int32 `json:"user_id,optional"` //
|
||||
Wait_all_nodes int32 `json:"wait_all_nodes,optional"`
|
||||
Warn_signal int32 `json:"warn_signal,optional"`
|
||||
Warn_time int32 `json:"warn_time,optional"`
|
||||
Work_dir string `json:"work_dir,optional"`
|
||||
Cpus_per_task int32 `json:"cpus_per_task,optional"`
|
||||
Min_cpus int32 `json:"min_cpus,optional"` //
|
||||
Max_cpus int32 `json:"max_cpus,optional"`
|
||||
Min_nodes int32 `json:"min_nodes,optional"`
|
||||
Max_nodes int32 `json:"max_nodes,optional"`
|
||||
Boards_per_node int32 `json:"boards_per_node,optional"`
|
||||
Sockets_per_board int32 `json:"sockets_per_board,optional"`
|
||||
Sockets_per_node int32 `json:"sockets_per_node,optional"`
|
||||
Cores_per_socket int32 `json:"cores_per_socket,optional"`
|
||||
Threads_per_core int32 `json:"threads_per_core,optional"`
|
||||
Ntasks_per_node int32 `json:"ntasks_per_node,optional"`
|
||||
Ntasks_per_socket int32 `json:"ntasks_per_socket,optional"`
|
||||
Ntasks_per_core int32 `json:"ntasks_per_core,optional"`
|
||||
Ntasks_per_board int32 `json:"ntasks_per_board,optional"`
|
||||
Pn_min_cpus int32 `json:"pn_min_cpus,optional"`
|
||||
Pn_min_memory int32 `json:"pn_min_memory,optional"`
|
||||
Pn_min_tmp_disk int32 `json:"pn_min_tmp_disk,optional"`
|
||||
Reboot int32 `json:"reboot,optional"`
|
||||
Rotate int32 `json:"rotate,optional"`
|
||||
Req_switch int32 `json:"req_switch,optional"`
|
||||
Std_err string `json:"std_err,optional"`
|
||||
Std_in string `json:"std_in,optional"`
|
||||
Std_out string `json:"std_out,optional"`
|
||||
Wait4switch int32 `json:"wait4switch,optional"`
|
||||
Wckey string `json:"wckey,optional"`
|
||||
}
|
||||
|
||||
type SubmitJobResp struct {
|
||||
Code string `json:"code"` //Error_code 返回码 in Tianhe
|
||||
Msg string `json:"msg"`
|
||||
Data string `json:"data"` //Job_id 作业id in Tianhe
|
||||
}
|
||||
|
||||
type MapAppJobInfo struct {
|
||||
GAP_CMD_FILE string `json:"GAP_CMD_FILE"` //命令行内容
|
||||
GAP_NNODE string `json:"GAP_NNODE"` //节点个数(当指定该参数时,GAP_NODE_STRING必须为"")
|
||||
GAP_NODE_STRING string `json:"GAP_NODE_STRING,optional"` //指定节点(当指定该参数时,GAP_NNODE必须为"")
|
||||
GAP_SUBMIT_TYPE string `json:"GAP_SUBMIT_TYPE"` //cmd(命令行模式)
|
||||
GAP_JOB_NAME string `json:"GAP_JOB_NAME"` //作业名称
|
||||
GAP_WORK_DIR string `json:"GAP_WORK_DIR"` //工作路径
|
||||
GAP_QUEUE string `json:"GAP_QUEUE"` //队列名称
|
||||
GAP_NPROC string `json:"GAP_NPROC,optional"` //总核心数(GAP_NPROC和GAP_PPN选其一填写)
|
||||
GAP_PPN string `json:"GAP_PPN,optional"` //CPU核心/节点(GAP_NPROC和GAP_PPN选其一填写)
|
||||
GAP_NGPU string `json:"GAP_NGPU,optional"` //GPU卡数/节点
|
||||
GAP_NDCU string `json:"GAP_NDCU,optional"` //DCU卡数/节点
|
||||
GAP_JOB_MEM string `json:"GAP_JOB_MEM,optional"` //每个节点内存值,单位为MB/GB
|
||||
GAP_WALL_TIME string `json:"GAP_WALL_TIME"` //最大运行时长(HH:MM:ss)
|
||||
GAP_EXCLUSIVE string `json:"GAP_EXCLUSIVE,optional"` // 是否独占节点,1为独占,空为非独占
|
||||
GAP_APPNAME string `json:"GAP_APPNAME"` //BASE(基础应用),支持填写具体的应用英文名称
|
||||
GAP_MULTI_SUB string `json:"GAP_MULTI_SUB,optional"` //作业组长度,建议为小于等于50的正整数
|
||||
GAP_STD_OUT_FILE string `json:"GAP_STD_OUT_FILE"` //工作路径/std.out.%j
|
||||
GAP_STD_ERR_FILE string `json:"GAP_STD_ERR_FILE"` //工作路径/std.err.%j
|
||||
}
|
||||
|
||||
type Argv struct {
|
||||
Argv string `json:"argv,optional"`
|
||||
}
|
||||
|
||||
type Environment struct {
|
||||
Environment string `json:"environment,optional"`
|
||||
}
|
||||
|
||||
type GetRegionResp struct {
|
||||
Code int32 `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
|
@ -143,10 +17,11 @@ type CenterResourcesResp struct {
|
|||
}
|
||||
|
||||
type CenterIndex struct {
|
||||
Name string `json:"name"`
|
||||
Cpu float32 `json:"cpu"`
|
||||
Memory float32 `json:"memory"`
|
||||
Storage float32 `json:"storage"`
|
||||
Name string `json:"name"`
|
||||
Cpu float32 `json:"cpu"`
|
||||
Memory float32 `json:"memory"`
|
||||
Storage float32 `json:"storage"`
|
||||
CenterType string `json:"centerType"`
|
||||
}
|
||||
|
||||
type GetClusterListReq struct {
|
||||
|
@ -201,32 +76,6 @@ type TaskYaml struct {
|
|||
Metadata interface{} `yaml:"metadata"`
|
||||
}
|
||||
|
||||
type CommitHpcTaskReq struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,optional"`
|
||||
TenantId int64 `json:"tenantId,optional"`
|
||||
TaskId int64 `json:"taskId,optional"`
|
||||
ParticipantId int64 `json:"participantId,optional"`
|
||||
MatchLabels map[string]string `json:"matchLabels,optional"`
|
||||
CardCount int64 `json:"cardCount,optional"`
|
||||
WorkDir string `json:"workDir,optional"`
|
||||
WallTime string `json:"wallTime,optional"`
|
||||
CmdScript string `json:"cmdScript,optional"`
|
||||
AppType string `json:"appType,optional"`
|
||||
AppName string `json:"appName,optional"`
|
||||
Queue string `json:"queue,optional"`
|
||||
NNode string `json:"nNode,optional"`
|
||||
SubmitType string `json:"submitType,optional"`
|
||||
StdOutFile string `json:"stdOutFile,optional"`
|
||||
StdErrFile string `json:"stdErrFile,optional"`
|
||||
StdInput string `json:"stdInput,optional"`
|
||||
Environment map[string]string `json:"environment,optional"`
|
||||
}
|
||||
|
||||
type CommitHpcTaskResp struct {
|
||||
TaskId int64 `json:"taskId"`
|
||||
}
|
||||
|
||||
type CommitVmTaskReq struct {
|
||||
Server ServerCommit `json:"server,optional"`
|
||||
Platform string `json:"platform,optional"`
|
||||
|
@ -694,8 +543,8 @@ type AdapterRelation struct {
|
|||
}
|
||||
|
||||
type ClusterReq struct {
|
||||
Id string `json:"id,optional"`
|
||||
AdapterId string `json:"adapterId,optional"`
|
||||
Id string `form:"id,optional"`
|
||||
AdapterId string `form:"adapterId,optional"`
|
||||
Name string `json:"name,optional"`
|
||||
Nickname string `json:"nickname,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
|
@ -787,6 +636,112 @@ type ClusterRelationInfo struct {
|
|||
CCreateTime string `json:"cCreateTime,omitempty" db:"created_time" gorm:"autoCreateTime"`
|
||||
}
|
||||
|
||||
type DictInfo struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
DictName string `json:"dictName,omitempty"`
|
||||
DictCode string `json:"dictCode,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Type string `json:"type,omitempty" db:"type"`
|
||||
Status string `json:"status,omitempty" db:"status"`
|
||||
CreateTime string `json:"createTime,omitempty" db:"created_time" gorm:"autoCreateTime"`
|
||||
}
|
||||
|
||||
type DictReq struct {
|
||||
Id string `form:"id,optional"`
|
||||
DictName string `form:"dictName,optional"`
|
||||
DictCode string `form:"dictCode,optional"`
|
||||
Description string `form:"description,optional"`
|
||||
Type string `form:"type,optional"`
|
||||
Status string `form:"status,optional"`
|
||||
}
|
||||
|
||||
type DictEditReq struct {
|
||||
Id string `json:"id,optional"`
|
||||
DictName string `json:"dictName,optional"`
|
||||
DictCode string `json:"dictCode,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
Type string `json:"type,optional"`
|
||||
Status string `json:"status,optional"`
|
||||
}
|
||||
|
||||
type DictResp struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
DictName string `json:"dictName,omitempty"`
|
||||
DictCode string `json:"dictCode,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
CreateTime string `json:"createTime,omitempty" db:"created_time" gorm:"autoCreateTime"`
|
||||
DictItemInfo []*DictItemInfo `json:"dictItemInfo,omitempty"`
|
||||
}
|
||||
|
||||
type Dicts struct {
|
||||
List []DictInfo `json:"list,omitempty"`
|
||||
}
|
||||
|
||||
type DictItemInfo struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
DictId string `json:"dictId,omitempty"`
|
||||
ItemText string `json:"itemText,omitempty"`
|
||||
ItemValue string `json:"itemValue,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
SortOrder string `json:"sortOrder,omitempty"`
|
||||
Type string `json:"type,omitempty" db:"type"`
|
||||
ParentId string `json:"parentId,omitempty"`
|
||||
Status string `json:"status,omitempty" db:"status"`
|
||||
CreateTime string `json:"createTime,omitempty" db:"created_time" gorm:"autoCreateTime"`
|
||||
}
|
||||
|
||||
type DictItemReq struct {
|
||||
Id string `form:"id,optional"`
|
||||
DictId string `form:"dictId,optional"`
|
||||
ItemText string `form:"itemText,optional"`
|
||||
ItemValue string `form:"itemValue,optional"`
|
||||
Description string `form:"description,optional"`
|
||||
SortOrder string `form:"sortOrder,optional"`
|
||||
Type string `form:"type,optional"`
|
||||
ParentId string `form:"parentId,optional"`
|
||||
Status string `form:"status,optional"`
|
||||
}
|
||||
|
||||
type DictItemEditReq struct {
|
||||
Id string `json:"id,optional"`
|
||||
DictId string `json:"dictId,optional"`
|
||||
ItemText string `json:"itemText,optional"`
|
||||
ItemValue string `json:"itemValue,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
SortOrder string `json:"sortOrder,optional"`
|
||||
Type string `json:"type,optional"`
|
||||
ParentId string `json:"parentId,optional"`
|
||||
Status string `json:"status,optional"`
|
||||
}
|
||||
|
||||
type DictItemResp struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
DictId string `json:"dictId,omitempty"`
|
||||
ItemText string `json:"itemText,omitempty"`
|
||||
ItemValue string `json:"itemValue,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
SortOrder string `json:"sortOrder,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
ParentId string `json:"parentId,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
CreateTime string `json:"createTime,omitempty" db:"created_time" gorm:"autoCreateTime"`
|
||||
DictInfo *DictInfo `json:"dictInfo,omitempty"`
|
||||
}
|
||||
|
||||
type DictItems struct {
|
||||
List []DictItemInfo `json:"list,omitempty"`
|
||||
}
|
||||
|
||||
type CId struct {
|
||||
Id string `path:"id":"id,omitempty" validate:"required"`
|
||||
}
|
||||
|
||||
type CIds struct {
|
||||
Ids []string `json:"ids,omitempty" validate:"required"`
|
||||
}
|
||||
|
||||
type Job struct {
|
||||
SlurmVersion string `json:"slurmVersion"`
|
||||
Name string `json:"name"`
|
||||
|
@ -795,6 +750,32 @@ type Job struct {
|
|||
StateofJob string `json:"StateofJob"`
|
||||
}
|
||||
|
||||
type CommitHpcTaskReq struct {
|
||||
Name string `json:"name"` // paratera:jobName
|
||||
Description string `json:"description,optional"`
|
||||
TenantId int64 `json:"tenantId,optional"`
|
||||
TaskId int64 `json:"taskId,optional"`
|
||||
ParticipantId int64 `json:"participantId,optional"`
|
||||
MatchLabels map[string]string `json:"matchLabels,optional"`
|
||||
CardCount int64 `json:"cardCount,optional"`
|
||||
WorkDir string `json:"workDir,optional"` //paratera:workingDir
|
||||
WallTime string `json:"wallTime,optional"`
|
||||
CmdScript string `json:"cmdScript,optional"` // paratera:bootScript
|
||||
AppType string `json:"appType,optional"`
|
||||
AppName string `json:"appName,optional"` // paratera:jobGroupName ac:appname
|
||||
Queue string `json:"queue,optional"`
|
||||
NNode string `json:"nNode,optional"`
|
||||
SubmitType string `json:"submitType,optional"`
|
||||
StdOutFile string `json:"stdOutFile,optional"`
|
||||
StdErrFile string `json:"stdErrFile,optional"`
|
||||
StdInput string `json:"stdInput,optional"`
|
||||
Environment map[string]string `json:"environment,optional"`
|
||||
}
|
||||
|
||||
type CommitHpcTaskResp struct {
|
||||
TaskId int64 `json:"taskId"`
|
||||
}
|
||||
|
||||
type ListJobReq struct {
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package models
|
||||
|
||||
import "github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
|
||||
var _ TaskHpcModel = (*customTaskHpcModel)(nil)
|
||||
|
||||
type (
|
||||
// TaskHpcModel is an interface to be customized, add more methods here,
|
||||
// and implement the added methods in customTaskHpcModel.
|
||||
TaskHpcModel interface {
|
||||
taskHpcModel
|
||||
withSession(session sqlx.Session) TaskHpcModel
|
||||
}
|
||||
|
||||
customTaskHpcModel struct {
|
||||
*defaultTaskHpcModel
|
||||
}
|
||||
)
|
||||
|
||||
// NewTaskHpcModel returns a model for the database table.
|
||||
func NewTaskHpcModel(conn sqlx.SqlConn) TaskHpcModel {
|
||||
return &customTaskHpcModel{
|
||||
defaultTaskHpcModel: newTaskHpcModel(conn),
|
||||
}
|
||||
}
|
||||
|
||||
func (m *customTaskHpcModel) withSession(session sqlx.Session) TaskHpcModel {
|
||||
return NewTaskHpcModel(sqlx.NewSqlConnFromSession(session))
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
// Code generated by goctl. DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/stores/builder"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlc"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
"github.com/zeromicro/go-zero/core/stringx"
|
||||
)
|
||||
|
||||
var (
|
||||
taskHpcFieldNames = builder.RawFieldNames(&TaskHpc{})
|
||||
taskHpcRows = strings.Join(taskHpcFieldNames, ",")
|
||||
taskHpcRowsExpectAutoSet = strings.Join(stringx.Remove(taskHpcFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
|
||||
taskHpcRowsWithPlaceHolder = strings.Join(stringx.Remove(taskHpcFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
|
||||
)
|
||||
|
||||
type (
|
||||
taskHpcModel interface {
|
||||
Insert(ctx context.Context, data *TaskHpc) (sql.Result, error)
|
||||
FindOne(ctx context.Context, id int64) (*TaskHpc, error)
|
||||
Update(ctx context.Context, data *TaskHpc) error
|
||||
Delete(ctx context.Context, id int64) error
|
||||
}
|
||||
|
||||
defaultTaskHpcModel struct {
|
||||
conn sqlx.SqlConn
|
||||
table string
|
||||
}
|
||||
|
||||
TaskHpc struct {
|
||||
Id int64 `db:"id"` // id
|
||||
TaskId int64 `db:"task_id"` // 任务id
|
||||
JobId string `db:"job_id"` // 作业id(在第三方系统中的作业id)
|
||||
ClusterId int64 `db:"cluster_id"` // 执行任务的集群id
|
||||
Name string `db:"name"` // 名称
|
||||
Status string `db:"status"` // 状态
|
||||
CmdScript string `db:"cmd_script"`
|
||||
StartTime string `db:"start_time"` // 开始时间
|
||||
RunningTime int64 `db:"running_time"` // 运行时间
|
||||
DerivedEs string `db:"derived_es"`
|
||||
Cluster string `db:"cluster"`
|
||||
BlockId int64 `db:"block_id"`
|
||||
AllocNodes int64 `db:"alloc_nodes"`
|
||||
AllocCpu int64 `db:"alloc_cpu"`
|
||||
CardCount int64 `db:"card_count"` // 卡数
|
||||
Version string `db:"version"`
|
||||
Account string `db:"account"`
|
||||
WorkDir string `db:"work_dir"` // 工作路径
|
||||
AssocId int64 `db:"assoc_id"`
|
||||
ExitCode int64 `db:"exit_code"`
|
||||
WallTime string `db:"wall_time"` // 最大运行时间
|
||||
Result string `db:"result"` // 运行结果
|
||||
DeletedAt sql.NullTime `db:"deleted_at"` // 删除时间
|
||||
YamlString string `db:"yaml_string"`
|
||||
AppType string `db:"app_type"` // 应用类型
|
||||
AppName string `db:"app_name"` // 应用名称
|
||||
Queue string `db:"queue"` // 队列名称
|
||||
SubmitType string `db:"submit_type"` // cmd(命令行模式)
|
||||
NNode string `db:"n_node"` // 节点个数(当指定该参数时,GAP_NODE_STRING必须为"")
|
||||
StdOutFile string `db:"std_out_file"` // 工作路径/std.err.%j
|
||||
StdErrFile string `db:"std_err_file"` // 工作路径/std.err.%j
|
||||
StdInput string `db:"std_input"`
|
||||
Environment string `db:"environment"`
|
||||
DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是)
|
||||
CreatedBy int64 `db:"created_by"` // 创建人
|
||||
CreatedTime time.Time `db:"created_time"` // 创建时间
|
||||
UpdatedBy int64 `db:"updated_by"` // 更新人
|
||||
UpdatedTime time.Time `db:"updated_time"` // 更新时间
|
||||
}
|
||||
)
|
||||
|
||||
func newTaskHpcModel(conn sqlx.SqlConn) *defaultTaskHpcModel {
|
||||
return &defaultTaskHpcModel{
|
||||
conn: conn,
|
||||
table: "`task_hpc`",
|
||||
}
|
||||
}
|
||||
|
||||
func (m *defaultTaskHpcModel) Delete(ctx context.Context, id int64) error {
|
||||
query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
|
||||
_, err := m.conn.ExecCtx(ctx, query, id)
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *defaultTaskHpcModel) FindOne(ctx context.Context, id int64) (*TaskHpc, error) {
|
||||
query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", taskHpcRows, m.table)
|
||||
var resp TaskHpc
|
||||
err := m.conn.QueryRowCtx(ctx, &resp, query, id)
|
||||
switch err {
|
||||
case nil:
|
||||
return &resp, nil
|
||||
case sqlc.ErrNotFound:
|
||||
return nil, ErrNotFound
|
||||
default:
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
func (m *defaultTaskHpcModel) Insert(ctx context.Context, data *TaskHpc) (sql.Result, error) {
|
||||
query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, taskHpcRowsExpectAutoSet)
|
||||
ret, err := m.conn.ExecCtx(ctx, query, data.TaskId, data.JobId, data.ClusterId, data.Name, data.Status, data.CmdScript, data.StartTime, data.RunningTime, data.DerivedEs, data.Cluster, data.BlockId, data.AllocNodes, data.AllocCpu, data.CardCount, data.Version, data.Account, data.WorkDir, data.AssocId, data.ExitCode, data.WallTime, data.Result, data.DeletedAt, data.YamlString, data.AppType, data.AppName, data.Queue, data.SubmitType, data.NNode, data.StdOutFile, data.StdErrFile, data.StdInput, data.Environment, data.DeletedFlag, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime)
|
||||
return ret, err
|
||||
}
|
||||
|
||||
func (m *defaultTaskHpcModel) Update(ctx context.Context, data *TaskHpc) error {
|
||||
query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, taskHpcRowsWithPlaceHolder)
|
||||
_, err := m.conn.ExecCtx(ctx, query, data.TaskId, data.JobId, data.ClusterId, data.Name, data.Status, data.CmdScript, data.StartTime, data.RunningTime, data.DerivedEs, data.Cluster, data.BlockId, data.AllocNodes, data.AllocCpu, data.CardCount, data.Version, data.Account, data.WorkDir, data.AssocId, data.ExitCode, data.WallTime, data.Result, data.DeletedAt, data.YamlString, data.AppType, data.AppName, data.Queue, data.SubmitType, data.NNode, data.StdOutFile, data.StdErrFile, data.StdInput, data.Environment, data.DeletedFlag, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.Id)
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *defaultTaskHpcModel) tableName() string {
|
||||
return m.table
|
||||
}
|
|
@ -16,7 +16,6 @@ package tracker
|
|||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestGetNamedMetrics(t *testing.T) {
|
||||
|
@ -28,9 +27,9 @@ func TestGetNamedMetrics(t *testing.T) {
|
|||
//})
|
||||
//println("zzz", result[0].MetricValues[0].Sample.Value())
|
||||
|
||||
client, _ := NewPrometheus("http://10.105.20.4:30766")
|
||||
result := client.GetNamedMetricsByTime([]string{"pod_cpu_usage", "pod_memory_usage_wo_cache"}, "1700521446", "1700551446", 10*time.Minute, ControllerOption{
|
||||
PodsName: "sealos-task-112703-65c776b4b5-q4jgf",
|
||||
})
|
||||
println("zzz", result)
|
||||
//client, _ := NewPrometheus("http://10.105.20.4:30766")
|
||||
//result := client.GetNamedMetricsByTime([]string{"pod_cpu_usage", "pod_memory_usage_wo_cache"}, "1700521446", "1700551446", 10*time.Minute, ControllerOption{
|
||||
// PodsName: "sealos-task-112703-65c776b4b5-q4jgf",
|
||||
//})
|
||||
//println("zzz", result)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue