mimiry 0.2.2__tar.gz → 0.3.0__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 (33) hide show
  1. {mimiry-0.2.2 → mimiry-0.3.0}/PKG-INFO +49 -2
  2. {mimiry-0.2.2 → mimiry-0.3.0}/README.md +48 -1
  3. {mimiry-0.2.2 → mimiry-0.3.0}/pyproject.toml +1 -1
  4. {mimiry-0.2.2 → mimiry-0.3.0}/src/Mimiry.egg-info/PKG-INFO +49 -2
  5. {mimiry-0.2.2 → mimiry-0.3.0}/src/Mimiry.egg-info/SOURCES.txt +6 -0
  6. {mimiry-0.2.2 → mimiry-0.3.0}/src/mimiry/__init__.py +1 -1
  7. mimiry-0.3.0/src/mimiry/_availability.py +96 -0
  8. mimiry-0.3.0/src/mimiry/_cli.py +526 -0
  9. {mimiry-0.2.2 → mimiry-0.3.0}/src/mimiry/_client.py +32 -0
  10. {mimiry-0.2.2 → mimiry-0.3.0}/src/mimiry/_serialization.py +8 -2
  11. {mimiry-0.2.2 → mimiry-0.3.0}/src/mimiry/_session.py +50 -0
  12. {mimiry-0.2.2 → mimiry-0.3.0}/src/mimiry/function.py +11 -2
  13. {mimiry-0.2.2 → mimiry-0.3.0}/src/mimiry/image.py +9 -1
  14. {mimiry-0.2.2 → mimiry-0.3.0}/src/mimiry/run.py +14 -2
  15. mimiry-0.3.0/tests/test_availability.py +114 -0
  16. mimiry-0.3.0/tests/test_bootstrap.py +54 -0
  17. mimiry-0.3.0/tests/test_cli.py +332 -0
  18. mimiry-0.3.0/tests/test_client_volumes.py +86 -0
  19. {mimiry-0.2.2 → mimiry-0.3.0}/tests/test_config.py +0 -1
  20. mimiry-0.3.0/tests/test_session.py +61 -0
  21. mimiry-0.2.2/src/mimiry/_cli.py +0 -101
  22. {mimiry-0.2.2 → mimiry-0.3.0}/setup.cfg +0 -0
  23. {mimiry-0.2.2 → mimiry-0.3.0}/src/Mimiry.egg-info/dependency_links.txt +0 -0
  24. {mimiry-0.2.2 → mimiry-0.3.0}/src/Mimiry.egg-info/entry_points.txt +0 -0
  25. {mimiry-0.2.2 → mimiry-0.3.0}/src/Mimiry.egg-info/requires.txt +0 -0
  26. {mimiry-0.2.2 → mimiry-0.3.0}/src/Mimiry.egg-info/top_level.txt +0 -0
  27. {mimiry-0.2.2 → mimiry-0.3.0}/src/mimiry/__main__.py +0 -0
  28. {mimiry-0.2.2 → mimiry-0.3.0}/src/mimiry/_auth.py +0 -0
  29. {mimiry-0.2.2 → mimiry-0.3.0}/src/mimiry/_config.py +0 -0
  30. {mimiry-0.2.2 → mimiry-0.3.0}/src/mimiry/_setup.py +0 -0
  31. {mimiry-0.2.2 → mimiry-0.3.0}/src/mimiry/_ssh.py +0 -0
  32. {mimiry-0.2.2 → mimiry-0.3.0}/src/mimiry/exceptions.py +0 -0
  33. {mimiry-0.2.2 → mimiry-0.3.0}/tests/test_setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Mimiry
3
- Version: 0.2.2
3
+ Version: 0.3.0
4
4
  Summary: Python SDK for serverless compute
5
5
  Author-email: Oliver <oliversorensen39@gmail.com>
6
6
  License: Proprietary
@@ -66,7 +66,54 @@ Always check what's currently available before selecting hardware:
66
66
  mimiry availability
