omnirun 0.2.1__tar.gz → 0.2.2__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.
- {omnirun-0.2.1 → omnirun-0.2.2}/.github/workflows/publish.yml +3 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/PKG-INFO +5 -2
- {omnirun-0.2.1 → omnirun-0.2.2}/README.md +4 -1
- {omnirun-0.2.1 → omnirun-0.2.2}/flake.nix +3 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/pyproject.toml +1 -1
- omnirun-0.2.2/scripts/check-version.sh +32 -0
- omnirun-0.2.2/scripts/pre-push +39 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/__init__.py +1 -1
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/backends/colab.py +3 -1
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/backends/kaggle.py +3 -1
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/backends/local.py +4 -1
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/backends/marketplace.py +1 -1
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/backends/slurm.py +4 -2
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/backends/ssh.py +1 -1
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/backends/vast.py +15 -9
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/config.py +13 -2
- omnirun-0.2.2/tests/test_config.py +37 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/tests/test_marketplaces.py +1 -1
- {omnirun-0.2.1 → omnirun-0.2.2}/tests/test_slurm.py +26 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/.envrc +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/.github/workflows/checks.yml +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/.github/workflows/ci.yml +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/.gitignore +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/.python-version +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/AGENTS.md +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/CLAUDE.md +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/DESIGN.md +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/TESTING.md +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/flake.lock +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/main.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/research/colab-kaggle.md +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/research/gpu-marketplaces.md +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/research/launcher-landscape.md +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/research/ml-job-queues.md +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/research/slurm-ssh.md +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/backends/__init__.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/backends/base.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/backends/jobdir.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/backends/runpod.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/backends/tarsafe.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/backends/thunder.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/bootstrap.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/chooser.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/cli.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/daemon.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/execlayer/__init__.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/execlayer/base.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/execlayer/local.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/execlayer/ssh.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/models.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/queue.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/repo.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/src/omnirun/store.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/tests/__init__.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/tests/conftest.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/tests/test_bootstrap.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/tests/test_chooser.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/tests/test_cli.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/tests/test_colab.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/tests/test_kaggle.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/tests/test_local_backend.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/tests/test_queue.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/tests/test_repo.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/tests/test_ssh_backend.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/tests/test_ssh_exec.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/tests/test_store.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/tests/test_tarsafe.py +0 -0
- {omnirun-0.2.1 → omnirun-0.2.2}/uv.lock +0 -0
|
@@ -22,6 +22,9 @@ jobs:
|
|
|
22
22
|
- name: Checkout
|
|
23
23
|
uses: actions/checkout@v7
|
|
24
24
|
|
|
25
|
+
- name: Check tag matches package version
|
|
26
|
+
run: ./scripts/check-version.sh "${GITHUB_REF_NAME}"
|
|
27
|
+
|
|
25
28
|
- name: Install uv
|
|
26
29
|
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
27
30
|
with:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: omnirun
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Run jobs from your repo anywhere: Slurm over SSH, any SSH box, Kaggle, Colab, or marketplace GPUs
|
|
5
5
|
Author-email: Dmitrii Mukhutdinov <flyingleafe@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -140,7 +140,9 @@ section name is yours (you can have several of the same type). All backends
|
|
|
140
140
|
accept `enabled = false` to keep the config without probing it. Every backend
|
|
141
141
|
also accepts `project_root` (point it at an existing checkout to reuse its
|
|
142
142
|
`.git`/`.venv`) and `max_parallel` (queue-daemon cap on concurrent jobs, default
|
|
143
|
-
`1`).
|
|
143
|
+
`1`). `project_root` may be a single path (applied to every repo) or a table
|
|
144
|
+
mapping repo slug -> path, with an optional `default` key as fallback, so one
|
|
145
|
+
backend can serve several repos (each getting the right checkout).
|
|
144
146
|
|
|
145
147
|
```toml
|
|
146
148
|
[policy]
|
|
@@ -159,6 +161,7 @@ poll_interval_s = 10.0 # scheduler tick: refresh running + place pending
|
|
|
159
161
|
type = "local"
|
|
160
162
|
# root = "$HOME/.omnirun" # OMNIRUN_ROOT: where jobs live
|
|
161
163
|
# project_root = "$HOME/proj" # reuse an existing checkout's .git and .venv
|
|
164
|
+
# project_root = { my-repo = "$HOME/proj" } # or per-repo (by slug), else default path
|
|
162
165
|
# max_parallel = 2 # queue daemon: run up to 2 jobs here at once
|
|
163
166
|
|
|
164
167
|
# ---- any machine you can ssh into ----
|
|
@@ -120,7 +120,9 @@ section name is yours (you can have several of the same type). All backends
|
|
|
120
120
|
accept `enabled = false` to keep the config without probing it. Every backend
|
|
121
121
|
also accepts `project_root` (point it at an existing checkout to reuse its
|
|
122
122
|
`.git`/`.venv`) and `max_parallel` (queue-daemon cap on concurrent jobs, default
|
|
123
|
-
`1`).
|
|
123
|
+
`1`). `project_root` may be a single path (applied to every repo) or a table
|
|
124
|
+
mapping repo slug -> path, with an optional `default` key as fallback, so one
|
|
125
|
+
backend can serve several repos (each getting the right checkout).
|
|
124
126
|
|
|
125
127
|
```toml
|
|
126
128
|
[policy]
|
|
@@ -139,6 +141,7 @@ poll_interval_s = 10.0 # scheduler tick: refresh running + place pending
|
|
|
139
141
|
type = "local"
|
|
140
142
|
# root = "$HOME/.omnirun" # OMNIRUN_ROOT: where jobs live
|
|
141
143
|
# project_root = "$HOME/proj" # reuse an existing checkout's .git and .venv
|
|
144
|
+
# project_root = { my-repo = "$HOME/proj" } # or per-repo (by slug), else default path
|
|
142
145
|
# max_parallel = 2 # queue daemon: run up to 2 jobs here at once
|
|
143
146
|
|
|
144
147
|
# ---- any machine you can ssh into ----
|
|
@@ -71,6 +71,9 @@
|
|
|
71
71
|
|
|
72
72
|
shellHook = ''
|
|
73
73
|
${pre-commit-check.shellHook}
|
|
74
|
+
# Guard against tagging a release without bumping the version.
|
|
75
|
+
# pre-commit owns only the pre-commit hook, so pre-push is ours.
|
|
76
|
+
ln -sf "$PWD/scripts/pre-push" "$(git rev-parse --git-path hooks)/pre-push"
|
|
74
77
|
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc.cc.lib pkgs.zlib ]}:$LD_LIBRARY_PATH
|
|
75
78
|
export UV_PYTHON=${python}/bin/python
|
|
76
79
|
uv sync --quiet
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Verify the package version is internally consistent, and optionally that it
|
|
3
|
+
# matches an expected version (e.g. a release tag).
|
|
4
|
+
#
|
|
5
|
+
# scripts/check-version.sh # pyproject.toml == src/omnirun/__init__.py
|
|
6
|
+
# scripts/check-version.sh v0.2.2 # ...and both equal 0.2.2
|
|
7
|
+
#
|
|
8
|
+
# Used by both the publish workflow and the pre-push hook so the rule lives in
|
|
9
|
+
# one place.
|
|
10
|
+
set -euo pipefail
|
|
11
|
+
|
|
12
|
+
root="$(cd "$(dirname "$0")/.." && pwd)"
|
|
13
|
+
|
|
14
|
+
extract() { grep -m1 -E "$2" "$root/$1" | sed -E 's/.*"([^"]+)".*/\1/'; }
|
|
15
|
+
|
|
16
|
+
pyproject="$(extract pyproject.toml '^version *= *"')"
|
|
17
|
+
init="$(extract src/omnirun/__init__.py '^__version__ *= *"')"
|
|
18
|
+
|
|
19
|
+
if [ "$pyproject" != "$init" ]; then
|
|
20
|
+
echo "version mismatch: pyproject.toml=$pyproject src/omnirun/__init__.py=$init" >&2
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
if [ "$#" -ge 1 ]; then
|
|
25
|
+
expected="${1#v}"
|
|
26
|
+
if [ "$pyproject" != "$expected" ]; then
|
|
27
|
+
echo "version mismatch: expected $expected but package version is $pyproject" >&2
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
echo "version OK: $pyproject"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Refuse to push a release tag whose commit does not declare a matching version.
|
|
3
|
+
#
|
|
4
|
+
# Installed as .git/hooks/pre-push by the devShell (see flake.nix). It inspects
|
|
5
|
+
# the *pushed commit's* content (via `git show <sha>:path`), so it catches a
|
|
6
|
+
# stale worktree too. CI (publish.yml) enforces the same rule server-side.
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
|
|
9
|
+
version_at() { git show "$1:$2" | grep -m1 -E "$3" | sed -E 's/.*"([^"]+)".*/\1/'; }
|
|
10
|
+
|
|
11
|
+
status=0
|
|
12
|
+
while read -r _local_ref local_sha remote_ref _remote_sha; do
|
|
13
|
+
case "$remote_ref" in
|
|
14
|
+
refs/tags/v[0-9]*) ;;
|
|
15
|
+
*) continue ;;
|
|
16
|
+
esac
|
|
17
|
+
# Deleting a tag pushes the zero sha; nothing to check.
|
|
18
|
+
case "$local_sha" in
|
|
19
|
+
0000000000000000000000000000000000000000) continue ;;
|
|
20
|
+
esac
|
|
21
|
+
|
|
22
|
+
tag="${remote_ref#refs/tags/}"
|
|
23
|
+
pyproject="$(version_at "$local_sha" pyproject.toml '^version *= *"')"
|
|
24
|
+
init="$(version_at "$local_sha" src/omnirun/__init__.py '^__version__ *= *"')"
|
|
25
|
+
|
|
26
|
+
if [ "$tag" != "v$pyproject" ]; then
|
|
27
|
+
echo "pre-push: tag $tag != pyproject version $pyproject (commit ${local_sha:0:12})" >&2
|
|
28
|
+
status=1
|
|
29
|
+
fi
|
|
30
|
+
if [ "$pyproject" != "$init" ]; then
|
|
31
|
+
echo "pre-push: pyproject $pyproject != __init__ $init (commit ${local_sha:0:12})" >&2
|
|
32
|
+
status=1
|
|
33
|
+
fi
|
|
34
|
+
done
|
|
35
|
+
|
|
36
|
+
if [ "$status" -ne 0 ]; then
|
|
37
|
+
echo "pre-push: bump the version before tagging (see scripts/check-version.sh)" >&2
|
|
38
|
+
fi
|
|
39
|
+
exit "$status"
|
|
@@ -360,7 +360,9 @@ class ColabBackend(Backend):
|
|
|
360
360
|
BootstrapParams(
|
|
361
361
|
omnirun_root=COLAB_ROOT,
|
|
362
362
|
project_root=jobdir.project_root_of(
|
|
363
|
-
COLAB_ROOT,
|
|
363
|
+
COLAB_ROOT,
|
|
364
|
+
spec.repo.slug,
|
|
365
|
+
self.config.project_root_for(spec.repo.slug),
|
|
364
366
|
),
|
|
365
367
|
code=code,
|
|
366
368
|
),
|
|
@@ -435,7 +435,9 @@ class KaggleBackend(Backend):
|
|
|
435
435
|
BootstrapParams(
|
|
436
436
|
omnirun_root=KAGGLE_ROOT,
|
|
437
437
|
project_root=jobdir.project_root_of(
|
|
438
|
-
KAGGLE_ROOT,
|
|
438
|
+
KAGGLE_ROOT,
|
|
439
|
+
spec.repo.slug,
|
|
440
|
+
self.config.project_root_for(spec.repo.slug),
|
|
439
441
|
),
|
|
440
442
|
code=code,
|
|
441
443
|
),
|
|
@@ -113,7 +113,10 @@ class LocalBackend(Backend):
|
|
|
113
113
|
def submit(self, spec: JobSpec, offer: Offer) -> JobHandle:
|
|
114
114
|
root = jobdir.remote_root(self.exec, self.config.root)
|
|
115
115
|
project_root = jobdir.resolve_project_root(
|
|
116
|
-
self.exec,
|
|
116
|
+
self.exec,
|
|
117
|
+
root,
|
|
118
|
+
spec.repo.slug,
|
|
119
|
+
self.config.project_root_for(spec.repo.slug),
|
|
117
120
|
)
|
|
118
121
|
params = BootstrapParams(
|
|
119
122
|
omnirun_root=root,
|
|
@@ -286,7 +286,7 @@ class MarketplaceBackend(Backend, ABC):
|
|
|
286
286
|
self._wait_ssh(ex)
|
|
287
287
|
root = jobdir.remote_root(ex, self.config.root)
|
|
288
288
|
project_root = jobdir.resolve_project_root(
|
|
289
|
-
ex, root, spec.repo.slug, self.config.
|
|
289
|
+
ex, root, spec.repo.slug, self.config.project_root_for(spec.repo.slug)
|
|
290
290
|
)
|
|
291
291
|
params = BootstrapParams(
|
|
292
292
|
omnirun_root=root,
|
|
@@ -181,6 +181,8 @@ class SlurmBackend(Backend):
|
|
|
181
181
|
|
|
182
182
|
reasons: list[str] = []
|
|
183
183
|
notes: list[str] = []
|
|
184
|
+
if res.wants_gpu() and self.config.extra("has_gpus", True) is False:
|
|
185
|
+
reasons.append(f"backend {self.name} is CPU-only (has_gpus = false)")
|
|
184
186
|
if res.wants_gpu() and res.gpu_type and self.config.gpu_map:
|
|
185
187
|
if _gpu_map_lookup(self.config.gpu_map, res.gpu_type) is None:
|
|
186
188
|
reasons.append(
|
|
@@ -258,7 +260,7 @@ class SlurmBackend(Backend):
|
|
|
258
260
|
root = self.config.root
|
|
259
261
|
job_dir = jobdir.job_dir_of(root, spec.job_id)
|
|
260
262
|
project_root = jobdir.project_root_of(
|
|
261
|
-
root, spec.repo.slug, self.config.
|
|
263
|
+
root, spec.repo.slug, self.config.project_root_for(spec.repo.slug)
|
|
262
264
|
)
|
|
263
265
|
sbatch = render_sbatch(spec, self.config, job_dir, root)
|
|
264
266
|
bootstrap = generate_bootstrap(
|
|
@@ -281,7 +283,7 @@ class SlurmBackend(Backend):
|
|
|
281
283
|
ex = self.exec_
|
|
282
284
|
root = jobdir.remote_root(ex, self.config.root)
|
|
283
285
|
project_root = jobdir.resolve_project_root(
|
|
284
|
-
ex, root, spec.repo.slug, self.config.
|
|
286
|
+
ex, root, spec.repo.slug, self.config.project_root_for(spec.repo.slug)
|
|
285
287
|
)
|
|
286
288
|
params = BootstrapParams(
|
|
287
289
|
omnirun_root=root,
|
|
@@ -217,7 +217,7 @@ class SshBackend(Backend):
|
|
|
217
217
|
ex = self.exec_
|
|
218
218
|
root = jobdir.remote_root(ex, self.config.root)
|
|
219
219
|
project_root = jobdir.resolve_project_root(
|
|
220
|
-
ex, root, spec.repo.slug, self.config.
|
|
220
|
+
ex, root, spec.repo.slug, self.config.project_root_for(spec.repo.slug)
|
|
221
221
|
)
|
|
222
222
|
params = BootstrapParams(
|
|
223
223
|
omnirun_root=root,
|
|
@@ -37,23 +37,25 @@ OFFER_LIMIT = 5
|
|
|
37
37
|
MIN_RELIABILITY = 0.95
|
|
38
38
|
|
|
39
39
|
# normalized name -> vast gpu_name values (their catalog naming)
|
|
40
|
+
# The REST /bundles/ endpoint matches gpu_name with spaces ("A100 SXM4");
|
|
41
|
+
# underscore forms match nothing (the vast CLI translates them, the API doesn't).
|
|
40
42
|
VAST_GPU_NAMES: dict[str, list[str]] = {
|
|
41
43
|
"H200": ["H200"],
|
|
42
|
-
"H100": ["
|
|
43
|
-
"A100": ["
|
|
44
|
-
"A100-80": ["
|
|
45
|
-
"A6000": ["
|
|
44
|
+
"H100": ["H100 SXM", "H100 PCIE", "H100 NVL"],
|
|
45
|
+
"A100": ["A100 SXM4", "A100 PCIE", "A100X"],
|
|
46
|
+
"A100-80": ["A100 SXM4", "A100 PCIE"],
|
|
47
|
+
"A6000": ["RTX A6000"],
|
|
46
48
|
"L40": ["L40", "L40S"],
|
|
47
49
|
"L4": ["L4"],
|
|
48
|
-
"V100": ["
|
|
49
|
-
"4090": ["
|
|
50
|
-
"3090": ["
|
|
51
|
-
"5090": ["
|
|
50
|
+
"V100": ["Tesla V100"],
|
|
51
|
+
"4090": ["RTX 4090"],
|
|
52
|
+
"3090": ["RTX 3090"],
|
|
53
|
+
"5090": ["RTX 5090"],
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
|
|
55
57
|
def vast_gpu_names(gpu_type: str) -> list[str]:
|
|
56
|
-
return VAST_GPU_NAMES.get(gpu_type, [gpu_type.replace("
|
|
58
|
+
return VAST_GPU_NAMES.get(gpu_type, [gpu_type.replace("_", " ").replace("-", " ")])
|
|
57
59
|
|
|
58
60
|
|
|
59
61
|
def normalize_vast_gpu(name: str, gpu_ram_mb: float | None = None) -> str:
|
|
@@ -84,6 +86,10 @@ class VastBackend(MarketplaceBackend):
|
|
|
84
86
|
}
|
|
85
87
|
if res.gpu_type is not None:
|
|
86
88
|
filt["gpu_name"] = {"in": vast_gpu_names(res.gpu_type)}
|
|
89
|
+
if res.gpu_type == "A100-80":
|
|
90
|
+
# cheapest-first + OFFER_LIMIT would otherwise fill the page
|
|
91
|
+
# with 40GB A100s that normalization then discards
|
|
92
|
+
filt["gpu_ram"] = {"gte": 70_000}
|
|
87
93
|
elif res.min_vram_gb is not None:
|
|
88
94
|
# vast reports gpu_ram in MB (verify live)
|
|
89
95
|
filt["gpu_ram"] = {"gte": res.min_vram_gb * 1024}
|
|
@@ -48,8 +48,10 @@ class BackendConfig(BaseModel, extra="allow"):
|
|
|
48
48
|
env_setup: list[str] = Field(default_factory=list) # module loads, exports
|
|
49
49
|
# Where a project's shared checkout + .venv live on the worker. Default
|
|
50
50
|
# "$OMNIRUN_ROOT/projects/<slug>"; point at an existing clone to reuse it
|
|
51
|
-
# (its .git becomes the object store, its .venv the shared env).
|
|
52
|
-
|
|
51
|
+
# (its .git becomes the object store, its .venv the shared env). A str
|
|
52
|
+
# applies to every repo; a dict maps repo slug -> path (with an optional
|
|
53
|
+
# "default" key as fallback) so one backend can serve several repos.
|
|
54
|
+
project_root: str | dict[str, str] | None = None
|
|
53
55
|
|
|
54
56
|
# static capability declaration (ssh backend; probe checks live via nvidia-smi)
|
|
55
57
|
gpus: list[GpuDecl] = Field(default_factory=list)
|
|
@@ -74,6 +76,15 @@ class BackendConfig(BaseModel, extra="allow"):
|
|
|
74
76
|
def extra(self, key: str, default: Any = None) -> Any:
|
|
75
77
|
return (self.model_extra or {}).get(key, default)
|
|
76
78
|
|
|
79
|
+
def project_root_for(self, slug: str) -> str | None:
|
|
80
|
+
"""Configured project root for a repo. A str applies to every repo; a
|
|
81
|
+
dict is keyed by slug, falling back to a "default" key, then to None
|
|
82
|
+
(the built-in "$OMNIRUN_ROOT/projects/<slug>" path)."""
|
|
83
|
+
pr = self.project_root
|
|
84
|
+
if isinstance(pr, dict):
|
|
85
|
+
return pr.get(slug) or pr.get("default")
|
|
86
|
+
return pr
|
|
87
|
+
|
|
77
88
|
|
|
78
89
|
class DaemonConfig(BaseModel):
|
|
79
90
|
host: str = "127.0.0.1" # localhost socket; bind 0.0.0.0 + auth to go remote
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""BackendConfig helpers: project_root_for resolution (str / dict / None)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from omnirun.config import BackendConfig
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def make_config(**kw) -> BackendConfig:
|
|
9
|
+
return BackendConfig.model_validate({"type": "slurm", **kw})
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_project_root_for_none_is_default():
|
|
13
|
+
assert make_config().project_root_for("proj") is None
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_project_root_for_str_applies_to_every_repo():
|
|
17
|
+
c = make_config(project_root="$HOME/shared")
|
|
18
|
+
assert c.project_root_for("proj") == "$HOME/shared"
|
|
19
|
+
assert c.project_root_for("other") == "$HOME/shared"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_project_root_for_dict_slug_hit():
|
|
23
|
+
c = make_config(project_root={"hns": "$HOME/projects/hns"})
|
|
24
|
+
assert c.project_root_for("hns") == "$HOME/projects/hns"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_project_root_for_dict_no_match_falls_through_to_none():
|
|
28
|
+
c = make_config(project_root={"hns": "$HOME/projects/hns"})
|
|
29
|
+
assert c.project_root_for("auraflow") is None
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_project_root_for_dict_default_fallback():
|
|
33
|
+
c = make_config(
|
|
34
|
+
project_root={"hns": "$HOME/projects/hns", "default": "$HOME/managed"}
|
|
35
|
+
)
|
|
36
|
+
assert c.project_root_for("hns") == "$HOME/projects/hns" # slug wins over default
|
|
37
|
+
assert c.project_root_for("auraflow") == "$HOME/managed" # fallback
|
|
@@ -474,7 +474,7 @@ def test_vast_probe_filter_and_parsing():
|
|
|
474
474
|
|
|
475
475
|
body = json.loads(route.calls[0].request.content)
|
|
476
476
|
assert body["type"] == "ondemand"
|
|
477
|
-
assert body["gpu_name"] == {"in": ["
|
|
477
|
+
assert body["gpu_name"] == {"in": ["H100 SXM", "H100 PCIE", "H100 NVL"]}
|
|
478
478
|
assert body["num_gpus"] == {"eq": 1}
|
|
479
479
|
assert body["rentable"] == {"eq": True}
|
|
480
480
|
assert body["verified"] == {"eq": True}
|
|
@@ -295,6 +295,22 @@ def test_render_payload_sbatch_then_bootstrap():
|
|
|
295
295
|
assert fake.files == {}
|
|
296
296
|
|
|
297
297
|
|
|
298
|
+
def test_render_payload_project_root_dict_matches_slug():
|
|
299
|
+
# spec slug is "proj": a per-repo dict resolves to that repo's checkout...
|
|
300
|
+
fake = FakeExec()
|
|
301
|
+
b = make_backend(fake, root=ROOT, project_root={"proj": "/data/existing/proj"})
|
|
302
|
+
payload = b.render_payload(make_spec(), offer=None)
|
|
303
|
+
assert 'PROJECT_ROOT="/data/existing/proj"' in payload
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
def test_render_payload_project_root_dict_no_match_uses_default():
|
|
307
|
+
# ...and an unrelated slug falls through to the built-in "$root/projects/<slug>".
|
|
308
|
+
fake = FakeExec()
|
|
309
|
+
b = make_backend(fake, root=ROOT, project_root={"other": "/data/existing/other"})
|
|
310
|
+
payload = b.render_payload(make_spec(), offer=None)
|
|
311
|
+
assert f'PROJECT_ROOT="{ROOT}/projects/proj"' in payload
|
|
312
|
+
|
|
313
|
+
|
|
298
314
|
# --- status mapping -------------------------------------------------------------------
|
|
299
315
|
|
|
300
316
|
|
|
@@ -515,6 +531,16 @@ def test_probe_warns_when_type_requested_but_no_map():
|
|
|
515
531
|
assert "gpu_map" in offer.notes
|
|
516
532
|
|
|
517
533
|
|
|
534
|
+
def test_probe_unfit_for_gpu_job_when_cpu_only():
|
|
535
|
+
fake = FakeExec()
|
|
536
|
+
(offer,) = make_backend(fake, has_gpus=False).probe(ResourceSpec(gpus=1))
|
|
537
|
+
assert not offer.fits
|
|
538
|
+
assert "CPU-only" in offer.unfit_reasons[0]
|
|
539
|
+
# CPU jobs still fit
|
|
540
|
+
(offer,) = make_backend(fake, has_gpus=False).probe(ResourceSpec())
|
|
541
|
+
assert offer.fits
|
|
542
|
+
|
|
543
|
+
|
|
518
544
|
def test_probe_wait_tier1_idle_nodes():
|
|
519
545
|
fake = FakeExec()
|
|
520
546
|
fake.add(r"sinfo -p gpu -t idle", stdout="node01 gpu:a100:4\nnode02 (null)\n")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|