|
|
|
@@ -5,13 +5,14 @@ import ( |
|
|
|
"gitlink.org.cn/cloudream/common/utils/http2" |
|
|
|
"gitlink.org.cn/cloudream/common/utils/serder" |
|
|
|
"net/url" |
|
|
|
"path/filepath" |
|
|
|
"strings" |
|
|
|
) |
|
|
|
|
|
|
|
type QueryTasksReq struct { |
|
|
|
PageNum int64 `json:"pageNum"` |
|
|
|
PageSize int64 `json:"pageSize"` |
|
|
|
Type int64 `json:"type"` |
|
|
|
PageNum int64 `form:"pageNum"` |
|
|
|
PageSize int64 `form:"pageSize"` |
|
|
|
Type int64 `form:"type"` |
|
|
|
} |
|
|
|
|
|
|
|
type QueryTasksResp struct { |
|
|
|
@@ -45,13 +46,13 @@ type TaskModel struct { |
|
|
|
} |
|
|
|
|
|
|
|
func (c *Client) QueryTasks(req QueryTasksReq, token string) (*QueryTasksResp, error) { |
|
|
|
targetUrl, err := url.JoinPath(c.baseURL, "/pcm/v1/core/task/list") |
|
|
|
targetUrl, err := url.JoinPath(c.baseURL, "/core/task/list") |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
|
|
|
|
resp, err := http2.GetJSON(targetUrl, http2.RequestParam{ |
|
|
|
Body: req, |
|
|
|
Query: req, |
|
|
|
Header: map[string]string{ |
|
|
|
"Authorization": token, |
|
|
|
}, |
|
|
|
@@ -78,7 +79,7 @@ func (c *Client) QueryTasks(req QueryTasksReq, token string) (*QueryTasksResp, e |
|
|
|
} |
|
|
|
|
|
|
|
type QueryDetailsReq struct { |
|
|
|
TaskID string `json:"id"` |
|
|
|
TaskID string `form:"id"` |
|
|
|
} |
|
|
|
|
|
|
|
type QueryDetailsResp struct { |
|
|
|
@@ -139,13 +140,13 @@ type ClusterInfo struct { |
|
|
|
} |
|
|
|
|
|
|
|
func (c *Client) QueryDetails(req QueryDetailsReq, token string) (*QueryDetailsResp, error) { |
|
|
|
targetUrl, err := url.JoinPath(c.baseURL, "/pcm/v1/core/task/details") |
|
|
|
targetUrl, err := url.JoinPath(c.baseURL, "/core/task/details") |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
|
|
|
|
resp, err := http2.GetJSON(targetUrl, http2.RequestParam{ |
|
|
|
Body: req, |
|
|
|
Query: req, |
|
|
|
Header: map[string]string{ |
|
|
|
"Authorization": token, |
|
|
|
}, |
|
|
|
@@ -172,7 +173,7 @@ func (c *Client) QueryDetails(req QueryDetailsReq, token string) (*QueryDetailsR |
|
|
|
} |
|
|
|
|
|
|
|
type QueryHPCTrainReq struct { |
|
|
|
TaskID string `json:"taskId"` |
|
|
|
TaskID string `form:"taskId"` |
|
|
|
} |
|
|
|
|
|
|
|
type QueryHPCTrainResp struct { |
|
|
|
@@ -183,13 +184,13 @@ type QueryHPCTrainResp struct { |
|
|
|
} |
|
|
|
|
|
|
|
func (c *Client) QueryHPCTrainLog(req QueryHPCTrainReq, token string) (*QueryHPCTrainResp, error) { |
|
|
|
targetUrl, err := url.JoinPath(c.baseURL, "/pcm/v1/hpc/jobLogs") |
|
|
|
targetUrl, err := url.JoinPath(c.baseURL, "/hpc/jobLogs") |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
|
|
|
|
resp, err := http2.GetJSON(targetUrl, http2.RequestParam{ |
|
|
|
Body: req, |
|
|
|
Query: req, |
|
|
|
Header: map[string]string{ |
|
|
|
"Authorization": token, |
|
|
|
}, |
|
|
|
@@ -216,10 +217,10 @@ func (c *Client) QueryHPCTrainLog(req QueryHPCTrainReq, token string) (*QueryHPC |
|
|
|
} |
|
|
|
|
|
|
|
type QueryAITrainLogReq struct { |
|
|
|
AdapterID string `json:"adapterId"` |
|
|
|
ClusterID string `json:"clusterId"` |
|
|
|
TaskID string `json:"taskId"` |
|
|
|
InstanceNum string `json:"instanceNum"` |
|
|
|
AdapterID string `form:"adapterId"` |
|
|
|
ClusterID string `form:"clusterId"` |
|
|
|
TaskID string `form:"taskId"` |
|
|
|
InstanceNum string `form:"instanceNum"` |
|
|
|
} |
|
|
|
|
|
|
|
type QueryAITrainLogResp struct { |
|
|
|
@@ -227,16 +228,19 @@ type QueryAITrainLogResp struct { |
|
|
|
} |
|
|
|
|
|
|
|
func (c *Client) QueryAITrainLog(req QueryAITrainLogReq, token string) (*QueryAITrainLogResp, error) { |
|
|
|
targetUrl, err := url.JoinPath(c.baseURL, "/pcm/v1/schedule/ai/getJobLog") |
|
|
|
urlPath := filepath.Join("/schedule/ai/getJobLog", "1777144940459986944", req.ClusterID, req.TaskID, "0") |
|
|
|
urlPath = filepath.ToSlash(urlPath) |
|
|
|
|
|
|
|
targetUrl, err := url.JoinPath(c.baseURL, urlPath) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
|
|
|
|
req.AdapterID = "1777144940459986944" |
|
|
|
req.InstanceNum = "0" |
|
|
|
//req.AdapterID = "1777144940459986944" |
|
|
|
//req.InstanceNum = "0" |
|
|
|
|
|
|
|
resp, err := http2.GetJSON(targetUrl, http2.RequestParam{ |
|
|
|
Body: req, |
|
|
|
Query: req, |
|
|
|
Header: map[string]string{ |
|
|
|
"Authorization": token, |
|
|
|
}, |
|
|
|
|