Summary
_default_worker_init() in mdfactory/orchestration/tui.py attempts to auto-detect a pixi environment for Parsl worker initialization, but makes fragile assumptions that only work in dev scenarios (source checkout with .pixi/envs/default/ present). For production installs (pip install mdfactory[parsl]), it silently returns "".
Current Behavior
project_root = Path(mdfactory.__file__).parent.parent
pixi_env = project_root / ".pixi" / "envs" / "default"
if pixi_env.exists():
return f'eval "$(pixi shell-hook --manifest-path {project_root} -e default)"'
Assumptions that break in production:
mdfactory.__file__ is in a source checkout (not site-packages)
- The parent of
mdfactory/ is the project root (breaks with editable installs via symlinks)
.pixi/envs/default/ existing means pixi is the correct activation method
- The
default environment is the right one (could be dev or custom)
pixi is available on PATH on compute nodes
Desired Behavior
Robust worker environment detection that works for production mdfactory installations on HPC clusters. Should handle at least:
- pixi: detect via
PIXI_PROJECT_MANIFEST env var or pixi on PATH
- conda/mamba: detect via
CONDA_PREFIX / CONDA_DEFAULT_ENV
- venv: detect via
VIRTUAL_ENV
- module system: user-provided module loads (no auto-detection possible)
The result is used as a pre-filled default in the interactive TUI wizard — the user can always edit it. So a wrong guess is not catastrophic, but an empty default on a cluster where we could detect the environment is a missed UX opportunity.
Acceptance Criteria
Technical Notes
- The function lives in
mdfactory/orchestration/tui.py line 23
- It's called from both
_configure_with_cluster() and _configure_manual() as a questionary text prompt default
- Related: Parsl's
worker_init runs as a shell snippet inside each SLURM job before workers start
Summary
_default_worker_init()inmdfactory/orchestration/tui.pyattempts to auto-detect a pixi environment for Parsl worker initialization, but makes fragile assumptions that only work in dev scenarios (source checkout with.pixi/envs/default/present). For production installs (pip install mdfactory[parsl]), it silently returns"".Current Behavior
Assumptions that break in production:
mdfactory.__file__is in a source checkout (notsite-packages)mdfactory/is the project root (breaks with editable installs via symlinks).pixi/envs/default/existing means pixi is the correct activation methoddefaultenvironment is the right one (could bedevor custom)pixiis available on PATH on compute nodesDesired Behavior
Robust worker environment detection that works for production
mdfactoryinstallations on HPC clusters. Should handle at least:PIXI_PROJECT_MANIFESTenv var orpixion PATHCONDA_PREFIX/CONDA_DEFAULT_ENVVIRTUAL_ENVThe result is used as a pre-filled default in the interactive TUI wizard — the user can always edit it. So a wrong guess is not catastrophic, but an empty default on a cluster where we could detect the environment is a missed UX opportunity.
Acceptance Criteria
pip install mdfactory[parsl](non-dev install)mdfactory build --slurm tuiis run from a compute node vs. login nodeTechnical Notes
mdfactory/orchestration/tui.pyline 23_configure_with_cluster()and_configure_manual()as a questionary text prompt defaultworker_initruns as a shell snippet inside each SLURM job before workers start