diff --git a/sdks/pcmscheduler/jobset.go b/sdks/pcmscheduler/jobset.go index fa09286..608cfe8 100644 --- a/sdks/pcmscheduler/jobset.go +++ b/sdks/pcmscheduler/jobset.go @@ -19,17 +19,26 @@ type GetClusterInfoReq struct { // TraceId string `json:"traceId"` //} -func (c *Client) GetClusterInfo(req GetClusterInfoReq) ([]ClusterDetail, error) { +func (c *Client) GetClusterInfo(req GetClusterInfoReq, token string) ([]ClusterDetail, error) { targetUrl, err := url.JoinPath(c.baseURL, "schedule/queryResources") if err != nil { return nil, err } //resp, err := http2.PostJSON(targetUrl, http2.RequestParam{Body: req}) - resp, err := http2.PostJSON(targetUrl, http2.RequestParam{}) + header := map[string]string{ + "Authorization": token, + } + resp, err := http2.PostJSON(targetUrl, http2.RequestParam{ + Header: header, + }) if err != nil { return nil, err } + + //all, err := io.ReadAll(resp.Body) + //println(string(all)) + contType := resp.Header.Get("Content-Type") if strings.Contains(contType, http2.ContentTypeJSON) { diff --git a/sdks/scheduler/models.go b/sdks/scheduler/models.go index 54f5261..911bf2d 100644 --- a/sdks/scheduler/models.go +++ b/sdks/scheduler/models.go @@ -26,6 +26,10 @@ const ( MemoryUtilization = "MemoryUtilization" GPUUtilization = "GPUUtilization" CPUUtilization = "CPUUtilization" + + MethodPost = "POST" + MethodGet = "GET" + CodeSuccess = 200 ) type JobID string @@ -72,6 +76,7 @@ var JobInfoTypeUnion = types.NewTypeUnion[JobInfo]( (*PCMInferenceJobInfo)(nil), (*CompleteJobInfo)(nil), (*StartJobInfo)(nil), + (*NotifyJobInfo)(nil), ) var _ = serder.UseTypeUnionInternallyTagged(&JobInfoTypeUnion, "type") @@ -162,6 +167,16 @@ type StartJobInfo struct { Type string `json:"type"` } +type NotifyJobInfo struct { + serder.Metadata `union:"Notify"` + JobInfoBase + Type string `json:"type"` + RequestType string `json:"requestType"` + Url string `json:"url"` + Body any `json:"body"` + Headers map[string]string `json:"headers"` +} + type ResourceChoice struct { Type string `json:"type"` ResourceScopes []ResourceScope `json:"resourceScopes"`