Ran go fmt on project. Changed FechTaskConfig to only fetch configurations in an existing state
This commit is contained in:
parent
d810808b68
commit
bb3b26340d
3 changed files with 9 additions and 9 deletions
|
@ -43,8 +43,8 @@ func main() {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
cluster, ok := clusters[*clusterName];
|
cluster, ok := clusters[*clusterName]
|
||||||
if(!ok) {
|
if !ok {
|
||||||
fmt.Printf("Cluster %s chosen doesn't exist\n", *clusterName)
|
fmt.Printf("Cluster %s chosen doesn't exist\n", *clusterName)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,17 +238,17 @@ func (r realisClient) FetchTaskConfig(instKey aurora.InstanceKey) (*aurora.TaskC
|
||||||
taskQ := &aurora.TaskQuery{Role: instKey.JobKey.Role,
|
taskQ := &aurora.TaskQuery{Role: instKey.JobKey.Role,
|
||||||
Environment: instKey.JobKey.Environment,
|
Environment: instKey.JobKey.Environment,
|
||||||
JobName: instKey.JobKey.Name,
|
JobName: instKey.JobKey.Name,
|
||||||
InstanceIds: ids, }
|
InstanceIds: ids,
|
||||||
|
Statuses: aurora.ACTIVE_STATES}
|
||||||
|
|
||||||
response, err := r.client.GetTasksStatus(taskQ)
|
response, err := r.client.GetTasksStatus(taskQ)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "Error querying Aurora Scheduler for task configuration")
|
return nil, errors.Wrap(err, "Error querying Aurora Scheduler for task configuration")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tasks := response.GetResult_().GetScheduleStatusResult_().GetTasks()
|
tasks := response.GetResult_().GetScheduleStatusResult_().GetTasks()
|
||||||
|
|
||||||
if(len(tasks) == 0) {
|
if len(tasks) == 0 {
|
||||||
return nil, errors.Errorf("Instance %d for jobkey %s/%s/%s doesn't exist",
|
return nil, errors.Errorf("Instance %d for jobkey %s/%s/%s doesn't exist",
|
||||||
instKey.InstanceId,
|
instKey.InstanceId,
|
||||||
instKey.JobKey.Environment,
|
instKey.JobKey.Environment,
|
||||||
|
|
|
@ -21,7 +21,7 @@ import (
|
||||||
// Structure to collect all information required to create job update
|
// Structure to collect all information required to create job update
|
||||||
type UpdateJob struct {
|
type UpdateJob struct {
|
||||||
Job // SetInstanceCount for job is hidden, access via full qualifier
|
Job // SetInstanceCount for job is hidden, access via full qualifier
|
||||||
req *aurora.JobUpdateRequest
|
req *aurora.JobUpdateRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a default UpdateJob object.
|
// Create a default UpdateJob object.
|
||||||
|
@ -36,17 +36,17 @@ func NewUpdateJob(config *aurora.TaskConfig) *UpdateJob {
|
||||||
|
|
||||||
// Rebuild resource map from TaskConfig
|
// Rebuild resource map from TaskConfig
|
||||||
for ptr := range config.Resources {
|
for ptr := range config.Resources {
|
||||||
if(ptr.NumCpus != nil){
|
if ptr.NumCpus != nil {
|
||||||
job.resources["cpu"].NumCpus = ptr.NumCpus
|
job.resources["cpu"].NumCpus = ptr.NumCpus
|
||||||
continue // Guard against Union violations that Go won't enforce
|
continue // Guard against Union violations that Go won't enforce
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ptr.RamMb != nil){
|
if ptr.RamMb != nil {
|
||||||
job.resources["ram"].RamMb = ptr.RamMb
|
job.resources["ram"].RamMb = ptr.RamMb
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ptr.DiskMb != nil){
|
if ptr.DiskMb != nil {
|
||||||
job.resources["disk"].DiskMb = ptr.DiskMb
|
job.resources["disk"].DiskMb = ptr.DiskMb
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue