-
Notifications
You must be signed in to change notification settings - Fork 134
/
main.go
54 lines (43 loc) · 1.29 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
package main
import (
"os"
"os/signal"
"syscall"
"github.com/spf13/pflag"
"github.com/spf13/viper"
"github.com/armadaproject/armada/internal/common"
"github.com/armadaproject/armada/internal/executor/configuration"
"github.com/armadaproject/armada/internal/executor/fake"
"github.com/armadaproject/armada/internal/executor/fake/context"
)
const CustomConfigLocation string = "config"
func init() {
pflag.StringSlice(
CustomConfigLocation,
[]string{},
"Fully qualified path to application configuration file (for multiple config files repeat this arg or separate paths with commas)",
)
pflag.Parse()
}
func main() {
common.ConfigureLogging()
common.BindCommandlineArguments()
var config configuration.ExecutorConfiguration
userSpecifiedConfigs := viper.GetStringSlice(CustomConfigLocation)
v := common.LoadConfig(&config, "./config/executor", userSpecifiedConfigs)
var nodes []*context.NodeSpec
e := common.UnmarshalKey(v, "nodes", &nodes)
if e != nil {
panic(e)
}
shutdownChannel := make(chan os.Signal, 1)
signal.Notify(shutdownChannel, syscall.SIGINT, syscall.SIGTERM)
shutdownMetricServer := common.ServeMetrics(config.Metric.Port)
defer shutdownMetricServer()
shutdown, wg := fake.StartUp(config, nodes)
go func() {
<-shutdownChannel
shutdown()
}()
wg.Wait()
}