MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / print_job_output

Function print_job_output

crates/hyperqueue/src/client/output/cli.rs:1378–1407  ·  view source on GitHub ↗
(
    job_detail: JobDetail,
    output_stream: OutputStream,
    task_header: bool,
    task_paths: TaskToPathsMap,
)

Source from the content-addressed store, hash-verified

1376}
1377
1378pub fn print_job_output(
1379 job_detail: JobDetail,
1380 output_stream: OutputStream,
1381 task_header: bool,
1382 task_paths: TaskToPathsMap,
1383) -> anyhow::Result<()> {
1384 let read_stream = |task_id: JobTaskId, output_stream: &OutputStream| {
1385 let (_, stdout_path, stderr_path) = get_task_paths(&task_paths, task_id);
1386 let (opt_path, stream_name) = match output_stream {
1387 OutputStream::Stdout => (stdout_path, "stdout"),
1388 OutputStream::Stderr => (stderr_path, "stderr"),
1389 };
1390
1391 if task_header {
1392 println!("# Job {}, task {}", job_detail.info.id, task_id);
1393 }
1394
1395 if let Some(path) = opt_path {
1396 output_file(Path::new(path));
1397 } else {
1398 log::warn!("Task {task_id} has no `{stream_name}` stream associated with it");
1399 }
1400 };
1401
1402 for (task_id, _task) in &job_detail.tasks {
1403 read_stream(*task_id, &output_stream);
1404 }
1405
1406 Ok(())
1407}
1408
1409fn output_file(path: &Path) {
1410 let stdout = std::io::stdout();

Callers 2

print_job_outputMethod · 0.85
print_job_outputMethod · 0.85

Calls 2

get_task_pathsFunction · 0.85
output_fileFunction · 0.85

Tested by

no test coverage detected