Initial commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package executor
|
||||
|
||||
import "time"
|
||||
|
||||
// Service is a service that handles executing commands on the main host and does a first processing of the raw data it gets from the system
|
||||
type Service interface {
|
||||
SlurmQueue() []string
|
||||
SlurmJobs() []string
|
||||
|
||||
NodeUptime(hostname string) time.Time
|
||||
|
||||
Temperature(hostname string) float64
|
||||
MemoryUsage(hostname string) int64
|
||||
StorageUsage(hostname string) int64
|
||||
NetworkUploadDownload(hostname string) (int64, int64)
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user