MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / persist_state

Method persist_state

crates/openshell-driver-vm/src/gpu.rs:132–150  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

130 }
131
132 fn persist_state(&self) {
133 let bindings: Vec<GpuBinding> = self
134 .slots
135 .iter()
136 .filter_map(|s| {
137 s.assigned_to.as_ref().map(|id| GpuBinding {
138 bdf: s.info.bdf.clone(),
139 sandbox_id: id.clone(),
140 bound_at_ms: std::time::SystemTime::now()
141 .duration_since(std::time::UNIX_EPOCH)
142 .map_or(0, |d| i64::try_from(d.as_millis()).unwrap_or(i64::MAX)),
143 })
144 })
145 .collect();
146 let state = GpuBindState { bindings };
147 if let Err(err) = state.save(&self.state_path) {
148 tracing::warn!(error = %err, "failed to persist GPU bind state");
149 }
150 }
151}
152
153pub struct GpuAssignment {

Callers 2

assignMethod · 0.80
releaseMethod · 0.80

Calls 1

saveMethod · 0.80

Tested by

no test coverage detected