Export log: a failed job's render log carries its timing line; docs say when the line is written (#3724 review)

This commit is contained in:
vangel76 committed 2026-11-16 00:55:44 +01:00
1 parent bff1987149
commit 49b6be954c
4 files changed
+34 -10

No files matched your search

+6 -2
View File
@@ -225,10 +225,14 @@ pub async fn export_async(job: &Job<'_>, progress: &mut dyn FnMut(&Progress) ->
let mut r = export_with(&cx, progress, t0).await;
drop(render);
let wall = t0.elapsed().as_secs_f64();
// (what a failed export got done: its render log carries the line too, with the compositor)
let mut unfinished = None;
if let Err(e) = &r {
// A stopped or failed export gets its line too: slow ones are the ones people stop.
let how = if matches!(e, ExportError::Cancelled) { "stopped" } else { "failed" };
log::info!(target: "effectcraft_export", "{}: {}", cx.job.options.label, cx.timing(wall, 0).summary_of_unfinished(how));
let t = cx.timing(wall, 0);
log::info!(target: "effectcraft_export", "{}: {}", cx.job.options.label, t.summary_of_unfinished(how));
unfinished = Some(t);
}
if matches!(r, Err(ExportError::Cancelled)) {
cx.remove_cancelled_outputs()?;
@@ -238,7 +242,7 @@ pub async fn export_async(job: &Job<'_>, progress: &mut dyn FnMut(&Progress) ->
if let Some(t) = &timing {
log::info!(target: "effectcraft_export", "{}: {}", cx.job.options.label, t.summary());
}
let log = cx.write_log(&r, wall, timing.as_ref());
let log = cx.write_log(&r, wall, timing.as_ref().or(unfinished.as_ref()));
if let Ok(rep) = &mut r {
rep.timing = timing.unwrap_or_default();
rep.log = log;
+5 -6
View File
@@ -1033,11 +1033,10 @@ impl<'a> Cx<'a> {
s.push_str(&format!("Renderer: {}\n", describe_choice(&c)));
}
if let Some(t) = timing {
s.push_str(&format!(
"Timing: {}
",
t.summary()
));
// (a failed job has no frame count: the line says what ran before it stopped)
let line = if result.is_err() { t.summary_of_unfinished("failed") } else { t.summary() };
s.push_str(&format!("Timing: {line}
"));
}
if self.backend() == crate::JobRenderer::Gpu
&& let Some((n, why)) = &*self.gpu_frames.lock().unwrap_or_else(std::sync::PoisonError::into_inner)
@@ -1078,7 +1077,7 @@ impl<'a> Cx<'a> {
/// The render log's account of the encoder: every encoder here is built in and runs on the
/// CPU (no hardware encoder is used), with the codec settings of the Output Module.
pub(crate) fn describe_encoder(om: &OutputModule) -> String {
use effectcraft_project::render_queue::{Channels, ProResProfile, WebmVideoCodec};
use effectcraft_project::render_queue::{ProResProfile, WebmVideoCodec};
let rate = |om: &OutputModule| match om.codec.rate_control {
effectcraft_project::render_queue::RateControlMode::Bitrate => format!("{} kbps", om.bitrate_kbps),
effectcraft_project::render_queue::RateControlMode::Quality => format!("constant quality {}", om.codec.quality),
+19
View File
@@ -115,6 +115,25 @@ fn gif_and_webm_time_the_stages_they_have() {
assert!(e <= t.wall_seconds && w <= t.wall_seconds && t.render_seconds <= t.wall_seconds, "{t:?}");
}
/// #3724 review: a failed export's render log carries the timing line too (with the compositor
/// that ran), not only a finished one's.
#[test]
fn a_failed_export_logs_its_timing_line_too() {
let (p, _) = project();
let settings = RenderSettings { time_span: TimeSpan::LengthOfComp, ..Default::default() };
let om = OutputModule::for_format(OutputFormat::H264);
let files: Arc<Mutex<Vec<(String, Vec<u8>)>>> = Arc::default();
let sink_files = files.clone();
let sink: &Sink = &move |path: &str, data: Vec<u8>| sink_files.lock().unwrap().push((path.to_string(), data));
// A composition that is not there: the export fails before it renders anything.
let job = job_of(&p, ItemId(9999), &settings, &om, "/out/failed.mp4", sink);
assert!(export(&job, &mut |_| true).is_err(), "no such composition");
let files = files.lock().unwrap();
let log = files.iter().find(|(path, _)| path.ends_with(".txt")).map(|(_, d)| String::from_utf8_lossy(d).into_owned()).expect("a failed job writes its log");
assert!(log.contains("Result: Failed"), "{log}");
assert!(log.contains("Timing: export failed after"), "{log}");
}
#[test]
fn a_stopped_export_has_a_summary_without_a_frame_count() {
let t = effectcraft_export::render_queue::RenderTiming {
+4 -2
View File
@@ -114,8 +114,10 @@ Commands (CLI, MCP, control channel):
names it and why). `EFFECTCRAFT_RQ_RENDERER` set to `gpu` or `cpu` skips it and renders on
that compositor; `auto` (the default) measures. A queue item's later output modules reuse its
first one's choice, and Software Rendering projects always render on the CPU.
When a job ends, the render log gets one `Timing:` line (and the log target `effectcraft_export`
the same line): the wall time, the busy time of rendering, the encoder and writing the file
When a job ends, the log target `effectcraft_export` gets one timing line, and the render log
gets it as a `Timing:` line when its Log setting writes a log for that outcome (under the
default Errors Only, failed jobs only; a failed job's line says how long it ran and what ran
before it stopped): the wall time, the busy time of rendering, the encoder and writing the file
(the stages overlap, so they are not a sum), the compositor and why, the encoder and its
settings, and frames per second ([#3713](https://github.com/storytold/effectcraft/issues/3713)).
`effectcraft-cli render --json` returns it as `timing` and `timingSummary`.