Skip to content

🩺 GPU Health Check (Part 1/2) - #5057

Open
tessaSlice wants to merge 6 commits into
aws:feature/gpu-metricsfrom
tessaSlice:health-checks
Open

🩺 GPU Health Check (Part 1/2)#5057
tessaSlice wants to merge 6 commits into
aws:feature/gpu-metricsfrom
tessaSlice:health-checks

Conversation

@tessaSlice

Copy link
Copy Markdown

Summary

Add gpu_healthcheck.go and its table-driven tests from dcgm-init-v3. The check reads the shared GPU metrics file written by dcgm-init and derives INITIALIZING/OK/IMPAIRED/INSUFFICIENT_DATA status with boot-grace and staleness handling.

In the follow up PR we will attach this gpu_healthcheck to the agent itself so it will emit GPU health checks whenever the customer requests it.

Implementation details

The following files were modified:

agent/doctor/

  • gpu_healthcheck.go: GPU health check uses a DCGMMetricsReader to determine the health status.
  • gpu_healthcheck_test.go: Table-driven tests evaluating intended behavior of GPU health check evaluating for potential scenarios.
image

Testing

Test file: gpu_healthcheck_test.go.

New tests cover the changes: yes

Description for the changelog

Feature - GPU Health Check (Part 1/2)

Additional Information

Does this PR include breaking model changes? If so, Have you added transformation functions?

No.

Does this PR include the addition of new environment variables in the README?

No.

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@tessaSlice
tessaSlice requested a review from a team as a code owner July 23, 2026 19:17
@tessaSlice tessaSlice added bot/test go Pull requests that update Go code labels Jul 23, 2026
@tessaSlice
tessaSlice force-pushed the health-checks branch 3 times, most recently from ccf8d7e to 51504ca Compare July 23, 2026 20:59
Comment thread agent/doctor/gpu_healthcheck.go Outdated
Comment thread agent/doctor/gpu_healthcheck.go Outdated
Comment thread agent/doctor/gpu_healthcheck.go
Comment thread agent/doctor/gpu_healthcheck.go Outdated
Comment thread agent/doctor/gpu_healthcheck.go

// gpuBootGracePeriod tolerates a missing file until dcgm-init's first write
// (~60s in, plus jitter/skew). 2x the 60s producer tick.
const gpuBootGracePeriod = 120 * time.Second

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should create a GPUProducerTick constant and shared it between dcgm-init and agent.

That way gpuBootGracePeriod=2*GPUProducerTick

wdyt

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reasoning behind 120 seconds?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gives dcgm-init 1 re-try attempt if the first attempt to connect to DCGM daemon (nv-hostengine) fails. Each attempt takes 60s since reconcileAndCollect runs every 60s.

Ref: https://github.com/aws/amazon-ecs-agent/blob/feature/gpu-metrics/dcgm-init/engine/engine.go#L135

e.collectionInterval is set as 60s here: https://github.com/aws/amazon-ecs-agent/blob/feature/gpu-metrics/dcgm-init/engine/engine.go#L78C23-L78C48

Comment thread agent/doctor/gpu_healthcheck_test.go Outdated
Amy Lee added 3 commits July 28, 2026 11:03
Add gpu_healthcheck.go and its table-driven tests: the ACCELERATED_COMPUTE
instance health check reads the shared GPU metrics file written by dcgm-init
and derives INITIALIZING/OK/IMPAIRED/INSUFFICIENT_DATA. Boot grace and
staleness threshold are both 120s (2x the 60s producer tick).
Match NewEBSCSIDaemonHealthCheck's convention of returning the
doctor.Healthcheck interface rather than the concrete *gpuHealthcheck.
Switch the GPU healthcheck's logging from cihub/seelog to the structured
ecs-agent/logger, matching the EBS CSI healthcheck. Format-string Infof
calls become structured logger.Info(msg, Fields{...}).
Amy Lee added 3 commits July 28, 2026 11:03
The per-step stepNow local is unnecessary under Go 1.22+ per-iteration
loop scoping and synchronous same-iteration use; capture s.now directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants