Updating the client to not use instanceId 0 by default, instead get the instanceId from the list of active Instances
This commit is contained in:
parent
1b475175db
commit
0d9b869583
2 changed files with 29 additions and 4 deletions
|
@ -282,7 +282,12 @@ func main() {
|
||||||
}
|
}
|
||||||
currInstances := int32(len(live))
|
currInstances := int32(len(live))
|
||||||
fmt.Println("Current num of instances: ", currInstances)
|
fmt.Println("Current num of instances: ", currInstances)
|
||||||
resp, err := r.AddInstances(aurora.InstanceKey{job.JobKey(), 0}, numOfInstances)
|
var instId int32
|
||||||
|
for k := range live{
|
||||||
|
instId = k
|
||||||
|
break
|
||||||
|
}
|
||||||
|
resp, err := r.AddInstances(aurora.InstanceKey{job.JobKey(), instId}, numOfInstances)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -324,7 +329,17 @@ func main() {
|
||||||
break
|
break
|
||||||
case "update":
|
case "update":
|
||||||
fmt.Println("Updating a job with with more RAM and to 5 instances")
|
fmt.Println("Updating a job with with more RAM and to 5 instances")
|
||||||
taskConfig, err := r.FetchTaskConfig(aurora.InstanceKey{job.JobKey(), 0})
|
live, err := r.GetInstanceIds(job.JobKey(), aurora.ACTIVE_STATES)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
var instId int32
|
||||||
|
for k := range live{
|
||||||
|
instId = k
|
||||||
|
break
|
||||||
|
}
|
||||||
|
taskConfig, err := r.FetchTaskConfig(aurora.InstanceKey{job.JobKey(), instId})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -372,7 +387,17 @@ func main() {
|
||||||
break
|
break
|
||||||
case "taskConfig":
|
case "taskConfig":
|
||||||
fmt.Println("Getting job info")
|
fmt.Println("Getting job info")
|
||||||
config, err := r.FetchTaskConfig(aurora.InstanceKey{job.JobKey(), 0})
|
live, err := r.GetInstanceIds(job.JobKey(), aurora.ACTIVE_STATES)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
var instId int32
|
||||||
|
for k := range live{
|
||||||
|
instId = k
|
||||||
|
break
|
||||||
|
}
|
||||||
|
config, err := r.FetchTaskConfig(aurora.InstanceKey{job.JobKey(), instId})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
|
|
@ -327,7 +327,7 @@ func (r *realisClient) AddInstances(instKey aurora.InstanceKey, count int32) (*a
|
||||||
return response.ResponseCodeCheck(resp)
|
return response.ResponseCodeCheck(resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Scale down the number of instances under a job configuration using the configuratipn of a specific instance
|
//Scale down the number of instances under a job configuration using the configuration of a specific instance
|
||||||
func (r *realisClient) RemoveInstances(key *aurora.JobKey, count int32) (*aurora.Response, error) {
|
func (r *realisClient) RemoveInstances(key *aurora.JobKey, count int32) (*aurora.Response, error) {
|
||||||
instanceIds, err := r.GetInstanceIds(key, aurora.ACTIVE_STATES)
|
instanceIds, err := r.GetInstanceIds(key, aurora.ACTIVE_STATES)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue