Fix app
This commit is contained in:
parent
c95a4dea67
commit
c96bc7ad8f
6
app.go
6
app.go
|
@ -5,7 +5,9 @@ import (
|
|||
|
||||
"github.com/kr/pretty"
|
||||
"github.com/localhots/confection"
|
||||
"github.com/localhots/yeast/chain"
|
||||
"github.com/localhots/yeast/core"
|
||||
"github.com/localhots/yeast/unit"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -15,8 +17,8 @@ func init() {
|
|||
|
||||
func main() {
|
||||
core.InitConfig()
|
||||
core.LoadUnits()
|
||||
core.ParseChains()
|
||||
unit.LoadUnits(core.Conf().UnitsConfig)
|
||||
chain.LoadChains(core.Conf().ChainsConfig)
|
||||
|
||||
pretty.Println(core.Conf())
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ import (
|
|||
"os"
|
||||
"os/exec"
|
||||
"time"
|
||||
|
||||
"github.com/localhots/yeast/unit"
|
||||
)
|
||||
|
||||
type (
|
||||
|
@ -13,19 +15,19 @@ type (
|
|||
|
||||
// XXX: We're about to spawn hundreds of Python processes
|
||||
func (s *Supervisor) StartAll() {
|
||||
for unit, _ := range Units {
|
||||
s.Start(unit)
|
||||
for _, name := range unit.Units() {
|
||||
s.Start(name)
|
||||
time.Sleep(500 * time.Millisecond) // Don't spawn processes too fast
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Supervisor) Start(unit string) {
|
||||
fmt.Println("Starting unit: " + unit)
|
||||
func (s *Supervisor) Start(name string) {
|
||||
fmt.Println("Starting unit: " + name)
|
||||
conf := Conf().Python
|
||||
cmd := exec.Command(conf.BinPath, conf.WrapperPath, unit)
|
||||
cmd := exec.Command(conf.BinPath, conf.WrapperPath, name)
|
||||
cmd.Stdout = os.Stdout // Sorry
|
||||
if err := cmd.Start(); err != nil {
|
||||
fmt.Println("Failed to start unit: ", unit)
|
||||
fmt.Println("Failed to start unit: ", name)
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue