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

Method from_driver

crates/openshell-server/src/compute/mod.rs:285–327  ·  view source on GitHub ↗
(
        driver_name: String,
        driver: SharedComputeDriver,
        shutdown_cleanup: Option<Arc<dyn ShutdownCleanup>>,
        startup_resume: Option<Arc<dyn StartupResume>>,
        driver_p

Source from the content-addressed store, hash-verified

283impl ComputeRuntime {
284 #[allow(clippy::too_many_arguments)]
285 async fn from_driver(
286 driver_name: String,
287 driver: SharedComputeDriver,
288 shutdown_cleanup: Option<Arc<dyn ShutdownCleanup>>,
289 startup_resume: Option<Arc<dyn StartupResume>>,
290 driver_process: Option<Arc<ManagedDriverProcess>>,
291 store: Arc<Store>,
292 sandbox_index: SandboxIndex,
293 sandbox_watch_bus: SandboxWatchBus,
294 tracing_log_bus: TracingLogBus,
295 supervisor_sessions: Arc<SupervisorSessionRegistry>,
296 gateway_bind_addresses: Vec<SocketAddr>,
297 ) -> Result<Self, ComputeError> {
298 let capabilities = driver
299 .get_capabilities(Request::new(GetCapabilitiesRequest {}))
300 .await
301 .map_err(compute_error_from_status)?
302 .into_inner();
303 let driver_kind = driver_name.parse::<ComputeDriverKind>().ok();
304 info!(
305 configured_driver = %driver_name,
306 advertised_driver = %capabilities.driver_name,
307 in_tree = driver_kind.is_some(),
308 "Compute driver connected"
309 );
310 let default_image = capabilities.default_image;
311 Ok(Self {
312 driver,
313 driver_name,
314 shutdown_cleanup,
315 startup_resume,
316 _driver_process: driver_process,
317 default_image,
318 store,
319 sandbox_index,
320 sandbox_watch_bus,
321 tracing_log_bus,
322 supervisor_sessions,
323 sync_lock: Arc::new(Mutex::new(())),
324 gateway_bind_addresses,
325 replica_id: lease::replica_id(),
326 })
327 }
328
329 /// Serializes sandbox/provider-profile invariant checks and object writes
330 /// within this gateway process.

Callers

nothing calls this directly

Calls 2

replica_idFunction · 0.85
get_capabilitiesMethod · 0.45

Tested by

no test coverage detected