opencomputer-sdk 0.5.4__tar.gz → 0.6.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.
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/.gitignore +12 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/PKG-INFO +1 -1
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/opencomputer/__init__.py +5 -1
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/opencomputer/usage.py +58 -14
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/pyproject.toml +1 -1
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/README.md +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/run_all_tests.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/stream_demo.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/test_commands.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/test_concurrent.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/test_declarative_images.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/test_default_template.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/test_disk_size.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/test_domain_tls.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/test_environment.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/test_exec.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/test_file_ops.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/test_large_files.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/test_multi_template.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/test_python_sdk.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/test_reconnect.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/test_secret_store_fork.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/test_secretstore.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/test_shell.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/examples/test_timeout.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/opencomputer/agent.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/opencomputer/commands.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/opencomputer/exec.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/opencomputer/filesystem.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/opencomputer/image.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/opencomputer/project.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/opencomputer/pty.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/opencomputer/sandbox.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/opencomputer/shell.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/opencomputer/snapshot.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/opencomputer/sse.py +0 -0
- {opencomputer_sdk-0.5.4 → opencomputer_sdk-0.6.0}/opencomputer/template.py +0 -0
|
@@ -19,6 +19,9 @@ Thumbs.db
|
|
|
19
19
|
.env.*
|
|
20
20
|
!.env.example
|
|
21
21
|
|
|
22
|
+
# Per-developer dev-box lifecycle state (written by deploy/*/deploy-qemu-dev.sh)
|
|
23
|
+
deploy/**/.qemu-dev-state-*
|
|
24
|
+
|
|
22
25
|
# Python
|
|
23
26
|
__pycache__/
|
|
24
27
|
*.pyc
|
|
@@ -29,8 +32,14 @@ __pycache__/
|
|
|
29
32
|
# Node
|
|
30
33
|
node_modules/
|
|
31
34
|
|
|
35
|
+
# api-edge Workers Assets — copied from web/dist at deploy time. Source of truth lives in web/.
|
|
36
|
+
cloudflare-workers/api-edge/assets/
|
|
37
|
+
|
|
32
38
|
# Build artifacts
|
|
33
39
|
dist/
|
|
40
|
+
# Built dashboard SPA bundle served by the api-edge Worker — produced by
|
|
41
|
+
# `vite build` in web/, copied here by the deploy script. Never check in.
|
|
42
|
+
cloudflare-workers/api-edge/assets/
|
|
34
43
|
|
|
35
44
|
# Compiled binaries
|
|
36
45
|
bin/
|
|
@@ -65,4 +74,7 @@ delme
|
|
|
65
74
|
deploy/azure/.dev-env-state-*
|
|
66
75
|
deploy/azure/.dev-env-secrets*
|
|
67
76
|
!deploy/azure/.dev-env-secrets.example
|
|
77
|
+
deploy/azure/.dev-vector-token-*
|
|
68
78
|
/server
|
|
79
|
+
/seed-dev-secrets
|
|
80
|
+
/backfill
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opencomputer-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: Python SDK for OpenComputer - cloud sandbox platform
|
|
5
5
|
Project-URL: Homepage, https://github.com/diggerhq/opensandbox
|
|
6
6
|
Project-URL: Repository, https://github.com/diggerhq/opensandbox
|
|
@@ -20,6 +20,8 @@ from opencomputer.usage import (
|
|
|
20
20
|
UsageBySandboxResponse,
|
|
21
21
|
UsageByTagResponse,
|
|
22
22
|
SandboxUsageResponse,
|
|
23
|
+
SandboxUsagePoint,
|
|
24
|
+
SandboxUsageTotals,
|
|
23
25
|
TagKeyInfo,
|
|
24
26
|
)
|
|
25
27
|
|
|
@@ -54,7 +56,9 @@ __all__ = [
|
|
|
54
56
|
"UsageBySandboxResponse",
|
|
55
57
|
"UsageByTagResponse",
|
|
56
58
|
"SandboxUsageResponse",
|
|
59
|
+
"SandboxUsagePoint",
|
|
60
|
+
"SandboxUsageTotals",
|
|
57
61
|
"TagKeyInfo",
|
|
58
62
|
]
|
|
59
63
|
|
|
60
|
-
__version__ = "0.
|
|
64
|
+
__version__ = "0.6.0"
|
|
@@ -66,19 +66,50 @@ class UsageByTagResponse:
|
|
|
66
66
|
next_cursor: str | None
|
|
67
67
|
|
|
68
68
|
|
|
69
|
+
@dataclass
|
|
70
|
+
class SandboxUsagePoint:
|
|
71
|
+
"""One 1-minute bucket of memory usage. Integrals (``*_gb_seconds``,
|
|
72
|
+
``uptime_seconds``) compose by summation; snapshot scalars
|
|
73
|
+
(``allocated_memory_mb``, ``used_memory_mb_*``) are for charts.
|
|
74
|
+
|
|
75
|
+
v1 is memory only. CPU fields will appear once the server-side
|
|
76
|
+
collector starts populating cgroup cpu.stat.
|
|
77
|
+
"""
|
|
78
|
+
|
|
79
|
+
ts: str
|
|
80
|
+
memory_allocated_gb_seconds: float
|
|
81
|
+
memory_used_gb_seconds: float
|
|
82
|
+
uptime_seconds: int
|
|
83
|
+
allocated_memory_mb: int
|
|
84
|
+
used_memory_mb_avg: int
|
|
85
|
+
used_memory_mb_peak: int
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
@dataclass
|
|
89
|
+
class SandboxUsageTotals:
|
|
90
|
+
"""Envelope totals over ``[from_, to)``. Invariant: summing the
|
|
91
|
+
matching field across ``points`` reproduces the value here."""
|
|
92
|
+
|
|
93
|
+
memory_allocated_gb_seconds: float
|
|
94
|
+
memory_used_gb_seconds: float
|
|
95
|
+
uptime_seconds: int
|
|
96
|
+
memory_allocated_peak_mb: int
|
|
97
|
+
memory_used_peak_mb: int
|
|
98
|
+
|
|
99
|
+
|
|
69
100
|
@dataclass
|
|
70
101
|
class SandboxUsageResponse:
|
|
102
|
+
"""Response for ``GET /sandboxes/:id/usage``. Default window is
|
|
103
|
+
last 1 hour; max 30 days (server returns 400 beyond that).
|
|
104
|
+
``from_`` and ``to`` accept ISO dates (``YYYY-MM-DD``) or RFC3339
|
|
105
|
+
timestamps."""
|
|
106
|
+
|
|
71
107
|
sandbox_id: str
|
|
72
108
|
from_: str
|
|
73
109
|
to: str
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
tags: dict[str, str]
|
|
77
|
-
tags_last_updated_at: str | None
|
|
78
|
-
first_started_at: str | None
|
|
79
|
-
last_ended_at: str | None
|
|
110
|
+
totals: SandboxUsageTotals
|
|
111
|
+
points: list[SandboxUsagePoint]
|
|
80
112
|
alias: str | None = None
|
|
81
|
-
status: str | None = None
|
|
82
113
|
|
|
83
114
|
|
|
84
115
|
@dataclass
|
|
@@ -235,18 +266,31 @@ class Usage:
|
|
|
235
266
|
resp = await self._client.get(f"/sandboxes/{sandbox_id}/usage", params=params)
|
|
236
267
|
resp.raise_for_status()
|
|
237
268
|
b = resp.json()
|
|
269
|
+
t = b.get("totals") or {}
|
|
238
270
|
return SandboxUsageResponse(
|
|
239
271
|
sandbox_id=b["sandboxId"],
|
|
240
272
|
from_=b["from"],
|
|
241
273
|
to=b["to"],
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
274
|
+
totals=SandboxUsageTotals(
|
|
275
|
+
memory_allocated_gb_seconds=t.get("memoryAllocatedGbSeconds", 0.0),
|
|
276
|
+
memory_used_gb_seconds=t.get("memoryUsedGbSeconds", 0.0),
|
|
277
|
+
uptime_seconds=t.get("uptimeSeconds", 0),
|
|
278
|
+
memory_allocated_peak_mb=t.get("memoryAllocatedPeakMb", 0),
|
|
279
|
+
memory_used_peak_mb=t.get("memoryUsedPeakMb", 0),
|
|
280
|
+
),
|
|
281
|
+
points=[
|
|
282
|
+
SandboxUsagePoint(
|
|
283
|
+
ts=p["ts"],
|
|
284
|
+
memory_allocated_gb_seconds=p["memoryAllocatedGbSeconds"],
|
|
285
|
+
memory_used_gb_seconds=p["memoryUsedGbSeconds"],
|
|
286
|
+
uptime_seconds=p["uptimeSeconds"],
|
|
287
|
+
allocated_memory_mb=p["allocatedMemoryMb"],
|
|
288
|
+
used_memory_mb_avg=p["usedMemoryMbAvg"],
|
|
289
|
+
used_memory_mb_peak=p["usedMemoryMbPeak"],
|
|
290
|
+
)
|
|
291
|
+
for p in b.get("points") or []
|
|
292
|
+
],
|
|
248
293
|
alias=b.get("alias"),
|
|
249
|
-
status=b.get("status"),
|
|
250
294
|
)
|
|
251
295
|
|
|
252
296
|
|
|
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
|