Duplicate Script Run

Open
#49 0 comments 0 reactions 1 assignee View on GitHub

@NetZissou is already working on this.

Since Sep 22, 2026.

  • #51 by @NetZissou — open

Assessment

This issue has not been assessed yet.

Description

bug

A single button click can produce two concurrent Streamlit script runs, and when that happens resolve_backend("auto") can return different backends for the two runs: one cuml, one sklearn. The duplicate run is preempted before it writes session state, so results stay consistent, but it doubles GPU work and makes the log misleading.

Observation

Embed & Explore, A100 node, auto backend, 36 images:

09:17:10 Starting embedding generation      (x2)
09:17:12 Embeddings stored                  (x1, the other run was preempted)
09:17:31 Auto-resolved reduction backend to sklearn (CPU)
09:17:31 Auto-resolved reduction backend to cuML (GPU: NVIDIA A100-PCIE-40GB)
09:17:31 PROJECTION START                   (x2)
09:17:54 cuML UMAP subprocess completed; Projection complete   (this run wrote the results)
09:17:59 sklearn run: Dim reduction complete, never reaches _run_projection (preempted)

Cause

  1. check_cuml_available() does a live import cuml on every call, with except ImportError: return False. Two threads importing cuML at the same instant is a CPython hazard: the second importer can hit a partially initialized package, raise ImportError, and be reported as "cuML not available". check_cuda_available() is cached; the cuML check is not.
  2. The duplicate run itself: either a duplicated click event over a port-forwarded connection or a second browser tab. The log has no session id, so it cannot be told apart yet.
Dominant language
Python
Stars
8
Forks
0
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Imageomics/emb-explorer

All issues in Imageomics/emb-explorer

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.