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

Function build_compute_runtime

crates/openshell-server/src/lib.rs:730–819  ·  view source on GitHub ↗
(
    config: &Config,
    driver_startup: compute::driver_config::DriverStartupContext<'_>,
    store: Arc<Store>,
    sandbox_index: SandboxIndex,
    sandbox_watch_bus: SandboxWatchBus,
    tracing

Source from the content-addressed store, hash-verified

728// that must be passed through, so the count is justified.
729#[allow(clippy::too_many_arguments)]
730async fn build_compute_runtime(
731 config: &Config,
732 driver_startup: compute::driver_config::DriverStartupContext<'_>,
733 store: Arc<Store>,
734 sandbox_index: SandboxIndex,
735 sandbox_watch_bus: SandboxWatchBus,
736 tracing_log_bus: TracingLogBus,
737 supervisor_sessions: Arc<supervisor_session::SupervisorSessionRegistry>,
738) -> Result<ComputeRuntime> {
739 let driver = configured_compute_driver(config, driver_startup)?;
740 info!(driver = %driver.name(), "Using compute driver");
741
742 let runtime = match driver {
743 ConfiguredComputeDriver::Builtin(ComputeDriverKind::Kubernetes) => {
744 warn_if_kubernetes_sandbox_jwt_expiry_disabled(config);
745 let k8s_config =
746 compute::driver_config::kubernetes_config_from_context(driver_startup)?;
747 ComputeRuntime::new_kubernetes(
748 k8s_config,
749 store,
750 sandbox_index,
751 sandbox_watch_bus,
752 tracing_log_bus,
753 supervisor_sessions.clone(),
754 )
755 .await
756 }
757 ConfiguredComputeDriver::Builtin(ComputeDriverKind::Docker) => {
758 let docker_config = compute::driver_config::docker_config_from_context(driver_startup)?;
759 ComputeRuntime::new_docker(
760 config.clone(),
761 docker_config,
762 store,
763 sandbox_index,
764 sandbox_watch_bus,
765 tracing_log_bus,
766 supervisor_sessions,
767 )
768 .await
769 }
770 ConfiguredComputeDriver::Builtin(ComputeDriverKind::Podman) => {
771 let podman_config = compute::driver_config::podman_config_from_context(driver_startup)?;
772 ComputeRuntime::new_podman(
773 podman_config,
774 store,
775 sandbox_index,
776 sandbox_watch_bus,
777 tracing_log_bus,
778 supervisor_sessions,
779 )
780 .await
781 }
782 ConfiguredComputeDriver::Builtin(ComputeDriverKind::Vm) => {
783 let vm_config = compute::driver_config::vm_config_from_context(driver_startup)?;
784 let endpoint = compute::vm::spawn(config, &vm_config).await?;
785 ComputeRuntime::new_remote_driver(
786 endpoint,
787 store,

Callers 1

run_serverFunction · 0.85

Tested by

no test coverage detected