Add real-time progress feedback to multi-run simulations
Switch from exec() to spawn() for streaming stderr, add onProgress callback to runner, and emit per-run progress lines from workers. CI now shows live percentage, tick count, and era during long runs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,7 @@ export interface SimulationConfig {
|
||||
seed?: number;
|
||||
verbose?: boolean;
|
||||
silent?: boolean;
|
||||
onProgress?: (tick: number, totalTicks: number, era: string) => void;
|
||||
}
|
||||
|
||||
export interface EraTransition {
|
||||
@@ -139,8 +140,11 @@ export function runSimulation(config: SimulationConfig): SimulationResult {
|
||||
allMetrics.push(collectMetrics(state));
|
||||
}
|
||||
|
||||
if (!config.silent && tick % progressInterval === 0) {
|
||||
printProgress(tick, config.totalTicks, state, startTime);
|
||||
if (tick % progressInterval === 0) {
|
||||
if (!config.silent) {
|
||||
printProgress(tick, config.totalTicks, state, startTime);
|
||||
}
|
||||
config.onProgress?.(tick, config.totalTicks, state.meta.currentEra);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user