Changing location from where to get thrift bidnings to that it points to github location. Ran go fmt on the entire project.

This commit is contained in:
Renan DelValle 2016-09-19 15:34:56 -04:00
parent 4408aefaad
commit 3a78e32e27
6 changed files with 16 additions and 18 deletions

View file

@ -17,14 +17,13 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
"gen-go/apache/aurora"
"github.com/rdelval/gorealis" "github.com/rdelval/gorealis"
"github.com/rdelval/gorealis/gen-go/apache/aurora"
"github.com/rdelval/gorealis/response"
"io/ioutil" "io/ioutil"
"os" "os"
"github.com/rdelval/gorealis/response"
) )
func main() { func main() {
cmd := flag.String("cmd", "", "Job request type to send to Aurora Scheduler") cmd := flag.String("cmd", "", "Job request type to send to Aurora Scheduler")
executor := flag.String("executor", "thermos", "Executor to use") executor := flag.String("executor", "thermos", "Executor to use")
@ -124,8 +123,8 @@ func main() {
} }
fmt.Println(resp.String()) fmt.Println(resp.String())
if(resp.ResponseCode == aurora.ResponseCode_OK) { if resp.ResponseCode == aurora.ResponseCode_OK {
if(!monitor.Instances(job.JobKey(), job.GetInstanceCount(), 5, 50)) { if !monitor.Instances(job.JobKey(), job.GetInstanceCount(), 5, 50) {
_, err := r.KillJob(job.JobKey()) _, err := r.KillJob(job.JobKey())
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
@ -143,8 +142,8 @@ func main() {
os.Exit(1) os.Exit(1)
} }
if(resp.ResponseCode == aurora.ResponseCode_OK) { if resp.ResponseCode == aurora.ResponseCode_OK {
if(!monitor.Instances(job.JobKey(), 0, 5, 50)) { if !monitor.Instances(job.JobKey(), 0, 5, 50) {
fmt.Println("Unable to kill all instances of job") fmt.Println("Unable to kill all instances of job")
os.Exit(1) os.Exit(1)
} }
@ -193,8 +192,8 @@ func main() {
os.Exit(1) os.Exit(1)
} }
if(resp.ResponseCode == aurora.ResponseCode_OK) { if resp.ResponseCode == aurora.ResponseCode_OK {
if(!monitor.Instances(job.JobKey(), job.GetInstanceCount()+numOfInstances, 5, 50)) { if !monitor.Instances(job.JobKey(), job.GetInstanceCount()+numOfInstances, 5, 50) {
fmt.Println("Flexing up failed") fmt.Println("Flexing up failed")
} }
} }

2
job.go
View file

@ -15,7 +15,7 @@
package realis package realis
import ( import (
"gen-go/apache/aurora" "github.com/rdelval/gorealis/gen-go/apache/aurora"
"strconv" "strconv"
) )

View file

@ -17,7 +17,7 @@ package realis
import ( import (
"fmt" "fmt"
"gen-go/apache/aurora" "github.com/rdelval/gorealis/gen-go/apache/aurora"
"github.com/rdelval/gorealis/response" "github.com/rdelval/gorealis/response"
"os" "os"
"time" "time"
@ -62,7 +62,6 @@ func (m *Monitor) JobUpdate(updateKey aurora.JobUpdateKey, interval int, timeout
return false return false
} }
func (m *Monitor) Instances(key *aurora.JobKey, instances int32, interval int, timeout int) bool { func (m *Monitor) Instances(key *aurora.JobKey, instances int32, interval int, timeout int) bool {
for i := 0; i*interval < timeout; i++ { for i := 0; i*interval < timeout; i++ {
@ -74,7 +73,7 @@ func (m *Monitor) Instances(key *aurora.JobKey, instances int32, interval int, t
os.Exit(1) os.Exit(1)
} }
if(len(live) == int(instances)){ if len(live) == int(instances) {
return true return true
} }

View file

@ -18,9 +18,9 @@ package realis
import ( import (
"encoding/base64" "encoding/base64"
"fmt" "fmt"
"gen-go/apache/aurora"
"git.apache.org/thrift.git/lib/go/thrift" "git.apache.org/thrift.git/lib/go/thrift"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/rdelval/gorealis/gen-go/apache/aurora"
"net/http" "net/http"
"net/http/cookiejar" "net/http/cookiejar"
"os" "os"
@ -32,7 +32,7 @@ type Realis interface {
AddInstances(instKey aurora.InstanceKey, count int32) (*aurora.Response, error) AddInstances(instKey aurora.InstanceKey, count int32) (*aurora.Response, error)
CreateJob(auroraJob Job) (*aurora.Response, error) CreateJob(auroraJob Job) (*aurora.Response, error)
FetchTaskConfig(instKey aurora.InstanceKey) (*aurora.TaskConfig, error) FetchTaskConfig(instKey aurora.InstanceKey) (*aurora.TaskConfig, error)
GetInstanceIds(key *aurora.JobKey, states map[aurora.ScheduleStatus]bool) (map[int32]bool, error) GetInstanceIds(key *aurora.JobKey, states map[aurora.ScheduleStatus]bool) (map[int32]bool, error)
JobUpdateDetails(updateKey aurora.JobUpdateKey) (*aurora.Response, error) JobUpdateDetails(updateKey aurora.JobUpdateKey) (*aurora.Response, error)
KillJob(key *aurora.JobKey) (*aurora.Response, error) KillJob(key *aurora.JobKey) (*aurora.Response, error)
KillInstances(key *aurora.JobKey, instances ...int32) (*aurora.Response, error) KillInstances(key *aurora.JobKey, instances ...int32) (*aurora.Response, error)
@ -287,5 +287,5 @@ func (r realisClient) JobUpdateDetails(updateKey aurora.JobUpdateKey) (*aurora.R
return nil, errors.Wrap(err, "Unable to get job update details") return nil, errors.Wrap(err, "Unable to get job update details")
} }
return resp,nil return resp, nil
} }

View file

@ -16,7 +16,7 @@
package response package response
import ( import (
"gen-go/apache/aurora" "github.com/rdelval/gorealis/gen-go/apache/aurora"
) )
// Get key from a response created by a StartJobUpdate call // Get key from a response created by a StartJobUpdate call

View file

@ -15,7 +15,7 @@
package realis package realis
import ( import (
"gen-go/apache/aurora" "github.com/rdelval/gorealis/gen-go/apache/aurora"
) )
// Structure to collect all information required to create job update // Structure to collect all information required to create job update