Repository navigation
Conversation
Two Streamlit script runs resolving the auto backend at the same moment imported cuML concurrently; the second importer could see a partially initialized package, get an ImportError, and be reported as "cuML not available", so one run projected on sklearn while the other used the GPU. We now guard the import with a lock and cache a successful result, log import failures instead of swallowing them, and tag the projection, KMeans and embedding log banners with the Streamlit session and thread ids so duplicate runs can be attributed. Also give the cuML UMAP subprocess unique temp files per call: two concurrent runs in one process shared PID-named files, and the first run's cleanup deleted the second run's output, which then fell back to sklearn with "subprocess failed (rc=0)". Refs #49 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Show a spinner while the compute backend is resolved (the first cuML probe of a session imports cuML, which can take several seconds with no feedback), log every Project to 2D / Run KMeans click with its session and thread ids, and flag runs in flight so a duplicate is visible in the log. The duplicate is never refused: Streamlit stops the older script run at its next Streamlit call once a newer one exists, so refusing the newer run left no projection running at all.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
My flaky mouse triggered a double-click on the "Project" btn. With "auto" mode, the two runs imported
cuMLat the same instant, and the second importer hit a partially initialized pkg, and the app silently ran:cuMLsklearnBoth runs shared PID-named temp files for the cuML UMAP subprocess, so the first run's cleanup deleted the second run's output.
Changes
check_cuml_available()importscuMLunder a lock, caches a success, and logs an import failure instead of swallowing it. The probe now costs one import per session instead of one per projection.cuMLUMAP subprocess temp files are unique per call nowcuMLimport no longer looks like a dead button.Behavior Description
One Click
True. It logs clicked(session=…, thread=…), sees no run in flight, sets theprojection_runningflag, and enters_run_projection.session_state (projection, provenance), logs "Projection complete", clears the flag, and the page renders the result.One-click log
Two clicks in quick succession
The second click arrives while the first click's rerun request is still being processed on the frontend. Streamlit coalesces them to one run.
Two clicks in quick succession log
A second click after the first run has started
WARNING Duplicate projection request….It does not refuse, B is the run that will survive. it sets the flag and starts its own projection.StopExceptionthere. The finally insingle_runclears the flag; A never logs "Projection complete" and never writes state.Example below shows four clicked lines, three warnings, four subprocesses completed, one "Projection complete". The last click wins, the page shows its result, and the only cost is the abandoned GPU work.
Multiple-clicks, all subprocess completes, the latest is used as projection