tetra-rp 0.20.0__tar.gz → 0.20.1__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.
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/PKG-INFO +2 -2
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/pyproject.toml +38 -5
- tetra_rp-0.20.1/src/tetra_rp/core/resources/template.py +36 -0
- tetra_rp-0.20.1/src/tetra_rp/core/utils/json.py +46 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp.egg-info/PKG-INFO +2 -2
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp.egg-info/SOURCES.txt +0 -1
- tetra_rp-0.20.0/src/tetra_rp/core/resources/template.py +0 -107
- tetra_rp-0.20.0/src/tetra_rp/core/resources/utils.py +0 -50
- tetra_rp-0.20.0/src/tetra_rp/core/utils/json.py +0 -33
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/README.md +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/setup.cfg +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/__init__.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/__init__.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/commands/__init__.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/commands/apps.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/commands/build.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/commands/build_utils/__init__.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/commands/build_utils/handler_generator.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/commands/build_utils/lb_handler_generator.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/commands/build_utils/manifest.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/commands/build_utils/scanner.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/commands/deploy.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/commands/init.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/commands/resource.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/commands/run.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/commands/test_mothership.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/commands/undeploy.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/main.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/__init__.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/app.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/conda.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/deployment.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/ignore.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton_template/.env.example +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton_template/.flashignore +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton_template/.gitignore +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton_template/README.md +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton_template/main.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton_template/requirements.txt +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton_template/workers/__init__.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton_template/workers/cpu/__init__.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton_template/workers/cpu/endpoint.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton_template/workers/gpu/__init__.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton_template/workers/gpu/endpoint.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/client.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/config.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/__init__.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/api/__init__.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/api/runpod.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/deployment.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/discovery.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/exceptions.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/resources/__init__.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/resources/app.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/resources/base.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/resources/cloud.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/resources/constants.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/resources/cpu.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/resources/environment.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/resources/gpu.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/resources/live_serverless.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/resources/load_balancer_sls_resource.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/resources/network_volume.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/resources/resource_manager.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/resources/serverless.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/resources/serverless_cpu.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/utils/__init__.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/utils/backoff.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/utils/constants.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/utils/file_lock.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/utils/http.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/utils/lru_cache.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/utils/singleton.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/validation.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/execute_class.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/logger.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/protos/__init__.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/protos/remote_execution.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/runtime/__init__.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/runtime/config.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/runtime/exceptions.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/runtime/generic_handler.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/runtime/lb_handler.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/runtime/manifest_client.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/runtime/manifest_fetcher.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/runtime/models.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/runtime/mothership_provisioner.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/runtime/production_wrapper.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/runtime/serialization.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/runtime/service_registry.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/runtime/state_manager_client.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/stubs/__init__.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/stubs/live_serverless.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/stubs/load_balancer_sls.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/stubs/registry.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/stubs/serverless.py +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp.egg-info/dependency_links.txt +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp.egg-info/entry_points.txt +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp.egg-info/requires.txt +0 -0
- {tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tetra_rp
|
|
3
|
-
Version: 0.20.
|
|
3
|
+
Version: 0.20.1
|
|
4
4
|
Summary: A Python library for distributed inference and serving of machine learning models
|
|
5
5
|
Author-email: Marut Pandya <pandyamarut@gmail.com>, Patrick Rachford <prachford@icloud.com>, Dean Quinanola <dean.quinanola@runpod.io>
|
|
6
6
|
License: MIT
|
|
@@ -8,7 +8,7 @@ Classifier: Development Status :: 3 - Alpha
|
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
|
-
Requires-Python: <3.
|
|
11
|
+
Requires-Python: <3.15,>=3.10
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
Requires-Dist: cloudpickle>=3.1.1
|
|
14
14
|
Requires-Dist: runpod
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "tetra_rp"
|
|
3
|
-
version = "0.20.
|
|
3
|
+
version = "0.20.1"
|
|
4
4
|
description = "A Python library for distributed inference and serving of machine learning models"
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Marut Pandya", email = "pandyamarut@gmail.com" },
|
|
@@ -15,7 +15,7 @@ classifiers = [
|
|
|
15
15
|
"License :: OSI Approved :: MIT License",
|
|
16
16
|
"Operating System :: OS Independent",
|
|
17
17
|
]
|
|
18
|
-
requires-python = ">=3.
|
|
18
|
+
requires-python = ">=3.10,<3.15"
|
|
19
19
|
|
|
20
20
|
dependencies = [
|
|
21
21
|
"cloudpickle>=3.1.1",
|
|
@@ -39,6 +39,7 @@ test = [
|
|
|
39
39
|
"pytest-mock>=3.14.0",
|
|
40
40
|
"pytest-asyncio>=1.0.0",
|
|
41
41
|
"pytest-cov>=6.2.1",
|
|
42
|
+
"pytest-xdist>=3.6.1",
|
|
42
43
|
"twine>=6.1.0",
|
|
43
44
|
]
|
|
44
45
|
|
|
@@ -68,14 +69,15 @@ addopts = [
|
|
|
68
69
|
"--tb=short",
|
|
69
70
|
"--cov=tetra_rp",
|
|
70
71
|
"--cov-report=term-missing",
|
|
71
|
-
"--cov-fail-under=
|
|
72
|
+
"--cov-fail-under=65"
|
|
72
73
|
]
|
|
73
74
|
asyncio_mode = "auto"
|
|
74
75
|
asyncio_default_fixture_loop_scope = "function"
|
|
75
76
|
markers = [
|
|
76
77
|
"unit: Unit tests",
|
|
77
78
|
"integration: Integration tests",
|
|
78
|
-
"slow: Slow tests"
|
|
79
|
+
"slow: Slow tests",
|
|
80
|
+
"serial: Tests that must run serially (not parallelized)"
|
|
79
81
|
]
|
|
80
82
|
filterwarnings = [
|
|
81
83
|
"ignore::DeprecationWarning",
|
|
@@ -92,7 +94,7 @@ exclude = [
|
|
|
92
94
|
|
|
93
95
|
[tool.mypy]
|
|
94
96
|
# Basic configuration
|
|
95
|
-
python_version = "3.
|
|
97
|
+
python_version = "3.10"
|
|
96
98
|
warn_return_any = true
|
|
97
99
|
warn_unused_configs = true
|
|
98
100
|
disallow_untyped_defs = false # Start lenient, can be stricter later
|
|
@@ -122,5 +124,36 @@ module = [
|
|
|
122
124
|
]
|
|
123
125
|
ignore_missing_imports = true
|
|
124
126
|
|
|
127
|
+
[tool.coverage.run]
|
|
128
|
+
parallel = true
|
|
129
|
+
branch = false
|
|
130
|
+
source = ["tetra_rp"]
|
|
131
|
+
omit = [
|
|
132
|
+
"*/tests/*",
|
|
133
|
+
"*/test_*.py",
|
|
134
|
+
"*/__pycache__/*",
|
|
135
|
+
"*/site-packages/*",
|
|
136
|
+
]
|
|
137
|
+
|
|
138
|
+
[tool.coverage.report]
|
|
139
|
+
precision = 2
|
|
140
|
+
show_missing = true
|
|
141
|
+
skip_covered = false
|
|
142
|
+
exclude_lines = [
|
|
143
|
+
"pragma: no cover",
|
|
144
|
+
"def __repr__",
|
|
145
|
+
"raise AssertionError",
|
|
146
|
+
"raise NotImplementedError",
|
|
147
|
+
"if __name__ == .__main__.:",
|
|
148
|
+
"if TYPE_CHECKING:",
|
|
149
|
+
"@abstractmethod",
|
|
150
|
+
]
|
|
151
|
+
|
|
152
|
+
[tool.coverage.paths]
|
|
153
|
+
source = [
|
|
154
|
+
"src/tetra_rp",
|
|
155
|
+
"*/site-packages/tetra_rp",
|
|
156
|
+
]
|
|
157
|
+
|
|
125
158
|
[tool.uv.sources]
|
|
126
159
|
runpod = { git = "https://github.com/runpod/runpod-python", rev = "main" }
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from typing import Dict, List, Optional, Any
|
|
2
|
+
from pydantic import BaseModel, model_validator
|
|
3
|
+
from .base import BaseResource
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class KeyValuePair(BaseModel):
|
|
7
|
+
key: str
|
|
8
|
+
value: str
|
|
9
|
+
|
|
10
|
+
@classmethod
|
|
11
|
+
def from_dict(cls, data: Dict[str, str]) -> "List[KeyValuePair]":
|
|
12
|
+
"""
|
|
13
|
+
Create a list of KeyValuePair instances from a dictionary.
|
|
14
|
+
"""
|
|
15
|
+
if not isinstance(data, dict):
|
|
16
|
+
raise ValueError("Input must be a dictionary.")
|
|
17
|
+
|
|
18
|
+
return [cls(key=key, value=value) for key, value in data.items()]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class PodTemplate(BaseResource):
|
|
22
|
+
advancedStart: Optional[bool] = False
|
|
23
|
+
config: Optional[Dict[str, Any]] = {}
|
|
24
|
+
containerDiskInGb: Optional[int] = 64
|
|
25
|
+
containerRegistryAuthId: Optional[str] = ""
|
|
26
|
+
dockerArgs: Optional[str] = ""
|
|
27
|
+
env: Optional[List[KeyValuePair]] = []
|
|
28
|
+
imageName: Optional[str] = ""
|
|
29
|
+
name: Optional[str] = ""
|
|
30
|
+
ports: Optional[str] = ""
|
|
31
|
+
startScript: Optional[str] = ""
|
|
32
|
+
|
|
33
|
+
@model_validator(mode="after")
|
|
34
|
+
def sync_input_fields(self):
|
|
35
|
+
self.name = f"{self.name}__{self.resource_id}"
|
|
36
|
+
return self
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""Utilities for normalizing data structures for JSON serialization."""
|
|
2
|
+
|
|
3
|
+
from enum import Enum
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def normalize_for_json(obj: Any) -> Any:
|
|
10
|
+
"""Normalize an object for JSON serialization.
|
|
11
|
+
|
|
12
|
+
Converts Pydantic models to dicts and Enum values to their values,
|
|
13
|
+
while recursively processing collections.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
obj: The object to normalize.
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
A JSON-serializable version of the object.
|
|
20
|
+
"""
|
|
21
|
+
# Handle primitives
|
|
22
|
+
if obj is None or isinstance(obj, (bool, int, float, str)):
|
|
23
|
+
return obj
|
|
24
|
+
|
|
25
|
+
# Handle Enum
|
|
26
|
+
if isinstance(obj, Enum):
|
|
27
|
+
return obj.value
|
|
28
|
+
|
|
29
|
+
# Handle Pydantic BaseModel
|
|
30
|
+
if isinstance(obj, BaseModel):
|
|
31
|
+
return normalize_for_json(obj.model_dump())
|
|
32
|
+
|
|
33
|
+
# Handle dict
|
|
34
|
+
if isinstance(obj, dict):
|
|
35
|
+
return {key: normalize_for_json(value) for key, value in obj.items()}
|
|
36
|
+
|
|
37
|
+
# Handle tuple
|
|
38
|
+
if isinstance(obj, tuple):
|
|
39
|
+
return tuple(normalize_for_json(item) for item in obj)
|
|
40
|
+
|
|
41
|
+
# Handle list
|
|
42
|
+
if isinstance(obj, list):
|
|
43
|
+
return [normalize_for_json(item) for item in obj]
|
|
44
|
+
|
|
45
|
+
# For any other type, return as-is
|
|
46
|
+
return obj
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tetra_rp
|
|
3
|
-
Version: 0.20.
|
|
3
|
+
Version: 0.20.1
|
|
4
4
|
Summary: A Python library for distributed inference and serving of machine learning models
|
|
5
5
|
Author-email: Marut Pandya <pandyamarut@gmail.com>, Patrick Rachford <prachford@icloud.com>, Dean Quinanola <dean.quinanola@runpod.io>
|
|
6
6
|
License: MIT
|
|
@@ -8,7 +8,7 @@ Classifier: Development Status :: 3 - Alpha
|
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
|
-
Requires-Python: <3.
|
|
11
|
+
Requires-Python: <3.15,>=3.10
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
Requires-Dist: cloudpickle>=3.1.1
|
|
14
14
|
Requires-Dist: runpod
|
|
@@ -66,7 +66,6 @@ src/tetra_rp/core/resources/resource_manager.py
|
|
|
66
66
|
src/tetra_rp/core/resources/serverless.py
|
|
67
67
|
src/tetra_rp/core/resources/serverless_cpu.py
|
|
68
68
|
src/tetra_rp/core/resources/template.py
|
|
69
|
-
src/tetra_rp/core/resources/utils.py
|
|
70
69
|
src/tetra_rp/core/utils/__init__.py
|
|
71
70
|
src/tetra_rp/core/utils/backoff.py
|
|
72
71
|
src/tetra_rp/core/utils/constants.py
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import warnings
|
|
2
|
-
from typing import Dict, List, Optional, Any
|
|
3
|
-
from pydantic import BaseModel, model_validator
|
|
4
|
-
from tetra_rp.core.utils.http import get_authenticated_requests_session
|
|
5
|
-
from .base import BaseResource
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class KeyValuePair(BaseModel):
|
|
9
|
-
key: str
|
|
10
|
-
value: str
|
|
11
|
-
|
|
12
|
-
@classmethod
|
|
13
|
-
def from_dict(cls, data: Dict[str, str]) -> "List[KeyValuePair]":
|
|
14
|
-
"""
|
|
15
|
-
Create a list of KeyValuePair instances from a dictionary.
|
|
16
|
-
"""
|
|
17
|
-
if not isinstance(data, dict):
|
|
18
|
-
raise ValueError("Input must be a dictionary.")
|
|
19
|
-
|
|
20
|
-
return [cls(key=key, value=value) for key, value in data.items()]
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class PodTemplate(BaseResource):
|
|
24
|
-
advancedStart: Optional[bool] = False
|
|
25
|
-
config: Optional[Dict[str, Any]] = {}
|
|
26
|
-
containerDiskInGb: Optional[int] = 64
|
|
27
|
-
containerRegistryAuthId: Optional[str] = ""
|
|
28
|
-
dockerArgs: Optional[str] = ""
|
|
29
|
-
env: Optional[List[KeyValuePair]] = []
|
|
30
|
-
imageName: Optional[str] = ""
|
|
31
|
-
name: Optional[str] = ""
|
|
32
|
-
ports: Optional[str] = ""
|
|
33
|
-
startScript: Optional[str] = ""
|
|
34
|
-
|
|
35
|
-
@model_validator(mode="after")
|
|
36
|
-
def sync_input_fields(self):
|
|
37
|
-
self.name = f"{self.name}__{self.resource_id}"
|
|
38
|
-
return self
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def update_system_dependencies(
|
|
42
|
-
template_id, token=None, system_dependencies=None, base_entry_cmd=None
|
|
43
|
-
):
|
|
44
|
-
"""
|
|
45
|
-
Updates Runpod template with system dependencies installed via apt-get,
|
|
46
|
-
and appends the app start command.
|
|
47
|
-
|
|
48
|
-
Args:
|
|
49
|
-
template_id (str): Runpod template ID.
|
|
50
|
-
token (str): [DEPRECATED] Runpod API token. Ignored; uses RUNPOD_API_KEY env var instead.
|
|
51
|
-
system_dependencies (List[str]): List of apt packages to install.
|
|
52
|
-
base_entry_cmd (List[str]): The default command to run the app, e.g. ["uv", "run", "handler.py"]
|
|
53
|
-
Returns:
|
|
54
|
-
dict: API response JSON or error info.
|
|
55
|
-
"""
|
|
56
|
-
# Warn if deprecated token parameter is used
|
|
57
|
-
if token is not None:
|
|
58
|
-
warnings.warn(
|
|
59
|
-
"The 'token' parameter is deprecated and ignored. "
|
|
60
|
-
"Authentication now uses RUNPOD_API_KEY environment variable.",
|
|
61
|
-
DeprecationWarning,
|
|
62
|
-
stacklevel=2,
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
# Compose apt-get install command if any packages specified
|
|
66
|
-
apt_cmd = ""
|
|
67
|
-
if system_dependencies:
|
|
68
|
-
joined_pkgs = " ".join(system_dependencies)
|
|
69
|
-
apt_cmd = f"apt-get update && apt-get install -y {joined_pkgs} && "
|
|
70
|
-
|
|
71
|
-
# Default start command if not provided
|
|
72
|
-
app_cmd = base_entry_cmd or ["uv", "run", "handler.py"]
|
|
73
|
-
app_cmd_str = " ".join(app_cmd)
|
|
74
|
-
|
|
75
|
-
# Full command to run in entrypoint shell
|
|
76
|
-
full_cmd = f"{apt_cmd}exec {app_cmd_str}"
|
|
77
|
-
|
|
78
|
-
payload = {
|
|
79
|
-
# other required fields like disk, env, image, etc, should be fetched or passed in real usage
|
|
80
|
-
"dockerEntrypoint": ["/bin/bash", "-c", full_cmd],
|
|
81
|
-
"dockerStartCmd": [],
|
|
82
|
-
# placeholder values, replace as needed or fetch from current template state
|
|
83
|
-
"containerDiskInGb": 50,
|
|
84
|
-
"containerRegistryAuthId": "",
|
|
85
|
-
"env": {},
|
|
86
|
-
"imageName": "your-image-name",
|
|
87
|
-
"isPublic": False,
|
|
88
|
-
"name": "your-template-name",
|
|
89
|
-
"ports": ["8888/http", "22/tcp"],
|
|
90
|
-
"readme": "",
|
|
91
|
-
"volumeInGb": 20,
|
|
92
|
-
"volumeMountPath": "/workspace",
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
url = f"https://rest.runpod.io/v1/templates/{template_id}/update"
|
|
96
|
-
|
|
97
|
-
# Use centralized auth utility instead of manual header setup
|
|
98
|
-
# Note: token parameter is deprecated; uses RUNPOD_API_KEY environment variable
|
|
99
|
-
session = get_authenticated_requests_session()
|
|
100
|
-
try:
|
|
101
|
-
response = session.post(url, json=payload)
|
|
102
|
-
response.raise_for_status()
|
|
103
|
-
return response.json()
|
|
104
|
-
except Exception as e:
|
|
105
|
-
return {"error": "Failed to update template", "details": str(e)}
|
|
106
|
-
finally:
|
|
107
|
-
session.close()
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
from typing import Callable, Any, List, Union
|
|
2
|
-
from pydantic import BaseModel
|
|
3
|
-
from .gpu import GpuType, GpuTypeDetail
|
|
4
|
-
from .serverless import ServerlessEndpoint
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
Define the mapping for the methods and their return types
|
|
9
|
-
Only include methods from runpod.*
|
|
10
|
-
"""
|
|
11
|
-
RUNPOD_TYPED_OPERATIONS = {
|
|
12
|
-
"get_gpus": List[GpuType],
|
|
13
|
-
"get_gpu": GpuTypeDetail,
|
|
14
|
-
"get_endpoints": List[ServerlessEndpoint],
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def inquire(method: Callable, *args, **kwargs) -> Union[List[Any], Any]:
|
|
19
|
-
"""
|
|
20
|
-
This function dynamically determines the return type of the provided method
|
|
21
|
-
based on a predefined mapping (`definitions`) and validates the result using
|
|
22
|
-
Pydantic models if applicable.
|
|
23
|
-
|
|
24
|
-
Refer to `RUNPOD_TYPED_OPERATIONS` for the mapping.
|
|
25
|
-
|
|
26
|
-
Example:
|
|
27
|
-
----------
|
|
28
|
-
>>> import runpod
|
|
29
|
-
>>> inquire(runpod.get_gpus)
|
|
30
|
-
[
|
|
31
|
-
GpuType(id='NVIDIA A100 80GB', displayName='A100 80GB', memoryInGb=80),
|
|
32
|
-
GpuType(id='NVIDIA A100 40GB', displayName='A100 40GB', memoryInGb=40),
|
|
33
|
-
GpuType(id='NVIDIA A10', displayName='A10', memoryInGb=24)
|
|
34
|
-
]
|
|
35
|
-
"""
|
|
36
|
-
method_name = method.__name__
|
|
37
|
-
return_type = RUNPOD_TYPED_OPERATIONS.get(method_name)
|
|
38
|
-
|
|
39
|
-
raw_result = method(*args, **kwargs)
|
|
40
|
-
|
|
41
|
-
if hasattr(return_type, "__origin__") and return_type.__origin__ is list:
|
|
42
|
-
# List case
|
|
43
|
-
model_type = return_type.__args__[0]
|
|
44
|
-
if issubclass(model_type, BaseModel):
|
|
45
|
-
return [model_type.model_validate(item) for item in raw_result]
|
|
46
|
-
elif isinstance(return_type, type) and issubclass(return_type, BaseModel):
|
|
47
|
-
# Single object case
|
|
48
|
-
return return_type.model_validate(raw_result)
|
|
49
|
-
else:
|
|
50
|
-
raise ValueError(f"Unsupported return type for method '{method_name}'")
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
from enum import Enum
|
|
2
|
-
from typing import Any
|
|
3
|
-
from pydantic import BaseModel
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def normalize_for_json(obj: Any) -> Any:
|
|
7
|
-
"""
|
|
8
|
-
Recursively normalizes an object for JSON serialization.
|
|
9
|
-
|
|
10
|
-
This function handles various data types and ensures that objects
|
|
11
|
-
are converted into JSON-serializable formats. It supports the following:
|
|
12
|
-
- `BaseModel` instances: Converts them to dictionaries using `model_dump()`.
|
|
13
|
-
- Dictionaries: Recursively normalizes their values.
|
|
14
|
-
- Lists: Recursively normalizes their elements.
|
|
15
|
-
- Tuples: Recursively normalizes their elements and returns a tuple.
|
|
16
|
-
- Other types: Returns the object as is.
|
|
17
|
-
|
|
18
|
-
Args:
|
|
19
|
-
obj (Any): The object to normalize.
|
|
20
|
-
|
|
21
|
-
Returns:
|
|
22
|
-
Any: A JSON-serializable representation of the input object.
|
|
23
|
-
"""
|
|
24
|
-
if isinstance(obj, BaseModel):
|
|
25
|
-
return normalize_for_json(obj.model_dump())
|
|
26
|
-
elif isinstance(obj, Enum):
|
|
27
|
-
return obj.value
|
|
28
|
-
elif isinstance(obj, dict):
|
|
29
|
-
return {k: normalize_for_json(v) for k, v in obj.items()}
|
|
30
|
-
elif isinstance(obj, (list, tuple)):
|
|
31
|
-
return type(obj)(normalize_for_json(i) for i in obj)
|
|
32
|
-
else:
|
|
33
|
-
return obj
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/commands/build_utils/handler_generator.py
RENAMED
|
File without changes
|
{tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/commands/build_utils/lb_handler_generator.py
RENAMED
|
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
|
{tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton_template/requirements.txt
RENAMED
|
File without changes
|
{tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton_template/workers/__init__.py
RENAMED
|
File without changes
|
{tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton_template/workers/cpu/__init__.py
RENAMED
|
File without changes
|
{tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton_template/workers/cpu/endpoint.py
RENAMED
|
File without changes
|
{tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton_template/workers/gpu/__init__.py
RENAMED
|
File without changes
|
{tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/cli/utils/skeleton_template/workers/gpu/endpoint.py
RENAMED
|
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
|
{tetra_rp-0.20.0 → tetra_rp-0.20.1}/src/tetra_rp/core/resources/load_balancer_sls_resource.py
RENAMED
|
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
|