67
67
  ```
68
68
 
69
- To filter to a single GPU family, add `--gpu-family <FAMILY>`.
69
+ Filter with `--gpu-family T4`, `--provider gcp`, `--location europe-west4-a`,
70
+ `--min-vram 16`, and/or `--available-only`.
71
+
72
+ ## Managing sessions
73
+
74
+ Run and manage GPU sessions entirely from the CLI — no Python required:
75
+
76
+ ```bash
77
+ # Launch a job (omit --command for an interactive box; --wait blocks until it starts)
78
+ mimiry session create --image nvcr.io/nvidia/cuda:12.6.2-runtime-ubuntu24.04 \
79
+ --gpu T4 --provider gcp --command "nvidia-smi" --wait
80
+
81
+ mimiry sessions # list recent sessions, newest first
82
+ mimiry sessions --active # only running / provisioning (i.e. still billing)
83
+ mimiry session status <id> # full detail (--events N for history, --wait to block until done)
84
+ mimiry session logs <id> # container logs (--tail N, --timestamps, --follow to stream)
85
+ mimiry session ssh <id> # interactive shell into a running session
86
+ mimiry session terminate <id>
87
+ ```
88
+
89
+ `mimiry session list` is the long form of `mimiry sessions`; add `--json` for
90
+ machine-readable output. `session create` also accepts `--env KEY=VAL`,
91
+ `--volume NAME:MOUNT`, `--gpu-count`, and
92
+ `--auto-terminate {never,on_complete,on_success}`.
93
+
94
+ ## Volumes
95
+
96
+ Persistent block storage that survives session termination:
97
+
98
+ ```bash
99
+ mimiry volume create --name data --size-gb 100
100
+ mimiry volume list # hides deleted; --all to include them
101
+ mimiry volume status <id>
102
+ mimiry volume extend <id> --size-gb 200 # grow only (cannot shrink)
103
+ mimiry volume delete <id>
104
+ ```
105
+
106
+ Attach one at launch: `mimiry session create … --volume data:/mnt/data`.
107
+
108
+ ## Account
109
+
110
+ ```bash
111
+ mimiry balance # remaining credit
112
+ mimiry quota # usage limits
113
+ mimiry transactions # credit/debit history
114
+ mimiry whoami # verify auth end-to-end
115
+ mimiry config # show resolved key path + API base (no network)
116
+ ```
70
117
 
71
118
  ## Python version
72
119
 
@@ -45,7 +45,54 @@ Always check what's currently available before selecting hardware:
45
45
  mimiry availability
46
46
  ```
47
47
 
48
- To filter to a single GPU family, add `--gpu-family <FAMILY>`.
48
+ Filter with `--gpu-family T4`, `--provider gcp`, `--location europe-west4-a`,
49
+ `--min-vram 16`, and/or `--available-only`.
50
+
51
+ ## Managing sessions
52
+
53
+ Run and manage GPU sessions entirely from the CLI — no Python required:
54
+
55
+ ```bash
56
+ # Launch a job (omit --command for an interactive box; --wait blocks until it starts)
57
+ mimiry session create --image nvcr.io/nvidia/cuda:12.6.2-runtime-ubuntu24.04 \
58
+ --gpu T4 --provider gcp --command "nvidia-smi" --wait
59
+
60
+ mimiry sessions # list recent sessions, newest first
61
+ mimiry sessions --active # only running / provisioning (i.e. still billing)
62
+ mimiry session status <id> # full detail (--events N for history, --wait to block until done)
63
+ mimiry session logs <id> # container logs (--tail N, --timestamps, --follow to stream)
64
+ mimiry session ssh <id> # interactive shell into a running session
65
+ mimiry session terminate <id>
66
+ ```
67
+
68
+ `mimiry session list` is the long form of `mimiry sessions`; add `--json` for
69
+ machine-readable output. `session create` also accepts `--env KEY=VAL`,
70
+ `--volume NAME:MOUNT`, `--gpu-count`, and
71
+ `--auto-terminate {never,on_complete,on_success}`.
72
+
73
+ ## Volumes
74
+
75
+ Persistent block storage that survives session termination:
76
+
77
+ ```bash
78
+ mimiry volume create --name data --size-gb 100
79
+ mimiry volume list # hides deleted; --all to include them
80
+ mimiry volume status <id>
81
+ mimiry volume extend <id> --size-gb 200 # grow only (cannot shrink)
82
+ mimiry volume delete <id>
83
+ ```
84
+
85
+ Attach one at launch: `mimiry session create … --volume data:/mnt/data`.
86
+
87
+ ## Account
88
+
89
+ ```bash
90
+ mimiry balance # remaining credit
91
+ mimiry quota # usage limits
92
+ mimiry transactions # credit/debit history
93
+ mimiry whoami # verify auth end-to-end
94
+ mimiry config # show resolved key path + API base (no network)
95
+ ```
49
96
 
