feat(render): real progress %, ETA, and frequent preview during AE renders
The render page already displayed progress/ETA/preview — but the node agent never fed real data: aeRender used fake +5%/10s increments, discarded aerender stdout, and pushed a preview only every 30s. (Plus the deployed agent predated even the progress-reporting wiring.) node-agent (aeRender): - Capture aerender stdout; parse "(N):" current frame + "N frames"/"to N" total. - Real percentage when total is known (5–90%, headroom for transcode/upload), else a smooth time-asymptotic estimate that never sticks — message shows the live frame number either way. - Push a preview frame ~every 8s (was 30s) so the box fills in quickly. render-svc: - GET /v1/renders/:id/progress now computes eta_seconds from started_at + progress (linear extrapolation) instead of returning null. frontend: - Thread eta_seconds → status route → render page; page prefers the server ETA and falls back to the client-observed rate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"time"
|
||||
"log"
|
||||
"net/http"
|
||||
"strconv"
|
||||
@@ -259,13 +260,29 @@ func (h *RenderHandler) Progress(c *gin.Context) {
|
||||
c.JSON(http.StatusNotFound, models.APIError{Code: "not_found", Message: err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
// Estimate remaining seconds from elapsed time and progress (linear extrapolation).
|
||||
// Only once the job is actually progressing (5–99%) and we know when it started.
|
||||
var etaSeconds *int
|
||||
if job.StartedAt != nil && job.RenderProgress >= 5 && job.RenderProgress < 100 {
|
||||
elapsed := time.Since(*job.StartedAt).Seconds()
|
||||
if elapsed > 0 {
|
||||
remaining := elapsed * float64(100-job.RenderProgress) / float64(job.RenderProgress)
|
||||
if remaining < 0 {
|
||||
remaining = 0
|
||||
}
|
||||
eta := int(remaining)
|
||||
etaSeconds = &eta
|
||||
}
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"job_id": job.ID,
|
||||
"step": job.Step,
|
||||
"progress": job.RenderProgress,
|
||||
"current_frame": nil,
|
||||
"total_frames": nil,
|
||||
"eta_seconds": nil,
|
||||
"eta_seconds": etaSeconds,
|
||||
"preview_b64": job.ImagePreviewB64,
|
||||
"active_nodes": job.CurrentActiveNodes,
|
||||
"message": job.FailedMessage,
|
||||
|
||||
Reference in New Issue
Block a user