Ran go fmt on project. Changed FechTaskConfig to only fetch configurations in an existing state

This commit is contained in:
Renan DelValle 2016-08-24 17:21:59 -07:00
parent d810808b68
commit bb3b26340d
3 changed files with 9 additions and 9 deletions

View file

@ -43,8 +43,8 @@ func main() {
os.Exit(1)
}
cluster, ok := clusters[*clusterName];
if(!ok) {
cluster, ok := clusters[*clusterName]
if !ok {
fmt.Printf("Cluster %s chosen doesn't exist\n", *clusterName)
os.Exit(1)
}

View file

@ -238,17 +238,17 @@ func (r realisClient) FetchTaskConfig(instKey aurora.InstanceKey) (*aurora.TaskC
taskQ := &aurora.TaskQuery{Role: instKey.JobKey.Role,
Environment: instKey.JobKey.Environment,
JobName: instKey.JobKey.Name,
InstanceIds: ids, }
InstanceIds: ids,
Statuses: aurora.ACTIVE_STATES}
response, err := r.client.GetTasksStatus(taskQ)
if err != nil {
return nil, errors.Wrap(err, "Error querying Aurora Scheduler for task configuration")
}
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",
instKey.InstanceId,
instKey.JobKey.Environment,

View file

@ -21,7 +21,7 @@ import (
// Structure to collect all information required to create job update
type UpdateJob struct {
Job // SetInstanceCount for job is hidden, access via full qualifier
req *aurora.JobUpdateRequest
req *aurora.JobUpdateRequest
}
// Create a default UpdateJob object.
@ -36,17 +36,17 @@ func NewUpdateJob(config *aurora.TaskConfig) *UpdateJob {
// Rebuild resource map from TaskConfig
for ptr := range config.Resources {
if(ptr.NumCpus != nil){
if ptr.NumCpus != nil {
job.resources["cpu"].NumCpus = ptr.NumCpus
continue // Guard against Union violations that Go won't enforce
}
if(ptr.RamMb != nil){
if ptr.RamMb != nil {
job.resources["ram"].RamMb = ptr.RamMb
continue
}
if(ptr.DiskMb != nil){
if ptr.DiskMb != nil {
job.resources["disk"].DiskMb = ptr.DiskMb
continue
}