Compare commits
2 Commits
1cac2adace
...
78ff996031
Author | SHA1 | Date |
---|---|---|
|
78ff996031 | |
|
6930bb5146 |
|
@ -1,6 +1,8 @@
|
|||
package dataset
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"gitlink.org.cn/JointCloud/pcm-participant-ai/common"
|
||||
)
|
||||
|
||||
|
@ -20,3 +22,36 @@ type OpenI struct {
|
|||
|
||||
func (o OpenI) DatasetCreateParam() {
|
||||
}
|
||||
|
||||
func (cp *CreateParam) UnmarshalJSON(data []byte) error {
|
||||
// 临时结构体:用于捕获原始 JSON 中的 param 字段数据
|
||||
type TempCreateParam struct {
|
||||
Name string `json:"name"`
|
||||
Desc string `json:"desc"`
|
||||
Src *common.Source `json:"src,omitempty"`
|
||||
Param json.RawMessage `json:"param,omitempty"` // 捕获原始 JSON 数据
|
||||
}
|
||||
var temp TempCreateParam
|
||||
if err := json.Unmarshal(data, &temp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 将临时结构体的字段赋值给原结构体(除 Param 外)
|
||||
cp.Name = temp.Name
|
||||
cp.Desc = temp.Desc
|
||||
cp.Src = temp.Src
|
||||
|
||||
// 解析 param 字段的原始数据为具体类型
|
||||
if temp.Param != nil {
|
||||
// 尝试解析为 OpenI 类型
|
||||
var openi OpenI
|
||||
if err := json.Unmarshal(temp.Param, &openi); err == nil {
|
||||
cp.Param = &openi
|
||||
return nil
|
||||
}
|
||||
|
||||
return fmt.Errorf("unsupported param type in CreateParam")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package model
|
||||
|
||||
import "gitlink.org.cn/JointCloud/pcm-participant-ai/common"
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"gitlink.org.cn/JointCloud/pcm-participant-ai/common"
|
||||
)
|
||||
|
||||
type CreateParam struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
|
@ -18,3 +22,36 @@ type OpenI struct {
|
|||
|
||||
func (o OpenI) ModelCreateParam() {
|
||||
}
|
||||
|
||||
func (cp *CreateParam) UnmarshalJSON(data []byte) error {
|
||||
// 临时结构体:用于捕获原始 JSON 中的 param 字段数据
|
||||
type TempCreateParam struct {
|
||||
Name string `json:"name"`
|
||||
Desc string `json:"desc"`
|
||||
Src *common.Source `json:"src,omitempty"`
|
||||
Param json.RawMessage `json:"param,omitempty"` // 捕获原始 JSON 数据
|
||||
}
|
||||
var temp TempCreateParam
|
||||
if err := json.Unmarshal(data, &temp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 将临时结构体的字段赋值给原结构体(除 Param 外)
|
||||
cp.Name = temp.Name
|
||||
cp.Desc = temp.Desc
|
||||
cp.Src = temp.Src
|
||||
|
||||
// 解析 param 字段的原始数据为具体类型
|
||||
if temp.Param != nil {
|
||||
// 尝试解析为 OpenI 类型
|
||||
var openi OpenI
|
||||
if err := json.Unmarshal(temp.Param, &openi); err == nil {
|
||||
cp.Param = &openi
|
||||
return nil
|
||||
}
|
||||
|
||||
return fmt.Errorf("unsupported param type in CreateParam")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package task
|
||||
|
||||
import "gitlink.org.cn/JointCloud/pcm-participant-ai/common"
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"gitlink.org.cn/JointCloud/pcm-participant-ai/common"
|
||||
)
|
||||
|
||||
type ResultSyncParam struct {
|
||||
Src *common.Source `json:"src,omitempty"`
|
||||
|
@ -17,3 +21,31 @@ type OpenI struct {
|
|||
|
||||
func (o OpenI) ResultSyncParam() {
|
||||
}
|
||||
|
||||
func (cp *ResultSyncParam) UnmarshalJSON(data []byte) error {
|
||||
// 临时结构体:用于捕获原始 JSON 中的 param 字段数据
|
||||
type TempCreateParam struct {
|
||||
Src *common.Source `json:"src,omitempty"`
|
||||
Param json.RawMessage `json:"param,omitempty"` // 捕获原始 JSON 数据
|
||||
}
|
||||
var temp TempCreateParam
|
||||
if err := json.Unmarshal(data, &temp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 将临时结构体的字段赋值给原结构体(除 Param 外)
|
||||
cp.Src = temp.Src
|
||||
|
||||
// 解析 param 字段的原始数据为具体类型
|
||||
if temp.Param != nil {
|
||||
// 尝试解析为 OpenI 类型
|
||||
var openi OpenI
|
||||
if err := json.Unmarshal(temp.Param, &openi); err == nil {
|
||||
cp.Param = &openi
|
||||
return nil
|
||||
}
|
||||
|
||||
return fmt.Errorf("unsupported param type in ResultSyncParam")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -8,4 +8,4 @@ pcm-core:
|
|||
coordinator-host: http://127.0.0.1:8999
|
||||
participant-host: http://localhost:8080
|
||||
hpc-cluster-list: /pcm/v1/adapter/cluster/list?type=2&pageNum=1&pageSize=10&storageSchedule=1
|
||||
ai-cluster-list: /pcm/v1/adapter/cluster/list?name=openI-new-p&type=1&pageNum=1&pageSize=10&storageSchedule=1
|
||||
ai-cluster-list: /pcm/v1/adapter/cluster/list?adapterId=1777144940456666666&type=1&pageNum=1&pageSize=10&storageSchedule=1
|
|
@ -137,7 +137,7 @@ func initAISvcs(client *utils.RestyClient, core config.PcmCore) (*service.Servic
|
|||
|
||||
//更新C端集群状态
|
||||
case "octopus":
|
||||
oct, _ := octopus.New(cluster.Server, cluster.Username, cluster.Password, platform.Id(clusterId))
|
||||
oct, _ := octopus.New(cluster.Address, cluster.Username, cluster.Password, platform.Id(clusterId))
|
||||
platforms = append(platforms, oct)
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ func AIRoutes(server *gin.Engine) {
|
|||
|
||||
// 任务相关路由
|
||||
ai.GET("/task/train", aiApi.CreateTrainTaskHandler)
|
||||
ai.GET("/task/sync", aiApi.TaskResultSyncHandler)
|
||||
ai.POST("/task/sync", aiApi.TaskResultSyncHandler)
|
||||
ai.GET("/task/log", aiApi.TaskLogHandler)
|
||||
ai.GET("/task/train/detail", aiApi.TrainTaskDetailHandler)
|
||||
ai.GET("/task/infer/detail", aiApi.InferTaskDetailHandler)
|
||||
|
|
Loading…
Reference in New Issue