/
main.go
44 lines (36 loc) · 1.09 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
package main
import (
"log"
"os"
docopt "github.com/docopt/docopt-go"
"github.com/taskcluster/taskcluster/v44/internal"
"github.com/taskcluster/taskcluster/v44/tools/worker-runner/logging"
"github.com/taskcluster/taskcluster/v44/tools/worker-runner/runner"
"github.com/taskcluster/taskcluster/v44/tools/worker-runner/util"
)
func Usage() string {
return `
The start-worker command starts Taskcluster workers. It is typically invoked
during instance startup. See the Taskcluster reference documentation for your
deployment for details on how to use this tool.
Usage:
start-worker <runnerConfig>
`
}
func main() {
logging.PatchStdLogger(nil)
if err := util.DisableOOM(os.Getpid()); err != nil {
log.Printf("Error disabling OOM killer for the start-worker process: %v", err)
}
opts, err := docopt.ParseArgs(Usage(), os.Args[1:], "start-worker "+internal.Version)
if err != nil {
log.Printf("Error parsing command-line arguments: %s", err)
os.Exit(1)
}
filename := opts["<runnerConfig>"].(string)
_, err = runner.Run(filename)
if err != nil {
log.Printf("%s", err)
os.Exit(1)
}
}