Skip to content

2295 add eta for simulation running#2344

Draft
DariuszRozmus wants to merge 2 commits intomasterfrom
2295-add-eta-for-simulation-running
Draft

2295 add eta for simulation running#2344
DariuszRozmus wants to merge 2 commits intomasterfrom
2295-add-eta-for-simulation-running

Conversation

@DariuszRozmus
Copy link
Copy Markdown

@DariuszRozmus DariuszRozmus commented Mar 23, 2026

Fixes #2295

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements an estimated time-to-completion (ETA) display for running simulations by deriving progress/remaining work from task primaries data, and updates lint ignore patterns.

Changes:

  • Replace percent-only progress calculation with a metrics calculation that also returns remaining primaries and an ETA.
  • Update the simulation progress UI to show “left”, “ETA”, and “Elapsed” alongside the progress bar.
  • Expand .eslintignore to ignore common build output directories and node_modules.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/WrapperApp/components/Simulation/SimulationCard/SimulationCardContent.tsx Adds metrics calculation (progress/remaining/ETA) and displays ETA + remaining in the progress header UI.
.eslintignore Adds ignore patterns for node_modules, build, dist, and clarifies comments.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +45 to +51
// ETA calculation: (Remaining Work) * (Time Spent / Work Done)
let eta = null;

if (simulatedSum > 0 && remaining > 0 && duration > 0) {
const msPerPrimary = duration / simulatedSum;
eta = remaining * msPerPrimary;
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ETA is computed using duration derived from job startTime, which can include time spent in PENDING/initialization before any primaries were actually simulated. This will systematically overestimate ms/primary early on and can produce misleading ETAs. Consider basing the rate on time since the first non-zero simulatedPrimaries (e.g., capture a firstSimulatedAtDuration when simulatedSum first becomes >0 and use duration - firstSimulatedAtDuration), or use task startTime for RUNNING tasks when available.

Copilot uses AI. Check for mistakes.
Comment on lines +71 to +82
const [metrics, setMetrics] = useState({
progress: 0,
eta: null as number | null,
remaining: 0
});

useEffect(() => {
if (simulationStatus.jobTasksStatus) {
const jobTasksStatus = simulationStatus.jobTasksStatus;
setSimulationProgressPercent(calculateSimulationProgress(jobTasksStatus));
const results = calculateSimulationMetrics(simulationStatus.jobTasksStatus, duration);
setMetrics(results);
}
}, [simulationStatus, setSimulationProgressPercent]);
}, [simulationStatus, duration]);
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

metrics is fully derived from props (simulationStatus.jobTasksStatus and duration) but is stored in local state and updated via an effect. This adds an extra render on every duration/status update and risks derived-state drift. Consider computing it via useMemo (or inline) instead of useState/useEffect.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ETA for simulation completion

2 participants