Exemple #1
0
func NotifyOnChange(be Backend, obs Configurable) chan error {
	errorC := make(chan error, 1)

	configurator := &Configurator{
		backend:     be,
		observer:    obs,
		taskManager: task.NewTaskManager(),
	}

	t := configurator.addWatchOnChangeProxy()
	go func() {
		for err := range t.ErrorChan() {
			errorC <- err
		}
	}()
	return errorC
}
Exemple #2
0
// etcdNotes = strings.Split(os.Getenv("ETCD_NOTES"), ",")
func New(id string, etcdNodes []string, verbose bool) *Agent {
	localIp, err := GetLocalIPv4()
	if err != nil {
		panic(err)
	}

	return &Agent{
		ID:            id,
		IPv4:          localIp,
		state:         "_init",
		clusterClient: cluster.NewEtcdClient(etcdNodes),
		taskManager:   task.NewTaskManager(),
		jobScheduler:  scheduler.NewScheduler(),
		verbose:       verbose,
		jobSupervisor: new(supervisor.Supervisor),
	}
}