50
97
  ## Python version
51
98
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "Mimiry"
7
- version = "0.2.2"
7
+ version = "0.3.0"
8
8
  description = "Python SDK for serverless compute"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Mimiry
3
- Version: 0.2.2
3
+ Version: 0.3.0
4
4
  Summary: Python SDK for serverless compute
5
5
  Author-email: Oliver <oliversorensen39@gmail.com>
6
6
  License: Proprietary
@@ -66,7 +66,54 @@ Always check what's currently available before selecting hardware:
66
66
  mimiry availability
67
67
  ```
68
68
 
69
- To filter to a single GPU family, add `--gpu-family <FAMILY>`.
69
+ Filter with `--gpu-family T4`, `--provider gcp`, `--location europe-west4-a`,
70
+ `--min-vram 16`, and/or `--available-only`.
71
+
72
+ ## Managing sessions
73
+
74
+ Run and manage GPU sessions entirely from the CLI — no Python required:
75
+
76
+ ```bash
77
+ # Launch a job (omit --command for an interactive box; --wait blocks until it starts)
78
+ mimiry session create --image nvcr.io/nvidia/cuda:12.6.2-runtime-ubuntu24.04 \
79
+ --gpu T4 --provider gcp --command "nvidia-smi" --wait
80
+
81
+ mimiry sessions # list recent sessions, newest first
82
+ mimiry sessions --active # only running / provisioning (i.e. still billing)
83
+ mimiry session status <id> # full detail (--events N for history, --wait to block until done)
84
+ mimiry session logs <id> # container logs (--tail N, --timestamps, --follow to stream)
85
+ mimiry session ssh <id> # interactive shell into a running session
86
+ mimiry session terminate <id>
87
+ ```
88
+
89
+ `mimiry session list` is the long form of `mimiry sessions`; add `--json` for
90
+ machine-readable output. `session create` also accepts `--env KEY=VAL`,
91
+ `--volume NAME:MOUNT`, `--gpu-count`, and
92
+ `--auto-terminate {never,on_complete,on_success}`.
93
+
94
+ ## Volumes
95
+
96
+ Persistent block storage that survives session termination:
97
+
98
+ ```bash
99
+ mimiry volume create --name data --size-gb 100
100
+ mimiry volume list # hides deleted; --all to include them
101
+ mimiry volume status <id>
102
+ mimiry volume extend <id> --size-gb 200 # grow only (cannot shrink)
103
+ mimiry volume delete <id>
104
+ ```
105
+
106
+ Attach one at launch: `mimiry session create … --volume data:/mnt/data`.
107
+
108
+ ## Account
109
+
110
+ ```bash
111
+ mimiry balance # remaining credit
112
+ mimiry quota # usage limits
113
+ mimiry transactions # credit/debit history
114
+ mimiry whoami # verify auth end-to-end
115
+ mimiry config # show resolved key path + API base (no network)
116
+ ```
70
117
 
71
118
  ## Python version
72
119
 
@@ -9,6 +9,7 @@ src/Mimiry.egg-info/top_level.txt
9
9
  src/mimiry/__init__.py
10
10
  src/mimiry/__main__.py
11
11
  src/mimiry/_auth.py
12
+ src/mimiry/_availability.py
12
13
  src/mimiry/_cli.py
13
14
  src/mimiry/_client.py
14
15
  src/mimiry/_config.py
@@ -20,5 +21,10 @@ src/mimiry/exceptions.py
20
21
  src/mimiry/function.py
21
22
  src/mimiry/image.py
22
23
  src/mimiry/run.py
24
+ tests/test_availability.py
25
+ tests/test_bootstrap.py
26
+ tests/test_cli.py
27
+ tests/test_client_volumes.py
23
28
  tests/test_config.py
29
+ tests/test_session.py
24
30
  tests/test_setup.py
@@ -16,7 +16,7 @@ from mimiry.function import function, Function
16
16
  from mimiry.image import Image
17
17
  from mimiry.run import run
18
18
 
19
- __version__ = "0.2.0"
19
+ __version__ = "0.3.0"
20
20
 
21
21
  __all__ = [
22
22
  "__version__",
@@ -0,0 +1,96 @@
1
+ """Pre-create validation of the requested GPU/provider/location.
2
+
3
+ The scheduler rejects an impossible ``gpu``/``provider`` pairing only *after*
4
+ a session is created — e.g. asking for a ``T4`` from ``verda`` (which doesn't
5
+ carry it) fails the session with ``unsupported GPU type "T4"`` after a
6
+ provisioning round-trip. This module catches that locally, before the POST,
7
+ and turns it into an actionable error that names the providers which *do*
8
+ offer the GPU.
9
+
10
+ Design: the check is **best-effort**. A definitive mismatch (the GPU isn't
11
+ offered, or not by the requested provider/location) raises ``SessionError``.
12
+ But any failure to *consult* availability — network error, malformed payload,
13
+ empty list — is swallowed: a flaky availability endpoint must never block an
14
+ otherwise-valid job. The API stays the source of truth; this is just a fast,
15
+ friendly pre-flight.
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ from typing import Any
21
+
22
+ from mimiry.exceptions import SessionError
23
+
24
+
25
+ def check_gpu_offered(
26
+ models: list[dict],
27
+ gpu: str,
28
+ provider: str | None,
29
+ location: str | None,
30
+ ) -> None:
31
+ """Raise ``SessionError`` if ``gpu`` (optionally pinned to ``provider`` /
32
+ ``location``) isn't offered according to the availability ``models`` list.
33
+
34
+ ``gpu`` matches either a model ``name`` (e.g. ``"H100_SXM"``) or ``family``
35
+ (e.g. ``"H100"``). Returns ``None`` when the request is satisfiable.
36
+ """
37
+ matches = [m for m in models if m.get("name") == gpu or m.get("family") == gpu]
38
+ if not matches:
39
+ offered = sorted({m.get("name") for m in models if m.get("name")})
40
+ raise SessionError(
41
+ f"GPU type {gpu!r} is not offered. Available types: "
42
+ f"{', '.join(offered) or 'none'}."
43
+ )
44
+
45
+ available = [m for m in matches if m.get("available")]
46
+ if not available:
47
+ raise SessionError(f"GPU type {gpu!r} is currently unavailable on all providers.")
48
+
49
+ if provider is None:
50
+ return # available somewhere; let the scheduler pick a provider
51
+
52
+ # Collapse the available matches into provider → set(locations).
53
+ prov_locs: dict[str, set[str]] = {}
54
+ for m in available:
55
+ for p in m.get("providers", []):
56
+ name = p.get("provider")
57
+ if name:
58
+ prov_locs.setdefault(name, set()).update(p.get("locations") or [])
59
+
60
+ if provider not in prov_locs:
61
+ offerers = ", ".join(sorted(prov_locs)) or "none"
62
+ raise SessionError(
63
+ f"GPU {gpu!r} is not offered by provider {provider!r}. "
64
+ f"Available providers for {gpu}: {offerers}. "
65
+ f"Pass provider=<one of those>, or omit the provider hint to let "
66
+ f"Mimiry choose."
67
+ )
68
+
69
+ if location is not None and location not in prov_locs[provider]:
70
+ locs = ", ".join(sorted(prov_locs[provider])) or "none"
71
+ raise SessionError(
72
+ f"Provider {provider!r} offers {gpu} but not in location {location!r}. "
73
+ f"Available locations: {locs}."
74
+ )
75
+
76
+
77
+ def preflight_gpu_availability(
78
+ client: Any,
79
+ gpu: str,
80
+ provider: str | None,
81
+ location: str | None = None,
82
+ ) -> None:
83
+ """Best-effort pre-create check. Raises ``SessionError`` on a definitive
84
+ mismatch; silently returns if availability can't be consulted.
85
+
86
+ ``client`` only needs a ``get_availability()`` method (see
87
+ :class:`mimiry._client.MimiryClient`).
88
+ """
89
+ try:
90
+ data = client.get_availability()
91
+ except Exception:
92
+ return # never block submission on an availability-endpoint hiccup
93
+ models = data.get("gpu_models") if isinstance(data, dict) else None
94
+ if not models:
95
+ return # nothing to validate against — defer to the API
96
+ check_gpu_offered(models, gpu, provider, location)