slurm-code 0.1.30__tar.gz → 0.1.33__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. {slurm_code-0.1.30 → slurm_code-0.1.33}/.github/workflows/conda-release.yml +4 -11
  2. {slurm_code-0.1.30/src/slurm_code.egg-info → slurm_code-0.1.33}/PKG-INFO +1 -1
  3. slurm_code-0.1.33/dev/env-activation-plan.md +156 -0
  4. {slurm_code-0.1.30 → slurm_code-0.1.33}/docs/_quarto.yml +34 -32
  5. slurm_code-0.1.33/docs/pages/cancel.md +42 -0
  6. {slurm_code-0.1.30 → slurm_code-0.1.33}/docs/pages/getting-started.md +4 -5
  7. slurm_code-0.1.33/docs/pages/jobs.md +34 -0
  8. {slurm_code-0.1.30 → slurm_code-0.1.33}/docs/pages/profiles.md +27 -0
  9. slurm_code-0.1.33/docs/pages/reconnect.md +48 -0
  10. slurm_code-0.1.33/docs/pages/submit.md +237 -0
  11. {slurm_code-0.1.30 → slurm_code-0.1.33}/pyproject.toml +2 -2
  12. slurm_code-0.1.33/src/slurm_code/activation.py +427 -0
  13. {slurm_code-0.1.30 → slurm_code-0.1.33}/src/slurm_code/cli.py +240 -45
  14. {slurm_code-0.1.30 → slurm_code-0.1.33}/src/slurm_code/config.py +3 -1
  15. slurm_code-0.1.33/src/slurm_code/core.py +649 -0
  16. slurm_code-0.1.33/src/slurm_code/data/slurm-env-hook.sh +354 -0
  17. {slurm_code-0.1.30 → slurm_code-0.1.33/src/slurm_code.egg-info}/PKG-INFO +1 -1
  18. {slurm_code-0.1.30 → slurm_code-0.1.33}/src/slurm_code.egg-info/SOURCES.txt +13 -8
  19. slurm_code-0.1.33/test/fixtures/scontrol_show_job.txt +1 -0
  20. slurm_code-0.1.33/test/test_activation.py +392 -0
  21. slurm_code-0.1.33/test/test_cli_env.py +335 -0
  22. slurm_code-0.1.33/test/test_env_activation_hook.py +413 -0
  23. slurm_code-0.1.33/test/test_env_hook.py +512 -0
  24. slurm_code-0.1.33/test/test_env_setup.py +293 -0
  25. slurm_code-0.1.30/docs/api/_sidebar.yml +0 -12
  26. slurm_code-0.1.30/docs/api/_styles-quartodoc.css +0 -22
  27. slurm_code-0.1.30/docs/api/functionname.qmd +0 -35
  28. slurm_code-0.1.30/docs/api/index.qmd +0 -19
  29. slurm_code-0.1.30/docs/api/scriptname.qmd +0 -6
  30. slurm_code-0.1.30/docs/pages/example.ipynb +0 -5104
  31. slurm_code-0.1.30/docs/pages/overview.ipynb +0 -75
  32. slurm_code-0.1.30/docs/pages/submit.md +0 -150
  33. slurm_code-0.1.30/src/slurm_code/core.py +0 -561
  34. {slurm_code-0.1.30 → slurm_code-0.1.33}/.devcontainer/Dockerfile +0 -0
  35. {slurm_code-0.1.30 → slurm_code-0.1.33}/.devcontainer/README.md +0 -0
  36. {slurm_code-0.1.30 → slurm_code-0.1.33}/.devcontainer/devcontainer.json +0 -0
  37. {slurm_code-0.1.30 → slurm_code-0.1.33}/.devcontainer/init-firewall.sh +0 -0
  38. {slurm_code-0.1.30 → slurm_code-0.1.33}/.devcontainer/mcp-setup/generate-config.sh +0 -0
  39. {slurm_code-0.1.30 → slurm_code-0.1.33}/.devcontainer/mcp-setup/install.sh +0 -0
  40. {slurm_code-0.1.30 → slurm_code-0.1.33}/.devcontainer/mcp-setup/pixi.toml +0 -0
  41. {slurm_code-0.1.30 → slurm_code-0.1.33}/.devcontainer/mcp-setup/servers.txt +0 -0
  42. {slurm_code-0.1.30 → slurm_code-0.1.33}/.devcontainer/mcp-setup/test-servers.sh +0 -0
  43. {slurm_code-0.1.30 → slurm_code-0.1.33}/.gitattributes +0 -0
  44. {slurm_code-0.1.30 → slurm_code-0.1.33}/.github/workflows/pypi-release.yml +0 -0
  45. {slurm_code-0.1.30 → slurm_code-0.1.33}/.github/workflows/quarto-publish.yml +0 -0
  46. {slurm_code-0.1.30 → slurm_code-0.1.33}/.gitignore +0 -0
  47. {slurm_code-0.1.30 → slurm_code-0.1.33}/.vscode/vscode.css +0 -0
  48. {slurm_code-0.1.30 → slurm_code-0.1.33}/CHANGELOG.md +0 -0
  49. {slurm_code-0.1.30 → slurm_code-0.1.33}/CLAUDE.md +0 -0
  50. {slurm_code-0.1.30 → slurm_code-0.1.33}/LICENSE +0 -0
  51. {slurm_code-0.1.30 → slurm_code-0.1.33}/README.md +0 -0
  52. {slurm_code-0.1.30 → slurm_code-0.1.33}/conda-build/README.md +0 -0
  53. {slurm_code-0.1.30 → slurm_code-0.1.33}/conda-build/build_env.yaml +0 -0
  54. {slurm_code-0.1.30 → slurm_code-0.1.33}/conda-build/meta.yaml +0 -0
  55. {slurm_code-0.1.30 → slurm_code-0.1.33}/docs/.gitignore +0 -0
  56. {slurm_code-0.1.30 → slurm_code-0.1.33}/docs/README.md +0 -0
  57. {slurm_code-0.1.30 → slurm_code-0.1.33}/docs/_extensions/machow/interlinks/.gitignore +0 -0
  58. {slurm_code-0.1.30 → slurm_code-0.1.33}/docs/_extensions/machow/interlinks/_extension.yml +0 -0
  59. {slurm_code-0.1.30 → slurm_code-0.1.33}/docs/_extensions/machow/interlinks/interlinks.lua +0 -0
  60. {slurm_code-0.1.30 → slurm_code-0.1.33}/docs/_inv/griffe_objects.txt +0 -0
  61. {slurm_code-0.1.30 → slurm_code-0.1.33}/docs/_inv/numpy_objects.txt +0 -0
  62. {slurm_code-0.1.30 → slurm_code-0.1.33}/docs/_inv/python_objects.txt +0 -0
  63. {slurm_code-0.1.30 → slurm_code-0.1.33}/docs/autodoc.mustache +0 -0
  64. {slurm_code-0.1.30 → slurm_code-0.1.33}/docs/custom.scss +0 -0
  65. {slurm_code-0.1.30 → slurm_code-0.1.33}/docs/objects.txt +0 -0
  66. {slurm_code-0.1.30 → slurm_code-0.1.33}/docs/pages/managing-jobs.md +0 -0
  67. {slurm_code-0.1.30 → slurm_code-0.1.33}/docs/styles.css +0 -0
  68. {slurm_code-0.1.30 → slurm_code-0.1.33}/pixi.lock +0 -0
  69. {slurm_code-0.1.30 → slurm_code-0.1.33}/scripts/bump_changelog.py +0 -0
  70. {slurm_code-0.1.30 → slurm_code-0.1.33}/scripts/bump_version.py +0 -0
  71. {slurm_code-0.1.30 → slurm_code-0.1.33}/scripts/docs-build-render.sh +0 -0
  72. {slurm_code-0.1.30 → slurm_code-0.1.33}/scripts/docs-run-notebooks.sh +0 -0
  73. {slurm_code-0.1.30 → slurm_code-0.1.33}/scripts/git-commit.sh +0 -0
  74. {slurm_code-0.1.30 → slurm_code-0.1.33}/scripts/github-release.sh +0 -0
  75. {slurm_code-0.1.30 → slurm_code-0.1.33}/scripts/rename.py +0 -0
  76. {slurm_code-0.1.30 → slurm_code-0.1.33}/scripts/tmux-project.sh +0 -0
  77. {slurm_code-0.1.30 → slurm_code-0.1.33}/setup.cfg +0 -0
  78. {slurm_code-0.1.30 → slurm_code-0.1.33}/src/slurm_code/__init__.py +0 -0
  79. {slurm_code-0.1.30 → slurm_code-0.1.33}/src/slurm_code/gdk-code.py +0 -0
  80. {slurm_code-0.1.30 → slurm_code-0.1.33}/src/slurm_code.egg-info/dependency_links.txt +0 -0
  81. {slurm_code-0.1.30 → slurm_code-0.1.33}/src/slurm_code.egg-info/entry_points.txt +0 -0
  82. {slurm_code-0.1.30 → slurm_code-0.1.33}/src/slurm_code.egg-info/requires.txt +0 -0
  83. {slurm_code-0.1.30 → slurm_code-0.1.33}/src/slurm_code.egg-info/top_level.txt +0 -0
  84. {slurm_code-0.1.30 → slurm_code-0.1.33}/test/__init__.py +0 -0
  85. {slurm_code-0.1.30 → slurm_code-0.1.33}/test/test_dummy.py +0 -0
  86. {slurm_code-0.1.30 → slurm_code-0.1.33}/test/test_modulename.py +0 -0
