Skip to content

Commit

Permalink
add sysapps (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
chensheng0 authored Jan 11, 2021
1 parent 37a7294 commit aa00359
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions spec/v1/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,24 @@ import (

// maxJSONLevel the max level of json
const (
maxJSONLevel = 5
milliPrecision = 1000
KeySyncMode = "syncMode"
CloudMode SyncMode = "cloud"
LocalMode SyncMode = "local"
KeyNodeProps = "nodeprops"
KeyDevices = "devices"
KeyApps = "apps"
KeySysApps = "sysapps"
KeyAppStats = "appstats"
KeySysAppStats = "sysappstats"
KeyAccelerator = "accelerator"
NVAccelerator = "nvidia"
ResourceGPU = "gpu"
KeyGPUUsedMemory = "usedMemory"
KeyGPUTotalMemory = "totalMemory"
KeyGPUPercent = "percent"
maxJSONLevel = 5
milliPrecision = 1000
KeySyncMode = "syncMode"
CloudMode SyncMode = "cloud"
LocalMode SyncMode = "local"
KeyNodeProps = "nodeprops"
KeyDevices = "devices"
KeyApps = "apps"
KeySysApps = "sysapps"
KeyAppStats = "appstats"
KeySysAppStats = "sysappstats"
KeyAccelerator = "accelerator"
KeyOptionalSysApps = "optionalSysApps"
NVAccelerator = "nvidia"
ResourceGPU = "gpu"
KeyGPUUsedMemory = "usedMemory"
KeyGPUTotalMemory = "totalMemory"
KeyGPUPercent = "percent"
)

type SyncMode string
Expand All @@ -52,6 +53,7 @@ type Node struct {
Attributes map[string]interface{} `json:"attr,omitempty" yaml:"attr,omitempty"`
Report Report `json:"report,omitempty" yaml:"report,omitempty"`
Desire Desire `json:"desire,omitempty" yaml:"desire,omitempty"`
OptionalSysApps []string `json:"optionalSysApps,omitempty" yaml:"optionalSysApps,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
}

Expand All @@ -65,6 +67,7 @@ type NodeView struct {
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
Report *ReportView `json:"report,omitempty" yaml:"report,omitempty"`
Desire Desire `json:"desire,omitempty" yaml:"desire,omitempty"`
OptionalSysApps []string `json:"optionalSysApps,omitempty" yaml:"optionalSysApps,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Ready bool `json:"ready"`
Mode SyncMode `json:"mode"`
Expand Down Expand Up @@ -228,6 +231,9 @@ func (n *Node) View(timeout time.Duration) (*NodeView, error) {
if val, ok := attr[KeyAccelerator]; ok {
view.Accelerator, _ = val.(string)
}
if val, ok := attr[KeyOptionalSysApps]; ok {
view.OptionalSysApps, _ = val.([]string)
}
}
if err = view.populateNodeStats(timeout); err != nil {
return nil, errors.Trace(err)
Expand Down

0 comments on commit aa00359

Please sign in to comment.