Skip to content

Add timeout to Jupyter Diff transformation - CustomDiff

This MR is a twin of !85069 (merged) Why a twin? the code for CustomDiff is left as the stable part for the :rendered_diffs_viewer flag. Once that is removed, the entire class CustomDiff will be removed (planned 14.10), but for now it is better we keep this way

Why

Version 0.4.4 of rb-ipynbdiff introduced a few performance degradations that are causing issues to customers (gitlab-org/incubation-engineering/mlops/rb-ipynbdiff#9 (closed)), and we need to block these from happening in the future

What

Adds a timeout to semantic notebook diffs, defaulting to raw diffs instead.

How to test

  1. Create a repository and add the offending file:
    mkdir outage_notebook
    cd outage_notebook
    curl https://gitlab.com/gitlab-org/incubation-engineering/mlops/rb-ipynbdiff/uploads/9c1f006ed70185d2029bc3d00b03574f/iterate.ipynb -o iterate.ipynb
    git init -b main
    git add -A 
    git commit -am "Adding offending notebook"
    git remote add origin <your local repository>
    git push --upstream origin main
  2. Disable :rendered_diffs_viewer
    Feature.disable(:rendered_diffs_viewer)
  3. Without the changes, opening the commit will cause gitlab to hang
  4. With the changes, the raw diff will be displayed image
  5. For non-offending notebooks (http://gdk.test:3000/gitlab-org/gitlab-test/-/commit/5d6ed1503801ca9dc28e95eeb85a7cf863527aee), displays the semantic diff: image

Related to #354866 (closed)

Edited by Eduardo Bonet

Merge request reports