@@ -71,17 +71,10 @@ jobs:
71
71
  # python-version: ${{ matrix.python-version }}
72
72
  # # ==============================================================================
73
73
 
74
-
75
- # - name: Install dependencies
76
- # run: |
77
- # pip install --upgrade pip
78
- # pip install -r requirements.txt
79
-
80
- # - name: Test with pytest
81
- # run: |
82
- # pip install pytest
83
- # pytest test
84
-
74
+ - name: Install conda-build into base
75
+ shell: bash -l {0}
76
+ run: |
77
+ conda install -n base -c conda-forge -y conda-build conda-verify anaconda-client nodejs=24
85
78
 
86
79
  - name: Build and upload the conda packages
87
80
  uses: munch-group/action-conda-build-upload@v0.1.26
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: slurm-code
3
- Version: 0.1.30
3
+ Version: 0.1.33
4
4
  Summary: Project description
5
5
  Author-email: Your Name <your@email.com>
6
6
  License: MIT
@@ -0,0 +1,156 @@
1
+ # Plan v2: generic environment activation (--pixi / --conda / --uv) without generated files
2
+
3
+ v2 incorporates two adversarial reviews (A: hook & tool semantics; B: design, UX, migration, security).
4
+ Builds on the merged SLURM env hook (69eac76): `src/slurm_code/data/slurm-env-hook.sh` → `~/.slurm-code-hook.sh`, sourced from
5
+ `~/.bashrc`, selects the slurm-code job on the node (squeue `%i\t%k\t%j\t%Z`, cwd ⊂ WorkDir, tie → nothing) and exports VS_SLURM_*.
6
+
7
+ ## Problem
8
+ `--pixi` writes `<DIRECTORY>/.slurm-code-pixi-env.sh` (login-node snapshot incl. its PATH), sourced via the RELATIVE bashrc line
9
+ `[ -f .slurm-code-pixi-env.sh ] && source .slurm-code-pixi-env.sh`: left behind, stale, runs a plantable file from any cwd, pixi-only.
10
+
11
+ ## Facts (GenomeDK, 2026-12-05: pixi 0.81.0, Slurm 25.11.6, bash 5.1, NFS home)
12
+ - No conda/uv/modules for the user; conda users self-install. pixi in ~/.pixi/bin.
13
+ - Job comment round-trips verbatim via `squeue %k` (spaces, `;=/:`), ≥1024 chars OK, 1500 rejected. **The owner can change it on a
14
+ running job: `scontrol update JobId=… Comment=…` works.**
15
+ - `pixi shell-hook --as-is`: ~90 ms warm / 413 ms cold on a compute node; never installs or touches the lock; for a NOT installed env it
16
+ exits 0 and prints activation for a non-existent prefix. `--frozen` installs if missing. Concurrent installs are safe (pixi locks).
17
+ `pixi lock --check` and `pixi install --locked|--frozen` exist.
18
+ - conda: `conda.sh` ~5 ms; `conda activate` 18.6 s cold / ~0.3 s warm on a compute node. venv activate ~5 ms.
19
+
20
+ ## Definition of done
21
+ 1. No activation file written anywhere; old `.slurm-code-pixi-env.sh` removed where found; the relative bashrc line is never added and is
22
+ removed (with consent) where found.
23
+ 2. `submit DIRECTORY --pixi [--pixi-env E] | --conda NAME_OR_PREFIX | --uv [--venv PATH]`; profile key `env =`; `--no-env`.
24
+ 3. A terminal opened in DIRECTORY (or below) on the job node has the env active *after all of ~/.bashrc has run*, equivalent to running the
25
+ tool's own activation by hand at that moment.
26
+ 4. Never activates outside DIRECTORY, in job steps, during VSCODE_RESOLVING_ENVIRONMENT, or twice for the same env in nested shells.
27
+ 5. Terminal start never installs, never touches pixi.lock; activation is interruptible (Ctrl-C) and bounded by a timeout; slow cold starts
28
+ are reported, not silent.
29
+ 6. Bad choices fail before sbatch where possible; node-side failures (install) are reported with the option to cancel the job.
30
+ 7. Works under the user's set -e/-u/-f, aliases, nullglob/failglob, custom IFS; activation scripts see a normal top-level shell.
31
+ 8. Tests (bash 3.2 + 5) incl. real-style `activate.d` scripts; GenomeDK end-to-end for all three tools.
32
+
33
+ ## Design
34
+
35
+ ### 0. Prerequisite bug fix: quote the sbatch command
36
+ `build_sbatch_command` joins unquoted options and `run_remote` wraps them in `ssh host '…'` (core.py:33-35, 91-137): a `;` in the comment,
37
+ or a DIRECTORY/conda path with spaces or `'`, breaks or injects. Change to building an argv list, `shlex.join` it, and run via
38
+ `ssh host bash -s` with the command on stdin (no outer single quotes). Test: run the produced command through `sh -c` with a fake
39
+ `sbatch` that records argv; assert exact argv incl. `;`, spaces, quotes, `$`.
40
+
41
+ ### 1. CLI and profiles (fixes Click optional-value ambiguity, verified by reviewer: `submit --pixi ~/proj` ate DIRECTORY)
42
+ - Flags: `--pixi` (flag), `--pixi-env NAME` (implies --pixi), `--conda NAME_OR_PREFIX` (required value), `--uv` (flag), `--venv PATH`
43
+ (implies --uv; relative to DIRECTORY), `--no-env` (drop a profile's env). More than one kind → usage error.
44
+ - All kinds require DIRECTORY (B7: without it WorkDir=$HOME and every shell under ~ would activate).
45
+ - Profile: `env = pixi | pixi:NAME | conda:NAME_OR_PREFIX | uv | uv:PATH`; legacy `pixi = true` ≡ `env = pixi`; both in the same
46
+ resolved profile (incl. DEFAULT) → error. CLI beats profile.
47
+ - Parsing tests for every order: `submit --pixi DIR`, `submit DIR --pixi`, `--pixi --partition x DIR`, `--pixi-env cuda DIR`, etc.
48
+
49
+ ### 2. Carrier: versioned job comment
50
+ `slurm-code;v=1;env=pixi;penv=NAME` | `…;env=conda;prefix=/abs;conda=/abs/bin/conda` | `…;env=uv;venv=/abs`. No env → `slurm-code`.
51
+ Values: no `;`, tab, newline, leading/trailing space; total ≤ 1000 → error. Hook accepts `slurm-code` and `slurm-code;*`, ignores
52
+ unknown fields, and does no activation if `v` is newer than it understands (prints one line). Paths in comments are visible to other
53
+ users via squeue like WorkDir already is — documented.
54
+
55
+ ### 3. Submit flow
56
+ Pre-flight on the login node, before sbatch (one `ssh host bash -s` script; nothing submitted on error):
57
+ - pixi: pixi found (`command -v pixi || ~/.pixi/bin/pixi`); manifest discovered as pixi does (DIRECTORY or parents; pixi.toml or
58
+ pyproject.toml with [tool.pixi]) via `pixi info --json --manifest-path DIR`; NAME is an environment of it; lock policy check (D3).
59
+ - conda: find conda: profile/CLI override `conda_exe`, else `CONDA_EXE`/`type -P conda` from `bash -ic` (user's own init), else
60
+ `~/miniforge3 ~/mambaforge ~/miniconda3 ~/anaconda3 ~/micromamba`… `bin/conda`. Resolve NAME exactly as conda does: run
61
+ `conda shell.posix activate NAME` and read CONDA_PREFIX from it (handles `base`, envs_dirs order, environments.txt). Error lists envs.
62
+ - uv: venv = `--venv` or `DIRECTORY/.venv`; `bin/activate` and `bin/python` exist.
63
+ After allocation, on the node (`ssh node bash -s`), replacing `setup_pixi_env`:
64
+ - pixi: `pixi install --manifest-path DIR -e NAME` with the D3 lock flag (on the node so GPU `system-requirements` like `__cuda` resolve),
65
+ then a timed dry activation (warm-up). conda: timed dry activation. uv: `"$venv/bin/python" -c ''` (catches broken interpreter links).
66
+ - Failure → print the error and ask "Cancel job N? [Y/n]".
67
+ `reconnect DIR [--pixi …|--conda …|--uv …|--no-env]` (D7): runs the same pre-flight + node prep and `scontrol update JobId=… Comment=…`,
68
+ so the env can be set for jobs from older versions or changed without resubmitting. Without options reconnect warns if the job has no
69
+ env field but `DIRECTORY/.slurm-code-pixi-env.sh` existed.
70
+
71
+ ### 4. Hook: decide at bashrc time, activate at first prompt (A2, A3, B3)
72
+ - Decision (inside the existing function, at bashrc time): after VS_SLURM_*, parse the comment fields (split on `;`, first `=`, no eval);
73
+ activate only if env= present, cwd inside the job's WorkDir (realpath; never via the single-candidate fallback), SLURM_CODE_NO_ACTIVATE
74
+ != 1, and the same env is not already active (realpath compare of PIXI_PROJECT_ROOT+PIXI_ENVIRONMENT_NAME / CONDA_PREFIX /
75
+ VIRTUAL_ENV). A *different* active env (e.g. conda base from auto_activate_base) does not block: activating on top is what typing the
76
+ command does. Store the decision in globals `_SLURM_CODE_ACT_*` and prepend a one-shot entry to PROMPT_COMMAND.
77
+ - Activation (at the first prompt, i.e. after the whole ~/.bashrc incl. later conda init/PATH/PS1; top-level scope, so `declare` in
78
+ activation scripts is global): the PROMPT_COMMAND entry sources `~/.slurm-code-hook.sh`, which sees the pending globals and runs the
79
+ activation at file top level (not in a function), then removes its PROMPT_COMMAND entry (string removal; works with bash 3.2 strings
80
+ and bash 5 arrays left untouched) and unsets the globals. Around the activation it saves and restores: `set +e +u +f`,
81
+ `shopt -u expand_aliases nullglob failglob nocasematch`, IFS default.
82
+ - pixi: `out=$(builtin command timeout --foreground 10 "$pixi" shell-hook --manifest-path "$wd" -e "$penv" --shell bash --as-is 2>/dev/null)`;
83
+ verify in a subshell `( eval "$out"; [ -d "$CONDA_PREFIX/conda-meta" ] )`; then `eval "$out"`.
84
+ - conda: `. "$condabase/etc/profile.d/conda.sh"` (defines `conda`, needed for `conda deactivate`, also in nested shells);
85
+ `out=$(builtin command timeout --foreground 30 "$conda_exe" shell.posix activate "$prefix")` then `eval "$out"` and `hash -r`
86
+ — identical to what conda's own `conda activate` function does, but bounded and interruptible.
87
+ - uv: `. "$venv/bin/activate"`.
88
+ - Timing: if activation took > 2 s print `slurm-code: activated <kind> env in N s (cold file cache)`; on failure/timeout one line
89
+ `slurm-code: could not activate <kind> env <x>: <reason>`. Ctrl-C only aborts the activation (bashrc already finished).
90
+ - Commands run as `bash -ic 'cmd'` show no prompt → no activation (acceptable; documented).
91
+ - Hook file carries `# slurm-code-hook-version: N`; the installer refuses to replace a newer version (old clients still can → docs:
92
+ upgrade all clients; the next new submit/reconnect restores it).
93
+
94
+ ### 5. Removing the old mechanism
95
+ - Delete setup_pixi_env, PIXI_ENV_SCRIPT writing, PIXI_BASHRC_LINE; the bashrc prompt only adds the hook line.
96
+ - Env-hook setup also `rm -f DIRECTORY/.slurm-code-pixi-env.sh`. Docs: `find -L ~ /faststorage/… -name .slurm-code-pixi-env.sh` guidance.
97
+ - Old relative line (D2): if present (exact line match, commented-out lines ignored), prompt "Remove the unsafe line … from ~/.bashrc?
98
+ [Y/n]"; back up to `~/.bashrc.slurm-code.bak`; rewrite by `cat > ~/.bashrc` through the link (never `sed -i`, which replaces symlinks);
99
+ remove the preceding "# Added by slurm-code" comment only if it then has no slurm-code line under it.
100
+
101
+ ### 6. Tests
102
+ - Hook: fake squeue comments (v1 fields, unknown fields, newer v, malicious values `$(…)`, backticks, quotes never executed); fake pixi
103
+ shell-hook output that sources a fixture `activate.d` script which uses an unset variable, `declare`, and relies on globbing; fake conda
104
+ base with real-shaped `conda.sh` + `conda shell.posix activate` emitter; fake venv. Run the PROMPT_COMMAND phase (`bash -i` with a
105
+ script that sources bashrc-like content then evaluates PROMPT_COMMAND) under set -e/-u/-f, aliases (`alias cd=…`), nullglob/failglob.
106
+ Cases: activation after a later "conda init + auto_activate_base" block wins; PROMPT_COMMAND entry removed after one run and user's
107
+ PROMPT_COMMAND preserved; nested shell same env → skip; different env active → activates on top; outside WorkDir / fallback job → none;
108
+ missing prefix → warning; timeout → warning (fake tool sleeping); realpath (symlinked DIRECTORY) handling.
109
+ - Python: sbatch argv quoting (§0); Click parsing matrix (§1); profile `env` parsing and conflict with `pixi`; comment build/validate;
110
+ pre-flight and node scripts via fake ssh; bashrc line removal (symlinked .bashrc, commented line untouched, backup written); hook
111
+ version no-downgrade.
112
+ - GenomeDK end-to-end (short jobs): pixi default + named env with an `activate.d` package (e.g. openjdk), conda (temporary Miniforge in a
113
+ scratch dir) incl. `--conda base`, uv venv; reconnect switching env via scontrol update; terminal opened ≥10 min after warm-up to
114
+ measure real cold/warm behaviour. Only a real VSCode session can confirm PROMPT_COMMAND interplay with VSCode shell integration —
115
+ user check.
116
+
117
+ ### 7. Docs
118
+ submit.md "Environment activation" (options, comment carrier, first-prompt activation, scope = DIRECTORY, opt-out
119
+ SLURM_CODE_NO_ACTIVATE, timing messages, `bash -ic` caveat; extension host / Python interpreter / Jupyter kernels do NOT get it — select the
120
+ env's interpreter in VSCode; set `python.terminal.activateEnvironment: false` (and the Python Environments extension's auto-activation
121
+ setting) to avoid double activation; security: activation runs code from the project (pixi [activation] scripts, activate.d, venv
122
+ activate) — keep project dirs non-group-writable). reconnect.md (new options). profiles.md (`env`, `conda_exe`, legacy `pixi`).
123
+ Upgrade notes.
124
+
125
+ ## Decisions (made by the user, 2026-12-05)
126
+ - D2: old relative pixi line → prompt to remove, default Yes, with backup `~/.bashrc.slurm-code.bak`.
127
+ - D3: never rewrite pixi.lock → pre-flight `pixi lock --check`; outdated → fail with "run `pixi install` first"; install with `--frozen`.
128
+ - D7: `reconnect` can set/change the env via `scontrol update` (incl. jobs from older versions).
129
+
130
+ ## Rejected review suggestions
131
+ - "Skip if any other env is active" (B10): would never activate for conda users with auto_activate_base; activating on top matches
132
+ manual use. Same-env check kept.
133
+ - Lock-mtime staleness warning (B10): no reliable pixi install stamp verified; `--as-is` + D3 keeps the lock authoritative. Revisit later.
134
+ - Warn on group-writable project dirs (A11): docs only for now.
135
+
136
+ ## Non-goals
137
+ mamba/micromamba envs as a kind (extensible via `env=`), modules, zsh/fish.
138
+
139
+ ## Implementation notes (2026-12-05)
140
+
141
+ - **Changed during implementation:** GenomeDK compute nodes have no internet access ("Network unreachable"
142
+ from `pixi install` on a node). pixi environments are therefore installed with `pixi install --frozen` on
143
+ the login node before `sbatch` (shared filesystem; this also fails fast before allocation). If that fails
144
+ (e.g. GPU `system-requirements` the login node lacks), the node retries `pixi install --frozen` from the
145
+ shared package cache. The node step otherwise only warms up the activation.
146
+ - `pixi lock --check` alone rewrites/creates pixi.lock; the pre-flight uses `pixi lock --check --dry-run`.
147
+ - VSCode shell integration runs a saved copy of PROMPT_COMMAND (`__vsc_original_prompt_command`) inside a
148
+ function; the hook removes its entry from both. In that copy, activation runs inside a function, so
149
+ `declare` in an activation script would be local there (rare; not fixable from the hook).
150
+ - Verified end-to-end on GenomeDK (job on cn-1057, user's real ~/.bashrc with iTerm2/bash-preexec):
151
+ pixi default and `extra` (real `activate.d` from `proj`: PROJ_DATA set), conda prefix env incl. `conda
152
+ deactivate`, uv venv incl. `deactivate`, `--no-env`, reconnect switching env via `scontrol update`,
153
+ activation only inside DIRECTORY, no double activation in nested shells. First-prompt cost: pixi ~0.4–0.5 s,
154
+ conda ~0.8 s, uv ~30 ms.
155
+ - Warm-up persistence: a conda terminal opened 11 min after the warm-up activated in 0.4–0.5 s (vs 18.6 s
156
+ fully cold). Measured on an otherwise idle job; heavy memory pressure in the job could still evict caches.
@@ -40,11 +40,11 @@ website:
40
40
  title: "slurm-code"
41
41
  page-navigation: true
42
42
  navbar:
43
- left:
44
- - href: api/
45
- text: API reference
46
- # - href: gallery/
47
- # text: Gallery
43
+ # left:
44
+ # - href: api/
45
+ # text: API reference
46
+ # # - href: gallery/
47
+ # # text: Gallery
48
48
  right:
49
49
  - icon: github
50
50
  href: https://github.com/munch-group/slurm-code/
@@ -56,8 +56,10 @@ website:
56
56
  contents:
57
57
  - pages/getting-started.md
58
58
  - pages/submit.md
59
+ - pages/jobs.md
60
+ - pages/cancel.md
61
+ - pages/reconnect.md
59
62
  - pages/profiles.md
60
- - pages/managing-jobs.md
61
63
 
62
64
  lightbox: true
63
65
 
@@ -65,7 +67,7 @@ format:
65
67
  html:
66
68
  theme: cosmo
67
69
  css:
68
- - api/_styles-quartodoc.css
70
+ # - api/_styles-quartodoc.css
69
71
  - styles.css
70
72
  # - custom.scss
71
73
  toc: true
@@ -75,29 +77,29 @@ format:
75
77
  mermaid:
76
78
  theme: neutral
77
79
 
78
- quartodoc:
79
- package: slurm-code
80
- style: pkgdown
81
- dir: api
82
- render_interlinks: true
83
- options:
84
- signature_name: full
85
- renderer:
86
- style: markdown
87
- table_style: description-list
88
- sidebar: "api/_sidebar.yml"
89
- css: "api/_styles-quartodoc.css"
80
+ # quartodoc:
81
+ # package: slurm-code
82
+ # style: pkgdown
83
+ # dir: api
84
+ # render_interlinks: true
85
+ # options:
86
+ # signature_name: full
87
+ # renderer:
88
+ # style: markdown
89
+ # table_style: description-list
90
+ # sidebar: "api/_sidebar.yml"
91
+ # css: "api/_styles-quartodoc.css"
90
92
 
91
- sections:
92
- - title: Some section
93
- package: slurm_code.modulename
94
- desc: |
95
- Some description...
96
- contents:
97
- - functionname
98
- - title: Some other section
99
- package: slurm_code.modulename
100
- desc: |
101
- Some description...
102
- contents:
103
- - scriptname
93
+ # sections:
94
+ # - title: Some section
95
+ # package: slurm_code.modulename
96
+ # desc: |
97
+ # Some description...
98
+ # contents:
99
+ # - functionname
100
+ # - title: Some other section
101
+ # package: slurm_code.modulename
102
+ # desc: |
103
+ # Some description...
104
+ # contents:
105
+ # - scriptname
@@ -0,0 +1,42 @@
1
+ ---
2
+ title: Cancel Jobs
3
+ ---
4
+
5
+ slurm-code provides commands to list, cancel, and reconnect to jobs that were submitted through `slurm-code submit`. These commands identify managed jobs by their `sc-` name prefix.
6
+
7
+ ## Cancelling jobs {#cancelling-jobs}
8
+
9
+ The `cancel` command cancels slurm-code managed jobs.
10
+
11
+ ### Cancel by job ID
12
+
13
+ ```bash
14
+ slurm-code cancel 1234567
15
+ ```
16
+
17
+ ### Cancel by name
18
+
19
+ You can use the directory basename (without the `sc-` prefix):
20
+
21
+ ```bash
22
+ slurm-code cancel my-project
23
+ ```
24
+
25
+ Or the full job name:
26
+
27
+ ```bash
28
+ slurm-code cancel sc-my-project
29
+ ```
30
+
31
+ ### Cancel all jobs
32
+
33
+ ```bash
34
+ slurm-code cancel --all
35
+ ```
36
+
37
+ ### Options
38
+
39
+ | Argument/Option | Description |
40
+ |-----------------|-------------|
41
+ | `JOB_ID_OR_NAME` | A job ID (numeric) or job name to cancel |
42
+ | `--all` | Cancel all slurm-code managed jobs |
@@ -33,10 +33,9 @@ pip install slurm-code
33
33
 
34
34
  ## Prerequisites
35
35
 
36
- - An SSH host alias configured in `~/.ssh/config` for the GenomeDK login node (default alias: `gdk`)
37
- - [VSCode](https://code.visualstudio.com/) with the [Remote - SSH](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh) extension installed
38
-
39
- A minimal SSH config entry:
36
+ 1. SSH keys set up for [login to GenomeDK without password](https://genome.au.dk/docs/getting-started/#public-key-authentication):
37
+ 2. [VSCode](https://code.visualstudio.com/) with the [Remote - SSH](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh) extension installed
38
+ 3. An SSH host alias configured in `~/.ssh/config` for the GenomeDK login node (default alias: `gdk`):
40
39
 
41
40
  ```
42
41
  Host gdk
@@ -74,7 +73,7 @@ slurm-code -H my-cluster submit ~/project
74
73
 
75
74
  | Command | Description |
76
75
  |---------|-------------|
77
- | [`submit`](submit.md) | Submit a SLURM job and open VSCode on the node |
76
+ | [`submit`](submit.md) | Submit a SLURM job and open VSCode on the node. [Full documentation](submit.md) |
78
77
  | [`profiles`](profiles.md) | Show available submit profiles |
79
78
  | [`jobs`](managing-jobs.md#listing-jobs) | List running slurm-code jobs |
80
79
  | [`cancel`](managing-jobs.md#cancelling-jobs) | Cancel slurm-code jobs |
@@ -0,0 +1,34 @@
1
+ ---
2
+ title: Listing Jobs
3
+ ---
4
+
5
+ slurm-code provides commands to list, cancel, and reconnect to jobs that were submitted through `slurm-code submit`. These commands identify managed jobs by their `sc-` name prefix.
6
+
7
+ ## Listing jobs {#listing-jobs}
8
+
9
+ The `jobs` command shows your running slurm-code jobs:
10
+
11
+ ```bash
12
+ slurm-code jobs
13
+ ```
14
+
15
+ Example output:
16
+
17
+ ```
18
+ JOBID NAME PARTITION REQMEM CPUS TIMELIMIT ELAPSED STATE
19
+ ----------------------------------------------------------------------------------------------------------
20
+ 1234567 sc-my-project normal 8Gn 1 08:00:00 01:23:45 RUNNING
21
+ 1234568 sc-analysis normal 16Gn 4 12:00:00 00:45:12 RUNNING
22
+ ```
23
+
24
+ ### Options
25
+
26
+ | Option | Description |
27
+ |--------|-------------|
28
+ | `--all-states` | Include PENDING jobs (default: RUNNING only) |
29
+
30
+ To also see pending jobs:
31
+
32
+ ```bash
33
+ slurm-code jobs --all-states
34
+ ```
@@ -51,7 +51,9 @@ Profile keys use the same names as the CLI options (with underscores instead of
51
51
  |-----|---------------------|
52
52
  | `account` | `--account` |
53
53
  | `cpus_per_task` | `--cpus-per-task` |
54
+ | `conda_exe` | `--conda-exe` |
54
55
  | `cpus_per_gpu` | `--cpus-per-gpu` |
56
+ | `env` | `--pixi`, `--pixi-env`, `--conda`, `--uv`, `--venv` (see below) |
55
57
  | `error` | `--error` |
56
58
  | `exclude` | `--exclude` |
57
59
  | `job_name` | `--job-name` |
@@ -72,6 +74,31 @@ Profile keys use the same names as the CLI options (with underscores instead of
72
74
 
73
75
  Boolean keys (`no_requeue`, `requeue`, `use_min_nodes`) accept `true`/`false`, `yes`/`no`, or `1`/`0`.
74
76
 
77
+ ### Environment
78
+
79
+ `env` selects the [environment activated in terminals](submit.md#environment-activation):
80
+
81
+ | Value | Same as |
82
+ |-------|---------|
83
+ | `env = pixi` | `--pixi` |
84
+ | `env = pixi:cuda` | `--pixi-env cuda` |
85
+ | `env = conda:myenv` | `--conda myenv` (a name or a prefix path) |
86
+ | `env = uv` | `--uv` |
87
+ | `env = uv:envs/gpu` | `--venv envs/gpu` |
88
+ | `env = none` | `--no-env` |
89
+
90
+ ```ini
91
+ [gpu]
92
+ partition = gpu
93
+ env = pixi:cuda
94
+
95
+ [analysis]
96
+ env = conda:analysis
97
+ conda_exe = /faststorage/project/me/miniforge3/bin/conda
98
+ ```
99
+
100
+ An environment option on the command line replaces the profile's `env`, and `--no-env` removes it. The older key `pixi = true` still works and means `env = pixi`; a profile (including `[DEFAULT]`) must not set both `pixi` and `env`.
101
+
75
102
  ## Precedence
76
103
 
77
104
  When a profile is active, values are resolved in this order (highest priority first):
@@ -0,0 +1,48 @@
1
+ ---
2
+ title: Reconnecting to Jobs
3
+ ---
4
+
5
+ slurm-code provides commands to list, cancel, and reconnect to jobs that were submitted through `slurm-code submit`. These commands identify managed jobs by their `sc-` name prefix.
6
+
7
+ ## Reconnecting to a job {#reconnecting-to-a-job}
8
+
9
+ If VSCode disconnects or you close the window, use `reconnect` to reopen it on the same node:
10
+
11
+ ```bash
12
+ slurm-code reconnect ~/my-project
13
+ ```
14
+
15
+ This finds the running job that matches the directory name and opens VSCode on its allocated node. Relative paths are resolved relative to `$HOME`.
16
+
17
+ If multiple jobs match the directory name, you'll be prompted to select one:
18
+
19
+ ```
20
+ Multiple matching jobs found:
21
+ [1] 1234567 01:23:45 RUNNING
22
+ [2] 1234568 00:45:12 RUNNING
23
+ Select job number:
24
+ ```
25
+
26
+ ### Usage
27
+
28
+ ```bash
29
+ slurm-code reconnect [OPTIONS] DIRECTORY
30
+ ```
31
+
32
+ | Argument | Description |
33
+ |----------|-------------|
34
+ | `DIRECTORY` | Path on the remote host (used to match the job name) |
35
+
36
+ ### Setting or changing the environment
37
+
38
+ `reconnect` accepts the same environment options as [`submit`](submit.md#environment-activation): `--pixi`, `--pixi-env`, `--conda`, `--conda-exe`, `--uv`, `--venv` and `--no-env`. With one of them, slurm-code checks and prepares the environment, then records it in the running job (`scontrol update ... Comment=...`), so terminals opened afterwards activate it. Terminals that are already open keep what they have.
39
+
40
+ ```bash
41
+ # switch the running job to the project's cuda pixi environment
42
+ slurm-code reconnect ~/my-project --pixi-env cuda
43
+
44
+ # stop activating an environment
45
+ slurm-code reconnect ~/my-project --no-env
46
+ ```
47
+
48
+ This is also how to add environment activation to a job started by an older slurm-code (0.1.32 or earlier), which recorded no environment. `reconnect` points this out when it finds that job's old `.slurm-code-pixi-env.sh` file.