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

Method stop_sandbox_inner

crates/openshell-driver-docker/src/lib.rs:913–949  ·  view source on GitHub ↗
(&self, sandbox_id: &str, sandbox_name: &str)

Source from the content-addressed store, hash-verified

911 }
912
913 async fn stop_sandbox_inner(&self, sandbox_id: &str, sandbox_name: &str) -> Result<(), Status> {
914 let Some(container) = self
915 .find_managed_container_summary(sandbox_id, sandbox_name)
916 .await?
917 else {
918 if let Some(record) = self.remove_pending_sandbox(sandbox_id, sandbox_name).await {
919 if let Some(task) = record.task {
920 task.abort();
921 }
922 cleanup_sandbox_token_file(&record.sandbox, &self.config);
923 self.publish_deleted(record.sandbox.id);
924 return Ok(());
925 }
926 return Err(Status::not_found("sandbox not found"));
927 };
928 let Some(target) = summary_container_target(&container) else {
929 return Err(Status::not_found("sandbox container has no id or name"));
930 };
931
932 match self
933 .docker
934 .stop_container(
935 &target,
936 Some(
937 StopContainerOptionsBuilder::default()
938 .t(docker_stop_timeout_secs(self.config.stop_timeout_secs))
939 .build(),
940 ),
941 )
942 .await
943 {
944 Ok(()) => Ok(()),
945 Err(err) if is_not_modified_error(&err) => Ok(()),
946 Err(err) if is_not_found_error(&err) => Err(Status::not_found("sandbox not found")),
947 Err(err) => Err(internal_status("stop docker sandbox container", err)),
948 }
949 }
950
951 /// Start a managed sandbox container that was previously stopped. Used
952 /// by the gateway to resume sandboxes after a restart so that running

Callers 1

stop_sandboxMethod · 0.80

Calls 12

summary_container_targetFunction · 0.85
docker_stop_timeout_secsFunction · 0.85
is_not_modified_errorFunction · 0.85
is_not_found_errorFunction · 0.85
internal_statusFunction · 0.85
abortMethod · 0.80
stop_containerMethod · 0.80
publish_deletedMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected