예제 #1
0
파일: agent.go 프로젝트: kapalhq/mozo
// 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),
	}
}
예제 #2
0
파일: new_job.go 프로젝트: kapalhq/mozo
// TODO(javier): Quick and dirty
func addJob(c *cli.Context) {
	//fmt.Println(spew.Sdump(c))
	var location string
	if len(c.Args()) == 0 {
		// lets assume you want to load batch files in the current dir
		location = "."
	} else {
		location = c.Args()[0] //TODO(javier): fix this
	}
	xchronoConfig := lookupXChronosConfig()
	jobConfig := parseJobs(location)
	//log.Println(spew.Sdump(jobConfig[0].Jobs[0]))
	fmt.Printf("Found %d batch files \n", len(jobConfig))

	proxy := cluster.NewEtcdClient(xchronoConfig.JobStore)
	fmt.Printf("==> Registering job: %s ...", jobConfig[0].Jobs[0].Name)
	proxy.RegisterJob(scheduler.NewJobFromConfig(jobConfig[0].Jobs[0]))
}
예제 #3
0
파일: rm_job.go 프로젝트: kapalhq/mozo
// TODO(javier): Quick and dirty
func rmJob(c *cli.Context) {
	xchronosConfig := lookupXChronosConfig()
	proxy := cluster.NewEtcdClient(xchronosConfig.JobStore)
	proxy.UnregisterJobs()
}