platform/app: stream SAT job output live and kick blackbox on job completion
A crash mid-command (e.g. the nvbandwidth reboot) previously lost that job's entire output: streamExecOutput only buffered stdout/stderr in memory and the job's log file was written once, after the process exited. It now also streams each line straight to that file as it arrives, so whatever printed before a crash survives. Root filesystem here is a tmpfs overlay (toram boot), so the only real persistence boundary is blackbox's mirror to removable media, not the local write itself. platform.SetJobBoundaryHook lets app wire a touch of a small kick-file after each job's output is written; blackboxWorker now polls that file's mtime alongside its normal adaptive timer and syncs immediately on a kick instead of waiting out the current flush period (up to 30s).
This commit is contained in:
@@ -161,19 +161,25 @@ type runtimeChecker interface {
|
||||
CaptureTechnicalDump(baseDir string) error
|
||||
}
|
||||
|
||||
func New(platform *platform.System) *App {
|
||||
func New(sys *platform.System) *App {
|
||||
a := &App{
|
||||
network: platform,
|
||||
services: platform,
|
||||
exports: platform,
|
||||
tools: platform,
|
||||
sat: platform,
|
||||
runtime: platform,
|
||||
installer: platform,
|
||||
network: sys,
|
||||
services: sys,
|
||||
exports: sys,
|
||||
tools: sys,
|
||||
sat: sys,
|
||||
runtime: sys,
|
||||
installer: sys,
|
||||
}
|
||||
if db, err := OpenComponentStatusDB(DefaultExportDir + "/component-status.json"); err == nil {
|
||||
a.StatusDB = db
|
||||
}
|
||||
// Let any running blackbox worker know promptly when a SAT job finishes,
|
||||
// instead of waiting out its own adaptive flush period — see
|
||||
// requestBlackboxSync/blackboxWorker.run in blackbox.go.
|
||||
platform.SetJobBoundaryHook(func(string) {
|
||||
requestBlackboxSync(DefaultExportDir)
|
||||
})
|
||||
return a
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user