Esempio n. 1
0
// SlaveHostsCfgPoller periodically reads the slave_hosts_cfg.py file from the
// repo. It does NOT update the repository; it is assumed that the caller takes
// care of that.
func SlaveHostsCfgPoller(workdir string) (*util.PollingStatus, error) {
	var v map[string]*SlaveHost
	return util.NewPollingStatus(&v, func(value interface{}) error {
		cfg, err := GetSlaveHostsCfg(workdir)
		if err != nil {
			return err
		}
		*value.(*map[string]*SlaveHost) = cfg
		return nil
	}, 5*time.Minute)
}
Esempio n. 2
0
func AutoRollStatusPoller() (*util.PollingStatus, error) {
	var v []*AutoRollIssue
	return util.NewPollingStatus(&v, func(value interface{}) error {
		res, err := GetLastNRolls(POLLER_ROLLS_LIMIT)
		if err != nil {
			return err
		}
		*value.(*[]*AutoRollIssue) = res
		return nil
	}, 1*time.Minute)
}
Esempio n. 3
0
// AndroidDeviceCfgPoller periodically reads the android_devices.py file from
// the repo using Gitiles.
func AndroidDeviceCfgPoller(workdir string) (*util.PollingStatus, error) {
	var v map[string]*AndroidDeviceCfg
	return util.NewPollingStatus(&v, func(value interface{}) error {
		cfg, err := GetAndroidDeviceCfg(workdir)
		if err != nil {
			return err
		}
		*value.(*map[string]*AndroidDeviceCfg) = cfg
		return nil
	}, 5*time.Minute)
}
Esempio n. 4
0
// AndroidDeviceCfgPoller periodically reads the android_devices.py file from
// the repo using Gitiles.
func AndroidDeviceCfgPoller(workdir string) (*util.PollingStatus, error) {
	return util.NewPollingStatus(func() (interface{}, error) {
		return GetAndroidDeviceCfg(workdir)
	}, 5*time.Minute)
}
// PollingStatus is a convenience struct used for periodically querying
// InfluxDB.
func NewPollingStatus(value interface{}, query string, dbClient *Client) (*util.PollingStatus, error) {
	return util.NewPollingStatus(value, makePollFn(query, dbClient), time.Minute)
}
Esempio n. 6
0
// PollingStatus returns a util.PollingStatus which runs the given
// query at the given interval.
func (c *Client) Int64PollingStatus(query string, interval time.Duration) (*util.PollingStatus, error) {
	return util.NewPollingStatus(func() (interface{}, error) {
		return c.QueryInt64(query)
	}, interval)
}
Esempio n. 7
0
// SlaveHostsCfgPoller periodically reads the slave_hosts_cfg.py file from the
// repo. It does NOT update the repository; it is assumed that the caller takes
// care of that.
func SlaveHostsCfgPoller(workdir string) (*util.PollingStatus, error) {
	return util.NewPollingStatus(func() (interface{}, error) {
		return GetSlaveHostsCfg(workdir)
	}, 5*time.Minute)
}