|
|
@@ -129,7 +129,6 @@ func (o *OctopusHttp) Stop(ctx context.Context, id string) error { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (o *OctopusHttp) SubmitTask(ctx context.Context, imageId string, cmd string, envs []string, params []string, resourceId string, datasetsId string, algorithmId string, aiType string) (interface{}, error) { |
|
|
func (o *OctopusHttp) SubmitTask(ctx context.Context, imageId string, cmd string, envs []string, params []string, resourceId string, datasetsId string, algorithmId string, aiType string) (interface{}, error) { |
|
|
|
|
|
|
|
|
// octopus提交任务 |
|
|
// octopus提交任务 |
|
|
reqUrl := o.server + CreateTrainJobUrl |
|
|
reqUrl := o.server + CreateTrainJobUrl |
|
|
|
|
|
|
|
|
@@ -188,6 +187,8 @@ func (o *OctopusHttp) SubmitTask(ctx context.Context, imageId string, cmd string |
|
|
req := common.GetRestyRequest(common.TIMEOUT) |
|
|
req := common.GetRestyRequest(common.TIMEOUT) |
|
|
_, err = req. |
|
|
_, err = req. |
|
|
SetHeader("Authorization", "Bearer "+token). |
|
|
SetHeader("Authorization", "Bearer "+token). |
|
|
|
|
|
SetQueryString("token=" + token). |
|
|
|
|
|
SetQueryString("addr=" + o.host). |
|
|
SetBody(param). |
|
|
SetBody(param). |
|
|
SetResult(resp). |
|
|
SetResult(resp). |
|
|
Post(reqUrl) |
|
|
Post(reqUrl) |
|
|
@@ -531,13 +532,16 @@ func genClusterResources(cType string, cNum string, s *omodel.Spec) (*collector. |
|
|
cres := &collector.ClusterResource{} |
|
|
cres := &collector.ClusterResource{} |
|
|
bres := make([]*collector.Usage, 0) |
|
|
bres := make([]*collector.Usage, 0) |
|
|
|
|
|
|
|
|
|
|
|
var cardNum int64 |
|
|
|
|
|
var cpuCore int64 |
|
|
|
|
|
|
|
|
cardNum, err := strconv.ParseInt(cNum, 10, 64) |
|
|
cardNum, err := strconv.ParseInt(cNum, 10, 64) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return nil, err |
|
|
|
|
|
|
|
|
cardNum = 0 |
|
|
} |
|
|
} |
|
|
cpuCore, err := strconv.ParseInt(s.ResourceQuantity.Cpu, 10, 64) |
|
|
|
|
|
|
|
|
cpuCore, err = strconv.ParseInt(s.ResourceQuantity.Cpu, 10, 64) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return nil, err |
|
|
|
|
|
|
|
|
cpuCore = 0 |
|
|
} |
|
|
} |
|
|
gi := strings.Split(s.ResourceQuantity.Memory, Gi) |
|
|
gi := strings.Split(s.ResourceQuantity.Memory, Gi) |
|
|
if len(gi) != 2 { |
|
|
if len(gi) != 2 { |
|
|
@@ -546,7 +550,7 @@ func genClusterResources(cType string, cNum string, s *omodel.Spec) (*collector. |
|
|
|
|
|
|
|
|
memGi, err := strconv.ParseInt(gi[0], 10, 64) |
|
|
memGi, err := strconv.ParseInt(gi[0], 10, 64) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return nil, err |
|
|
|
|
|
|
|
|
memGi = 0 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
card := &collector.Usage{ |
|
|
card := &collector.Usage{ |
|
|
|