(
job_detail: JobDetail,
output_stream: OutputStream,
task_header: bool,
task_paths: TaskToPathsMap,
)
| 1376 | } |
| 1377 | |
| 1378 | pub 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 | |
| 1409 | fn output_file(path: &Path) { |
| 1410 | let stdout = std::io::stdout(); |
no test coverage detected