Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚸 Improve lamin load UX for notebooks & scripts #1994

Merged
merged 9 commits into from
Sep 29, 2024
Merged

🚸 Improve lamin load UX for notebooks & scripts #1994

merged 9 commits into from
Sep 29, 2024

Conversation

falexwolf
Copy link
Member

@falexwolf falexwolf commented Sep 28, 2024

Avoid accidental overwrites

Adds a user prompt in case the target file exists to avoid accidental overwrites.

! demo.ipynb exists: replace? (y/n)

Auto-bumping uid for revising notebooks

Upon revising a notebook a user so far runs into an error that tells them to manually update the uid. To avoid this, the uid is now automatically updated upon lamin load.

Before:

% lamin load https://lamin.ai/laminlabs/lamindata/transform/3qIZOmDUVBwc0000
→ demo.ipynb

After:

% lamin load https://lamin.ai/laminlabs/lamindata/transform/3qIZOmDUVBwc0000
! demo.ipynb exists: replace? (y/n)y
→ updated uid: 3qIZOmDUVBwc0000 → 3qIZOmDUVBwc0001
→ notebook is here: demo.ipynb

The uid is only updated for notebooks, not for other transform types and not for artifacts. Only notebooks are essentially guaranteed to be revised once a user loads them. A script, for instance, is equally likely to be run with the exact same source code hash it had before a user loading it.

There is an edge case in which a user might want to re-run the exact same saved notebook with the same uid to inspect whether it reproduces the same outputs. This edge case is not yet supported.

Avoid conflicts for two user working on the same draft transform

Before:

→ loaded Transform('3qIZOmDU'), started new Run('Q6dM7cRs') at 2024-09-29 10:03:05 UTC

After:

UpdateContext: Alex Wolf (falexwolf) already works on this draft notebook.

Please create a revision via `ln.track("3qIZOmDUVBwc0002")` or a new transform with a *different* filename and `ln.track("1fFD29wCRmGY0000")`.

Slightly more logging for the downloaded local asset

Before:

→ demo.ipynb

After:

→ notebook is here: demo.ipynb

Fixes integrity issue

Before this PR, it was possible to run ln.track() with a bumped uid on a notebook with a different filename/key without running into the below error. The error was only raised upon finding an exact match of the uid. Now it's also raised upon finding a match on the stem uid.

UpdateContext: Filename "demo1.ipynb" clashes with the existing key "demo.ipynb" for uid "3qIZOmDUVBwc...."

Either init a new transform with a new uid:

ln.track("BQjjSpMoyidv0000)"

Or update key "demo.ipynb" to "demo1.ipynb" for all previous versions:

ln.Transform.filter(uid__startswith="3qIZOmDUVBwc").update(key="demo1.ipynb")

Notes

Needs:

Resolves:

@falexwolf falexwolf linked an issue Sep 28, 2024 that may be closed by this pull request
@falexwolf falexwolf linked an issue Sep 29, 2024 that may be closed by this pull request
@falexwolf falexwolf changed the title 🚸 Improve lamin load for notebooks & scripts 🚸 Improve lamin load UX for notebooks & scripts Sep 29, 2024
Copy link

codecov bot commented Sep 29, 2024

Codecov Report

Attention: Patch coverage is 96.87500% with 1 line in your changes missing coverage. Please review.

Project coverage is 92.41%. Comparing base (d2b7516) to head (ca35046).
Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
lamindb/core/_context.py 94.44% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1994      +/-   ##
==========================================
+ Coverage   92.20%   92.41%   +0.21%     
==========================================
  Files          53       54       +1     
  Lines        6081     6331     +250     
==========================================
+ Hits         5607     5851     +244     
- Misses        474      480       +6     
Flag Coverage Δ
92.41% <96.87%> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@github-actions github-actions bot temporarily deployed to pull request September 29, 2024 13:14 Inactive
@falexwolf falexwolf merged commit c5e0768 into main Sep 29, 2024
1 of 3 checks passed
@falexwolf falexwolf deleted the autobump branch September 29, 2024 13:16
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.

🚸 Two users working on the same draft transform 🚸 Auto-bump revision upon lamin load
1 participant