@@ -1055,69 +1055,6 @@ impl DockerComputeDriver {
10551055 }
10561056 }
10571057
1058- pub async fn stop_managed_containers_on_shutdown ( & self ) -> Result < usize , Status > {
1059- let containers = self . list_managed_container_summaries ( ) . await ?;
1060- let targets = containers
1061- . into_iter ( )
1062- . filter_map ( |container| {
1063- let state = container. state . unwrap_or ( ContainerSummaryStateEnum :: EMPTY ) ;
1064- if container_state_needs_shutdown_stop ( state) {
1065- summary_container_target ( & container)
1066- } else {
1067- None
1068- }
1069- } )
1070- . collect :: < Vec < _ > > ( ) ;
1071- let target_count = targets. len ( ) ;
1072- let mut stopped = 0usize ;
1073- let mut failures = Vec :: new ( ) ;
1074- let stop_timeout_secs = self . config . stop_timeout_secs ;
1075-
1076- let mut stop_results = futures:: stream:: iter ( targets. into_iter ( ) . map ( |target| {
1077- let docker = self . docker . clone ( ) ;
1078- async move {
1079- let result = docker
1080- . stop_container (
1081- & target,
1082- Some (
1083- StopContainerOptionsBuilder :: default ( )
1084- . t ( docker_stop_timeout_secs ( stop_timeout_secs) )
1085- . build ( ) ,
1086- ) ,
1087- )
1088- . await ;
1089- ( target, result)
1090- }
1091- } ) )
1092- . buffer_unordered ( 16 ) ;
1093-
1094- while let Some ( ( target, result) ) = stop_results. next ( ) . await {
1095- match result {
1096- Ok ( ( ) ) => {
1097- stopped += 1 ;
1098- }
1099- Err ( err) if is_not_found_error ( & err) || is_not_modified_error ( & err) => { }
1100- Err ( err) => {
1101- warn ! (
1102- container = %target,
1103- error = %err,
1104- "Failed to stop Docker sandbox container during shutdown"
1105- ) ;
1106- failures. push ( target) ;
1107- }
1108- }
1109- }
1110-
1111- if !failures. is_empty ( ) {
1112- return Err ( Status :: internal ( format ! (
1113- "failed to stop {} of {target_count} Docker sandbox containers during shutdown" ,
1114- failures. len( )
1115- ) ) ) ;
1116- }
1117-
1118- Ok ( stopped)
1119- }
1120-
11211058 async fn reserve_pending_sandbox ( & self , sandbox : & DriverSandbox ) -> Result < ( ) , Status > {
11221059 let mut pending = self . pending . lock ( ) . await ;
11231060 if pending
@@ -3200,15 +3137,6 @@ fn summary_container_target(summary: &ContainerSummary) -> Option<String> {
32003137 . or_else ( || summary_container_name ( summary) )
32013138}
32023139
3203- fn container_state_needs_shutdown_stop ( state : ContainerSummaryStateEnum ) -> bool {
3204- matches ! (
3205- state,
3206- ContainerSummaryStateEnum :: RUNNING
3207- | ContainerSummaryStateEnum :: RESTARTING
3208- | ContainerSummaryStateEnum :: PAUSED
3209- )
3210- }
3211-
32123140/// States from which a managed container can be brought back to running by
32133141/// `start_container`. Skip `Restarting` (already coming up), `Removing`,
32143142/// `Dead` (terminal), `Paused` (needs `unpause`, not `start`), and
0 commit comments