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

Function run_created_container

e2e/rust/tests/driver_config_volume.rs:304–351  ·  view source on GitHub ↗
(
    volume: &VolumeGuard,
    container_name: &str,
)

Source from the content-addressed store, hash-verified

302}
303
304async fn run_created_container(
305 volume: &VolumeGuard,
306 container_name: &str,
307) -> Result<String, String> {
308 volume
309 .docker
310 .start_container(container_name, None::<StartContainerOptions>)
311 .await
312 .map_err(|err| format!("start helper container {container_name}: {err}"))?;
313
314 let wait_result = volume
315 .docker
316 .wait_container(container_name, None::<WaitContainerOptions>)
317 .try_collect::<Vec<_>>()
318 .await;
319 let logs = volume
320 .docker
321 .logs(
322 container_name,
323 Some(LogsOptions {
324 stdout: true,
325 stderr: true,
326 tail: "all".to_string(),
327 ..Default::default()
328 }),
329 )
330 .try_collect::<Vec<_>>()
331 .await
332 .map(|chunks| {
333 chunks
334 .into_iter()
335 .map(|chunk| chunk.to_string())
336 .collect::<String>()
337 });
338
339 match (wait_result, logs) {
340 (Ok(_), Ok(output)) => Ok(output),
341 (Ok(_), Err(err)) => Err(format!(
342 "read helper container {container_name} logs: {err}"
343 )),
344 (Err(err), Ok(output)) => Err(format!(
345 "helper container {container_name} failed: {err}\n{output}"
346 )),
347 (Err(err), Err(log_err)) => Err(format!(
348 "helper container {container_name} failed: {err}\nread logs failed: {log_err}"
349 )),
350 }
351}
352
353async fn connect_container_api(driver: &str) -> Result<Docker, String> {
354 let docker = match driver {

Callers 1

run_volume_containerFunction · 0.85

Calls 1

start_containerMethod · 0.80

Tested by

no test coverage detected