forked from phc/cluster-dashboard
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
package executor
|
|
|
|
import "time"
|
|
|
|
var _ Service = &Mock{}
|
|
|
|
type Mock struct {
|
|
SlurmQueueFunc func() []string
|
|
SlurmJobsFunc func() []string
|
|
NodeUptimeFunc func(hostname string) time.Time
|
|
TemperatureFunc func(hostname string) float64
|
|
MemoryUsageFunc func(hostname string) int64
|
|
StorageUsageFunc func(hostname string) int64
|
|
NetworkUploadDownloadFunc func(hostname string) (int64, int64)
|
|
}
|
|
|
|
func (ex *Mock) SlurmQueue() []string {
|
|
return ex.SlurmQueueFunc()
|
|
}
|
|
|
|
func (ex *Mock) SlurmJobs() []string {
|
|
return ex.SlurmJobsFunc()
|
|
}
|
|
|
|
func (ex *Mock) NodeUptime(hostname string) time.Time {
|
|
return ex.NodeUptimeFunc(hostname)
|
|
}
|
|
|
|
func (ex *Mock) Temperature(hostname string) float64 {
|
|
return ex.TemperatureFunc(hostname)
|
|
}
|
|
|
|
func (ex *Mock) MemoryUsage(hostname string) int64 {
|
|
return ex.MemoryUsageFunc(hostname)
|
|
}
|
|
|
|
func (ex *Mock) StorageUsage(hostname string) int64 {
|
|
return ex.StorageUsageFunc(hostname)
|
|
}
|
|
|
|
func (ex *Mock) NetworkUploadDownload(hostname string) (int64, int64) {
|
|
return ex.NetworkUploadDownloadFunc(hostname)
|
|
}
|