Skip to content

Showcase: DRA GPU status controller across languages - #1

Open
danilrwx wants to merge 2 commits into
demo-basefrom
demo-showcase
Open

Showcase: DRA GPU status controller across languages#1
danilrwx wants to merge 2 commits into
demo-basefrom
demo-showcase

Conversation

@danilrwx

@danilrwx danilrwx commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Demo pull request for patchtree screenshots — a deliberately varied diff so the extension has everything to render.

What's here:

  • Modified files with syntax highlighting + word-diff: gpu.go (Go), server.py (Python), config.yaml (YAML)
  • New file: ui.tsx (TypeScript/JSX)
  • Renamed: old_helper.rshelper.rs (Rust)
  • Deleted: legacy.rb (Ruby)
  • Generated (auto-folded, badge): go.sum
  • Binary image preview: logo.png
  • highlight.js fallback (no tree-sitter grammar): metrics.swift, Dockerfile, and queries — an extensionless file auto-detected as SQL

Open …/pull/<n>.diff with patchtree to see the tree, highlighting, inline/side-by-side views and the review threads below.

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Comment thread demo/gpu.go
)

// ErrNodeNotFound is returned when a node has no inventory yet.
var ErrNodeNotFound = errors.New("node not found")

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Good call extracting a sentinel error — now callers can errors.Is(err, ErrNodeNotFound) instead of string-matching.

Comment thread demo/gpu.go
Comment on lines +33 to 37
if d.Shared {
return "shared", nil
}
return "allocated", nil
}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

This shared-vs-allocated branch reads cleanly. Consider a small table test covering both statuses.

Comment thread demo/server.py
name: str
driver: str
ready: bool = False
devices: list[str] = field(default_factory=list)

@danilrwx danilrwx Jul 30, 2026

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Prefer an immutable default so the dataclass instances don't share state:

Suggested change
devices: list[str] = field(default_factory=list)
devices: tuple[str, ...] = ()

Comment thread demo/ui.tsx
export function DeviceList(props: { devices: Device[] }) {
const [filter, setFilter] = createSignal("");
const shown = () =>
props.devices.filter((d) => d.uuid.includes(filter()));

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Nice — the filter reads well. includes is case-sensitive; want to lowercase both sides?

Comment thread demo/gpu.go

// Count returns how many devices a node exposes.
func (c *StatusController) Count(node string) int {
return len(c.nodes[node])

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Should Count guard against a nil map, or is the zero value fine here?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Zero value is fine — len(nil map) is 0 in Go, so no guard needed.

Comment thread demo/config.yaml
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Comment thread demo/metrics.swift
let memoryUsed: UInt64

var isSaturated: Bool {
utilization > 0.9

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Is 0.9 the right saturation threshold for MIG-sliced GPUs? Might be worth a named constant.

@danilrwx
danilrwx force-pushed the demo-showcase branch 2 times, most recently from 2540a7f to c5df26d Compare August 10, 2026 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant