Show logged steps and a truncation alert in the ML run metrics table

What does this MR do and why?

The Performance table on the ML run page now has one column per logged step, and it shows an info alert when the page leaves out older metric values. Before, the table made one column for every step from 0 to the highest logged step, so a run with a very large step number made the browser build that many columns. The alert reads a metricsTruncated field that the backend MR !263967 adds behind a feature flag; without the field, the page shows no alert.

Design notes
  • app/assets/javascripts/ml/experiment_tracking/routes/candidates/show/candidate_detail.vue: metricSteps returns the sorted unique numeric steps of the metrics, and metricsTableFields builds one column per step. This applies to every run, with or without the backend flag. A run whose steps have gaps no longer shows empty columns for the missing steps, and a metric whose rows have no step no longer gets an empty Step 0 column.
  • When candidate.metricsTruncated is true, a non-dismissible info GlAlert above the table says "This run has more metric values than the page can show. The table shows the most recently logged values." It has no count, because rows without a step and rows that share a step are embedded but not shown.
  • This MR was split out of !263967, which keeps the backend and database part. The code is the same as the version reviewed there.
  • Merge order: either order works. Without the backend MR, metricsTruncated is missing, so there is no alert, and the step columns still follow the logged steps. Without this MR, the backend field is unused, and the backend flag is off by default. Merge this MR before the backend flag ml_bounded_candidate_metric_reads is enabled. Otherwise a run with more than 1,000 metric values shows empty columns for the steps that the page leaves out.

References

Screenshots or screen recordings

A run with 1,201 metric values: num_params at step 0, then loss and accuracy over 600 steps.

Backend flag off Backend flag on (with !263967)
Performance tab with the flag off: columns from Step 0 and a num_params row Performance tab with the flag on: an info alert and columns from Step 100

How to set up and validate locally

  1. In the rails console, create a run whose steps have a gap:

    project = Project.find_by_full_path('flightjs/Flight'); user = User.find_by_username('root')
    exp = Ml::Experiment.create!(name: 'logged-steps', project: project, user: user)
    run = exp.candidates.create!(project: project, user: user); run.metrics.create!([{ name: 'loss', value: 1, step: 0, tracked_at: 0 }, { name: 'loss', value: 0.5, step: 5000, tracked_at: 1 }])
    run.iid
  2. On master, visit http://gdk.test:3000/flightjs/Flight/-/ml/candidates/<iid> and open the Performance tab. Expect: columns Step 0 to Step 5000, nearly all empty.

  3. On this branch, reload the page. Expect: two columns, Step 0 and Step 5000, and no alert.

The alert, with the backend MR
  1. Check out !263967 together with this branch, and enable the flag: Feature.enable(:ml_bounded_candidate_metric_reads).
  2. Log more than 1,000 metric values on a run, for example 600.times { |s| run.metrics.create!([{ name: 'loss', value: s, step: s, tracked_at: s }, { name: 'accuracy', value: s, step: s, tracked_at: s }]) }.
  3. Reload the run page. Expect: an info alert above the table and columns only for the steps of the 1,000 most recent values.

Specs: spec/frontend/ml/experiment_tracking/routes/candidates/show/candidate_detail_spec.js covers steps with gaps, rows without a step, no alert without metricsTruncated, and the alert and step columns with it.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading
Loading