-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.go
77 lines (63 loc) · 1.71 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package main
import (
"flag"
"github.com/golang/protobuf/proto"
"github.com/mesos/mesos-go/mesosproto"
"github.com/mesos/mesos-go/mesosutil"
"github.com/mesos/mesos-go/scheduler"
"github.com/sayden/minimal-mesos-go-framework/example_scheduler"
"os"
log "github.com/Sirupsen/logrus"
)
var (
master = flag.String("master", "127.0.0.1:5050", "Master address <ip:port>")
)
func init() {
flag.Parse()
}
func main() {
//ExecutorInfo
executorUri := "http://s3-eu-west-1.amazonaws.com/enablers/executor"
executorUris := []*mesosproto.CommandInfo_URI{
{
Value: &executorUri,
Executable: proto.Bool(true),
},
}
executorInfo := &mesosproto.ExecutorInfo{
ExecutorId: mesosutil.NewExecutorID("default"),
Name: proto.String("Test Executor (Go)"),
Source: proto.String("go_test"),
Command: &mesosproto.CommandInfo{
Value: proto.String("./executor"),
Uris: executorUris,
},
}
//Scheduler
my_scheduler := &example_scheduler.ExampleScheduler{
ExecutorInfo: executorInfo,
NeededCpu: 0.5,
NeededRam: 128.0,
}
//Framework
frameworkInfo := &mesosproto.FrameworkInfo{
User: proto.String("root"), // Mesos-go will fill in user.
Name: proto.String("Stratio Server Framework (Go)"),
}
//Scheduler Driver
config := scheduler.DriverConfig{
Scheduler: my_scheduler,
Framework: frameworkInfo,
Master: *master,
Credential: (*mesosproto.Credential)(nil),
}
driver, err := scheduler.NewMesosSchedulerDriver(config)
if err != nil {
log.Fatalf("Unable to create a SchedulerDriver: %v\n", err.Error())
os.Exit(-3)
}
if stat, err := driver.Run(); err != nil {
log.Fatalf("Framework stopped with status %s and error: %s\n", stat.String(), err.Error())
os.Exit(-4)
}
}