Пример #1
0
func (w *Worker) Status(req *WorkerStatusRequest, rep *WorkerStatusResponse) error {
	w.mirrors.Status(req, rep)

	// TODO - pass WorkerOptions out.
	rep.MaxJobCount = w.options.Jobs
	rep.Version = Version()
	rep.Accepting = w.accepting
	rep.CpuStats = w.stats.CpuStats()
	rep.DiskStats = w.stats.DiskStats()
	rep.PhaseCounts = w.stats.PhaseCounts()
	rep.PhaseNames = w.stats.PhaseOrder
	rep.TotalCpu = *stats.TotalCpuStat()
	rep.MemStat = *stats.GetMemStat()
	return nil
}
Пример #2
0
func (me *Worker) PeriodicHouseholding() {
	for me.accepting {
		me.Report()
		if me.options.HeapLimit > 0 {
			heap := stats.GetMemStat().Total()
			if heap > me.options.HeapLimit {
				log.Println("Exceeded heap limit. Restarting...")
				me.shutdown(true, false)
			}
		}

		c := time.After(me.options.ReportInterval)
		<-c
	}
}
Пример #3
0
func (me *Worker) Status(req *WorkerStatusRequest, rep *WorkerStatusResponse) error {
	me.mirrors.Status(req, rep)

	// TODO - pass WorkerOptions out.
	rep.MaxJobCount = me.options.Jobs
	rep.Version = Version()
	rep.Accepting = me.accepting
	rep.CpuStats = me.stats.CpuStats()
	rep.DiskStats = me.stats.DiskStats()
	rep.PhaseCounts = me.stats.PhaseCounts()
	rep.PhaseNames = me.stats.PhaseOrder
	rep.TotalCpu = *stats.TotalCpuStat()
	rep.ContentCacheHitRate = me.content.MemoryHitRate()
	rep.ContentCacheHitAge = me.content.MemoryHitAge()
	rep.MemStat = *stats.GetMemStat()
	return nil
}