-
Notifications
You must be signed in to change notification settings - Fork 721
feat: add mark health device function #1241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -36,6 +36,18 @@ type Device struct { | |||||
Replicas int | ||||||
} | ||||||
|
||||||
type DeviceEventType int | ||||||
|
||||||
const ( | ||||||
DeviceUnHalthy DeviceEventType = iota | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The constant name 'DeviceUnHalthy' contains a spelling error. It should be 'DeviceUnhealthy' (lowercase 'h').
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
DeviceHealthy | ||||||
) | ||||||
|
||||||
type DeviceEvent struct { | ||||||
Device *Device | ||||||
Event DeviceEventType | ||||||
} | ||||||
|
||||||
// deviceInfo defines the information the required to construct a Device | ||||||
type deviceInfo interface { | ||||||
GetUUID() (string, error) | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -33,10 +33,14 @@ const ( | |||||
// this is in addition to the Application errors that are already ignored. | ||||||
envDisableHealthChecks = "DP_DISABLE_HEALTHCHECKS" | ||||||
allHealthChecks = "xids" | ||||||
|
||||||
nvmlEventTypeGpuRecoveryAction = 0x0000000000008000 // from https://docs.nvidia.com/deploy/nvml-api/group__nvmlEventType.html? | ||||||
|
||||||
nvmlEventTypeGpuUnavailableError = 0x0000000000004000 | ||||||
) | ||||||
|
||||||
// CheckHealth performs health checks on a set of devices, writing to the 'unhealthy' channel with any unhealthy devices | ||||||
func (r *nvmlResourceManager) checkHealth(stop <-chan interface{}, devices Devices, unhealthy chan<- *Device) error { | ||||||
func (r *nvmlResourceManager) checkHealth(stop <-chan interface{}, devices Devices, unhealthy chan<- *DeviceEvent) error { | ||||||
disableHealthChecks := strings.ToLower(os.Getenv(envDisableHealthChecks)) | ||||||
if disableHealthChecks == "all" { | ||||||
disableHealthChecks = allHealthChecks | ||||||
|
@@ -92,12 +96,15 @@ func (r *nvmlResourceManager) checkHealth(stop <-chan interface{}, devices Devic | |||||
deviceIDToGiMap := make(map[string]uint32) | ||||||
deviceIDToCiMap := make(map[string]uint32) | ||||||
|
||||||
eventMask := uint64(nvml.EventTypeXidCriticalError | nvml.EventTypeDoubleBitEccError | nvml.EventTypeSingleBitEccError) | ||||||
eventMask := uint64(nvml.EventTypeXidCriticalError | nvml.EventTypeDoubleBitEccError | nvml.EventTypeSingleBitEccError | nvmlEventTypeGpuUnavailableError | nvmlEventTypeGpuRecoveryAction) | ||||||
for _, d := range devices { | ||||||
uuid, gi, ci, err := r.getDevicePlacement(d) | ||||||
if err != nil { | ||||||
klog.Warningf("Could not determine device placement for %v: %v; Marking it unhealthy.", d.ID, err) | ||||||
unhealthy <- d | ||||||
unhealthy <- &DeviceEvent{ | ||||||
Device: d, | ||||||
Event: DeviceUnHalthy, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The constant name 'DeviceUnHalthy' contains a spelling error. It should be 'DeviceUnhealthy' (lowercase 'h'). Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
} | ||||||
continue | ||||||
} | ||||||
deviceIDToGiMap[d.ID] = gi | ||||||
|
@@ -107,14 +114,20 @@ func (r *nvmlResourceManager) checkHealth(stop <-chan interface{}, devices Devic | |||||
gpu, ret := r.nvml.DeviceGetHandleByUUID(uuid) | ||||||
if ret != nvml.SUCCESS { | ||||||
klog.Infof("unable to get device handle from UUID: %v; marking it as unhealthy", ret) | ||||||
unhealthy <- d | ||||||
unhealthy <- &DeviceEvent{ | ||||||
Device: d, | ||||||
Event: DeviceUnHalthy, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The constant name 'DeviceUnHalthy' contains a spelling error. It should be 'DeviceUnhealthy' (lowercase 'h'). Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
} | ||||||
continue | ||||||
} | ||||||
|
||||||
supportedEvents, ret := gpu.GetSupportedEventTypes() | ||||||
if ret != nvml.SUCCESS { | ||||||
klog.Infof("unable to determine the supported events for %v: %v; marking it as unhealthy", d.ID, ret) | ||||||
unhealthy <- d | ||||||
unhealthy <- &DeviceEvent{ | ||||||
Device: d, | ||||||
Event: DeviceUnHalthy, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The constant name 'DeviceUnHalthy' contains a spelling error. It should be 'DeviceUnhealthy' (lowercase 'h'). Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
} | ||||||
continue | ||||||
} | ||||||
|
||||||
|
@@ -124,7 +137,10 @@ func (r *nvmlResourceManager) checkHealth(stop <-chan interface{}, devices Devic | |||||
} | ||||||
if ret != nvml.SUCCESS { | ||||||
klog.Infof("Marking device %v as unhealthy: %v", d.ID, ret) | ||||||
unhealthy <- d | ||||||
unhealthy <- &DeviceEvent{ | ||||||
Device: d, | ||||||
Event: DeviceUnHalthy, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The constant name 'DeviceUnHalthy' contains a spelling error. It should be 'DeviceUnhealthy' (lowercase 'h'). Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
|
@@ -142,16 +158,14 @@ func (r *nvmlResourceManager) checkHealth(stop <-chan interface{}, devices Devic | |||||
if ret != nvml.SUCCESS { | ||||||
klog.Infof("Error waiting for event: %v; Marking all devices as unhealthy", ret) | ||||||
for _, d := range devices { | ||||||
unhealthy <- d | ||||||
unhealthy <- &DeviceEvent{ | ||||||
Device: d, | ||||||
Event: DeviceUnHalthy, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The constant name 'DeviceUnHalthy' contains a spelling error. It should be 'DeviceUnhealthy' (lowercase 'h'). Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
} | ||||||
} | ||||||
continue | ||||||
} | ||||||
|
||||||
if e.EventType != nvml.EventTypeXidCriticalError { | ||||||
klog.Infof("Skipping non-nvmlEventTypeXidCriticalError event: %+v", e) | ||||||
continue | ||||||
} | ||||||
|
||||||
if skippedXids[e.EventData] { | ||||||
klog.Infof("Skipping event %+v", e) | ||||||
continue | ||||||
|
@@ -163,7 +177,10 @@ func (r *nvmlResourceManager) checkHealth(stop <-chan interface{}, devices Devic | |||||
// If we cannot reliably determine the device UUID, we mark all devices as unhealthy. | ||||||
klog.Infof("Failed to determine uuid for event %v: %v; Marking all devices as unhealthy.", e, ret) | ||||||
for _, d := range devices { | ||||||
unhealthy <- d | ||||||
unhealthy <- &DeviceEvent{ | ||||||
Device: d, | ||||||
Event: DeviceUnHalthy, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The constant name 'DeviceUnHalthy' contains a spelling error. It should be 'DeviceUnhealthy' (lowercase 'h').
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
} | ||||||
} | ||||||
continue | ||||||
} | ||||||
|
@@ -173,6 +190,30 @@ func (r *nvmlResourceManager) checkHealth(stop <-chan interface{}, devices Devic | |||||
klog.Infof("Ignoring event for unexpected device: %v", eventUUID) | ||||||
continue | ||||||
} | ||||||
// nvmlEventTypeRecovery is a special case, where we mark the device as healthy. | ||||||
if e.EventType == nvmlEventTypeGpuRecoveryAction { | ||||||
klog.Infof("Gpu recovery event: %+v", e) | ||||||
unhealthy <- &DeviceEvent{ | ||||||
Device: d, | ||||||
Event: DeviceHealthy, | ||||||
} | ||||||
continue | ||||||
|
||||||
} | ||||||
|
||||||
if e.EventType == nvmlEventTypeGpuUnavailableError { | ||||||
klog.Infof("Gpu unavailable event: %+v", e) | ||||||
unhealthy <- &DeviceEvent{ | ||||||
Device: d, | ||||||
Event: DeviceUnHalthy, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The constant name 'DeviceUnHalthy' contains a spelling error. It should be 'DeviceUnhealthy' (lowercase 'h'). Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
} | ||||||
continue | ||||||
} | ||||||
|
||||||
if e.EventType != nvml.EventTypeXidCriticalError { | ||||||
klog.Infof("Skipping non-nvmlEventTypeXidCriticalError event: %+v", e) | ||||||
continue | ||||||
} | ||||||
|
||||||
if d.IsMigDevice() && e.GpuInstanceId != 0xFFFFFFFF && e.ComputeInstanceId != 0xFFFFFFFF { | ||||||
gi := deviceIDToGiMap[d.ID] | ||||||
|
@@ -184,7 +225,10 @@ func (r *nvmlResourceManager) checkHealth(stop <-chan interface{}, devices Devic | |||||
} | ||||||
|
||||||
klog.Infof("XidCriticalError: Xid=%d on Device=%s; marking device as unhealthy.", e.EventData, d.ID) | ||||||
unhealthy <- d | ||||||
unhealthy <- &DeviceEvent{ | ||||||
Device: d, | ||||||
Event: DeviceUnHalthy, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The constant name 'DeviceUnHalthy' contains a spelling error. It should be 'DeviceUnhealthy' (lowercase 'h'). Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constant name 'DeviceUnHalthy' contains a spelling error. It should be 'DeviceUnhealthy' (lowercase 'h').
Copilot uses AI. Check for mistakes.