Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion benchmarking/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.env
__pycache__/
.DS_store
outputs/
outputs/
*.sif
44 changes: 42 additions & 2 deletions benchmarking/InteractiveAgentTester.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@
default="docker",
)

# Ask user whether to force‑update the sandbox image/SIF
force_refresh = (
Prompt.ask(
"Force update sandbox environment?", choices=["y", "n"], default="n"
).lower()
== "y"
)

is_exec_mode = backend == "singularity-exec"

# -----------------------------------------------------------------------------
Expand All @@ -75,11 +83,21 @@
from benchmarking_sandbox_management import (
SandboxManager as _BackendManager,
CONTAINER_NAME as _SANDBOX_HANDLE,
IMAGE_NAME as _SANDBOX_IMAGE, # assume this constant exists
API_PORT_HOST as _API_PORT,
)
finally:
sys.path.pop(0)

# --- optional force‑refresh logic --------------------------------------
if force_refresh:
console.print("[yellow]Forcing Docker sandbox refresh…[/yellow]")
# Stop & remove any running container gracefully
subprocess.run(["docker", "rm", "-f", _SANDBOX_HANDLE], check=False)
# Remove the sandbox image to ensure re‑pull/build
subprocess.run(["docker", "image", "rm", "-f", _SANDBOX_IMAGE], check=False)
console.print("[green]Docker image removed – it will be pulled/built on next start.[/green]")

def COPY_CMD(src: str, dst: str):
subprocess.run(["docker", "cp", src, dst], check=True)

Expand All @@ -97,6 +115,19 @@ def COPY_CMD(src: str, dst: str):
finally:
sys.path.pop(0)

# optional force‑refresh
if force_refresh:
console.print("[yellow]Forcing Singularity sandbox refresh…[/yellow]")
try:
sing.stop_instance()
except Exception:
pass # ignore if not running
if sing.SIF_PATH.exists():
sing.SIF_PATH.unlink()
console.print(
f"[green]Deleted {sing.SIF_PATH.name} – it will be re‑downloaded on next start.[/green]"
)

class _SingInstanceWrapper:
def start_container(self):
return sing.start_instance()
Expand Down Expand Up @@ -127,9 +158,19 @@ def COPY_CMD(src: str, dst: str):
finally:
sys.path.pop(0)

# optional force‑refresh
if force_refresh:
Comment thread
djriffle marked this conversation as resolved.
console.print("[yellow]Forcing Singularity sandbox refresh…[/yellow]")
if sing.SIF_PATH.exists():
sing.SIF_PATH.unlink()
console.print(
f"[green]Deleted {sing.SIF_PATH.name} – it will be re‑downloaded on next start.[/green]"
)

SIF_PATH = sing.SIF_PATH
SING_BIN = sing.SING_BIN
SENTINEL = "<<<EOF>>>"

class _SingExecBackend:
"""Launch one long‑lived REPL inside the SIF and stream code to it."""

Expand Down Expand Up @@ -366,7 +407,7 @@ def format_execute_response(resp: dict) -> str:


# ====================================================================================
# 5 · Main interactive loop
# 5 · Main interactive loop (unchanged)
# ====================================================================================

def run_interactive(prompt: str, dataset: Path, metadata: dict, resources: List[Tuple[Path, str]]):
Expand Down Expand Up @@ -481,4 +522,3 @@ def main():
main()
except KeyboardInterrupt:
console.print("\nInterrupted.")

52 changes: 36 additions & 16 deletions benchmarking/sandbox/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,48 @@
ansi2html==1.8.0
scanpy==1.10.2
scrublet
anndata==0.10.8
celltypist==1.6.3
leidenalg==0.10.2
igraph==0.11.6
networkx==3.2.1
pynndescent==0.5.13
# Core scientific stack
numpy==1.26.4
scipy==1.13.1
pandas==2.2.2
scikit-learn==1.5.1
umap-learn==0.5.6
statsmodels==0.14.2
numba==0.60.0
statsmodels==0.14.2
h5py==3.11.0

# Visualization
matplotlib==3.9.1
seaborn==0.13.2
h5py==3.11.0

# Single-cell & omics
scanpy==1.10.2
anndata==0.10.8
scrublet # For doublet detection
celltypist==1.6.3 # For cell type annotation

# Dimensionality reduction & clustering
umap-learn==0.5.6
pynndescent==0.5.13
leidenalg==0.10.2
igraph==0.11.6
networkx==3.2.1

# Notebook support
jupyter
jupyter_client
tqdm==4.66.4

# Utilities
ansi2html==1.8.0
openpyxl==3.1.5
PyPDF2
tqdm==4.66.4
psutil==6.0.0
defusedxml==0.7.1
requests==2.32.3
jupyter
jupyter_client
matplotlib

# HDF5 / Zarr data formats
zarr
h5netcdf

# Batch correction and integration (for Scanpy)
bbknn
scVI-tools
scarches
harmonypy