|
|
@@ -24,7 +24,6 @@ import ( |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
const ( |
|
|
const ( |
|
|
RESOURCE_POOL = "grampus-pool" |
|
|
|
|
|
Param_Token = "token" |
|
|
Param_Token = "token" |
|
|
Param_Addr = "addr" |
|
|
Param_Addr = "addr" |
|
|
Forward_Slash = "/" |
|
|
Forward_Slash = "/" |
|
|
@@ -95,16 +94,17 @@ type OctopusHttp struct { |
|
|
platform string |
|
|
platform string |
|
|
participantId int64 |
|
|
participantId int64 |
|
|
token *Token |
|
|
token *Token |
|
|
|
|
|
resourcePool string |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func NewOctopusHttp(id int64, name, server, host string, user string, pwd string) *OctopusHttp { |
|
|
|
|
|
|
|
|
func NewOctopusHttp(id int64, resourcePool, name, server, host, user, pwd string) *OctopusHttp { |
|
|
token := &Token{ |
|
|
token := &Token{ |
|
|
user: user, |
|
|
user: user, |
|
|
pwd: pwd, |
|
|
pwd: pwd, |
|
|
server: server, |
|
|
server: server, |
|
|
host: host, |
|
|
host: host, |
|
|
} |
|
|
} |
|
|
return &OctopusHttp{platform: name, participantId: id, server: server, host: host, token: token} |
|
|
|
|
|
|
|
|
return &OctopusHttp{resourcePool: resourcePool, platform: name, participantId: id, server: server, host: host, token: token} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// executor |
|
|
// executor |
|
|
@@ -239,7 +239,7 @@ func (o *OctopusHttp) SubmitTask(ctx context.Context, imageId string, cmd string |
|
|
Name: TASK_NAME_PREFIX + UNDERSCORE + utils.RandomString(10), |
|
|
Name: TASK_NAME_PREFIX + UNDERSCORE + utils.RandomString(10), |
|
|
ImageId: imageId, |
|
|
ImageId: imageId, |
|
|
IsDistributed: false, |
|
|
IsDistributed: false, |
|
|
ResourcePool: RESOURCE_POOL, |
|
|
|
|
|
|
|
|
ResourcePool: o.resourcePool, |
|
|
Config: []*omodel.CreateTrainJobConf{ |
|
|
Config: []*omodel.CreateTrainJobConf{ |
|
|
{ |
|
|
{ |
|
|
Command: cmd, |
|
|
Command: cmd, |
|
|
@@ -304,7 +304,7 @@ func (o *OctopusHttp) resourceSpecs(ctx context.Context) (*entity.OctResp, error |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
param := omodel.ResourceSpecParam{ |
|
|
param := omodel.ResourceSpecParam{ |
|
|
ResourcePool: RESOURCE_POOL, |
|
|
|
|
|
|
|
|
ResourcePool: o.resourcePool, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
b, _ := json.Marshal(param) |
|
|
b, _ := json.Marshal(param) |
|
|
|