runnable 0.28.3__tar.gz → 0.28.5__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {runnable-0.28.3 → runnable-0.28.5}/PKG-INFO +1 -1
- {runnable-0.28.3 → runnable-0.28.5}/extensions/job_executor/k8s.py +41 -33
- {runnable-0.28.3 → runnable-0.28.5}/pyproject.toml +1 -1
- {runnable-0.28.3 → runnable-0.28.5}/.gitignore +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/LICENSE +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/README.md +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/README.md +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/__init__.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/catalog/README.md +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/catalog/any_path.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/catalog/file_system.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/catalog/minio.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/catalog/pyproject.toml +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/catalog/s3.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/job_executor/README.md +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/job_executor/__init__.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/job_executor/k8s_job_spec.yaml +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/job_executor/local.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/job_executor/local_container.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/job_executor/pyproject.toml +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/nodes/README.md +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/nodes/nodes.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/nodes/pyproject.toml +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/pipeline_executor/README.md +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/pipeline_executor/__init__.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/pipeline_executor/argo.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/pipeline_executor/local.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/pipeline_executor/local_container.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/pipeline_executor/mocked.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/pipeline_executor/pyproject.toml +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/pipeline_executor/retry.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/run_log_store/README.md +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/run_log_store/__init__.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/run_log_store/any_path.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/run_log_store/chunked_fs.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/run_log_store/chunked_minio.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/run_log_store/db/implementation_FF.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/run_log_store/db/integration_FF.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/run_log_store/file_system.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/run_log_store/generic_chunked.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/run_log_store/minio.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/run_log_store/pyproject.toml +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/secrets/README.md +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/secrets/dotenv.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/extensions/secrets/pyproject.toml +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/__init__.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/catalog.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/cli.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/context.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/datastore.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/defaults.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/entrypoints.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/exceptions.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/executor.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/graph.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/names.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/nodes.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/parameters.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/pickler.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/sdk.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/secrets.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/tasks.py +0 -0
- {runnable-0.28.3 → runnable-0.28.5}/runnable/utils.py +0 -0
@@ -7,6 +7,7 @@ from kubernetes import client
|
|
7
7
|
from kubernetes import config as k8s_config
|
8
8
|
from pydantic import BaseModel, ConfigDict, Field, PlainSerializer, PrivateAttr
|
9
9
|
from pydantic.alias_generators import to_camel
|
10
|
+
from rich import print
|
10
11
|
|
11
12
|
from extensions.job_executor import GenericJobExecutor
|
12
13
|
from runnable import console, defaults, utils
|
@@ -39,7 +40,17 @@ class TolerationOperator(str, Enum):
|
|
39
40
|
EQUAL = "Equal"
|
40
41
|
|
41
42
|
|
42
|
-
class
|
43
|
+
class BaseModelWIthConfig(BaseModel, use_enum_values=True):
|
44
|
+
model_config = ConfigDict(
|
45
|
+
extra="forbid",
|
46
|
+
alias_generator=to_camel,
|
47
|
+
populate_by_name=True,
|
48
|
+
from_attributes=True,
|
49
|
+
validate_default=True,
|
50
|
+
)
|
51
|
+
|
52
|
+
|
53
|
+
class Toleration(BaseModelWIthConfig):
|
43
54
|
key: str
|
44
55
|
operator: TolerationOperator = TolerationOperator.EQUAL
|
45
56
|
value: Optional[str]
|
@@ -47,24 +58,24 @@ class Toleration(BaseModel):
|
|
47
58
|
toleration_seconds: Optional[int] = Field(default=None)
|
48
59
|
|
49
60
|
|
50
|
-
class LabelSelectorRequirement(
|
61
|
+
class LabelSelectorRequirement(BaseModelWIthConfig):
|
51
62
|
key: str
|
52
63
|
operator: Operator
|
53
64
|
values: list[str]
|
54
65
|
|
55
66
|
|
56
|
-
class LabelSelector(
|
67
|
+
class LabelSelector(BaseModelWIthConfig):
|
57
68
|
match_expressions: list[LabelSelectorRequirement]
|
58
69
|
match_labels: dict[str, str]
|
59
70
|
|
60
71
|
|
61
|
-
class ObjectMetaData(
|
72
|
+
class ObjectMetaData(BaseModelWIthConfig):
|
62
73
|
generate_name: Optional[str]
|
63
74
|
annotations: Optional[dict[str, str]]
|
64
75
|
namespace: Optional[str] = "default"
|
65
76
|
|
66
77
|
|
67
|
-
class EnvVar(
|
78
|
+
class EnvVar(BaseModelWIthConfig):
|
68
79
|
name: str
|
69
80
|
value: str
|
70
81
|
|
@@ -75,7 +86,7 @@ VendorGPU = Annotated[
|
|
75
86
|
]
|
76
87
|
|
77
88
|
|
78
|
-
class Request(
|
89
|
+
class Request(BaseModelWIthConfig):
|
79
90
|
"""
|
80
91
|
The default requests
|
81
92
|
"""
|
@@ -85,7 +96,7 @@ class Request(BaseModel):
|
|
85
96
|
gpu: VendorGPU = Field(default=None, serialization_alias="nvidia.com/gpu")
|
86
97
|
|
87
98
|
|
88
|
-
class Limit(
|
99
|
+
class Limit(BaseModelWIthConfig):
|
89
100
|
"""
|
90
101
|
The default limits
|
91
102
|
"""
|
@@ -95,49 +106,43 @@ class Limit(BaseModel):
|
|
95
106
|
gpu: VendorGPU = Field(default=None, serialization_alias="nvidia.com/gpu")
|
96
107
|
|
97
108
|
|
98
|
-
class Resources(
|
109
|
+
class Resources(BaseModelWIthConfig):
|
99
110
|
limits: Limit = Limit()
|
100
|
-
requests: Request =
|
111
|
+
requests: Optional[Request] = Field(default=None)
|
101
112
|
|
102
113
|
|
103
|
-
class VolumeMount(
|
114
|
+
class VolumeMount(BaseModelWIthConfig):
|
104
115
|
name: str
|
105
116
|
mount_path: str
|
106
117
|
|
107
118
|
|
108
|
-
class Container(
|
119
|
+
class Container(BaseModelWIthConfig):
|
109
120
|
image: str
|
110
121
|
env: list[EnvVar] = Field(default_factory=list)
|
111
|
-
image_pull_policy: ImagePullPolicy = ImagePullPolicy.NEVER
|
122
|
+
image_pull_policy: ImagePullPolicy = Field(default=ImagePullPolicy.NEVER)
|
112
123
|
resources: Resources = Resources()
|
113
124
|
volume_mounts: Optional[list[VolumeMount]] = Field(default_factory=lambda: [])
|
114
125
|
|
115
126
|
|
116
|
-
class HostPath(
|
127
|
+
class HostPath(BaseModelWIthConfig):
|
117
128
|
path: str
|
118
129
|
|
119
130
|
|
120
|
-
class HostPathVolume(
|
131
|
+
class HostPathVolume(BaseModelWIthConfig):
|
121
132
|
name: str
|
122
133
|
host_path: HostPath
|
123
134
|
|
124
135
|
|
125
|
-
class PVCClaim(
|
126
|
-
|
127
|
-
|
128
|
-
model_config = ConfigDict(
|
129
|
-
alias_generator=to_camel,
|
130
|
-
populate_by_name=True,
|
131
|
-
from_attributes=True,
|
132
|
-
)
|
136
|
+
class PVCClaim(BaseModelWIthConfig):
|
137
|
+
claimName: str
|
133
138
|
|
134
139
|
|
135
|
-
class PVCVolume(
|
140
|
+
class PVCVolume(BaseModelWIthConfig):
|
136
141
|
name: str
|
137
142
|
persistent_volume_claim: PVCClaim
|
138
143
|
|
139
144
|
|
140
|
-
class K8sTemplateSpec(
|
145
|
+
class K8sTemplateSpec(BaseModelWIthConfig):
|
141
146
|
active_deadline_seconds: int = Field(default=60 * 60 * 2) # 2 hours
|
142
147
|
node_selector: Optional[dict[str, str]] = None
|
143
148
|
tolerations: Optional[list[Toleration]] = None
|
@@ -149,12 +154,12 @@ class K8sTemplateSpec(BaseModel):
|
|
149
154
|
container: Container
|
150
155
|
|
151
156
|
|
152
|
-
class K8sTemplate(
|
157
|
+
class K8sTemplate(BaseModelWIthConfig):
|
153
158
|
spec: K8sTemplateSpec
|
154
159
|
metadata: Optional[ObjectMetaData] = None
|
155
160
|
|
156
161
|
|
157
|
-
class Spec(
|
162
|
+
class Spec(BaseModelWIthConfig):
|
158
163
|
active_deadline_seconds: Optional[int] = Field(default=60 * 60 * 2) # 2 hours
|
159
164
|
backoff_limit: int = 6
|
160
165
|
selector: Optional[LabelSelector] = None
|
@@ -251,7 +256,7 @@ class GenericK8sJobExecutor(GenericJobExecutor):
|
|
251
256
|
command = utils.get_job_execution_command()
|
252
257
|
|
253
258
|
container_env = [
|
254
|
-
self._client.V1EnvVar(**env.model_dump(
|
259
|
+
self._client.V1EnvVar(**env.model_dump())
|
255
260
|
for env in self.job_spec.template.spec.container.env
|
256
261
|
]
|
257
262
|
|
@@ -260,8 +265,12 @@ class GenericK8sJobExecutor(GenericJobExecutor):
|
|
260
265
|
env=container_env,
|
261
266
|
name="default",
|
262
267
|
volume_mounts=container_volume_mounts,
|
268
|
+
resources=self.job_spec.template.spec.container.resources.model_dump(
|
269
|
+
by_alias=True, exclude_none=True
|
270
|
+
),
|
263
271
|
**self.job_spec.template.spec.container.model_dump(
|
264
|
-
exclude_none=True,
|
272
|
+
exclude_none=True,
|
273
|
+
exclude={"volume_mounts", "command", "env", "resources"},
|
265
274
|
),
|
266
275
|
)
|
267
276
|
|
@@ -269,20 +278,19 @@ class GenericK8sJobExecutor(GenericJobExecutor):
|
|
269
278
|
self._volumes += self.job_spec.template.spec.volumes
|
270
279
|
|
271
280
|
spec_volumes = [
|
272
|
-
self._client.V1Volume(**vol.model_dump(
|
273
|
-
for vol in self._volumes
|
281
|
+
self._client.V1Volume(**vol.model_dump()) for vol in self._volumes
|
274
282
|
]
|
275
283
|
|
276
284
|
tolerations = None
|
277
285
|
if self.job_spec.template.spec.tolerations:
|
278
286
|
tolerations = [
|
279
|
-
self._client.V1Toleration(**toleration.model_dump(
|
287
|
+
self._client.V1Toleration(**toleration.model_dump())
|
280
288
|
for toleration in self.job_spec.template.spec.tolerations
|
281
289
|
]
|
282
290
|
|
283
291
|
pod_spec = self._client.V1PodSpec(
|
284
292
|
containers=[base_container],
|
285
|
-
# volumes=[vol.model_dump(by_alias=True) for vol in
|
293
|
+
# volumes=[vol.model_dump(by_alias=True) for vol in spec_volumes],
|
286
294
|
volumes=spec_volumes,
|
287
295
|
tolerations=tolerations,
|
288
296
|
**self.job_spec.template.spec.model_dump(
|
@@ -473,7 +481,7 @@ class K8sJobExecutor(GenericK8sJobExecutor):
|
|
473
481
|
self._volumes.append(
|
474
482
|
PVCVolume(
|
475
483
|
name=self.pvc_claim_name,
|
476
|
-
persistent_volume_claim=PVCClaim(
|
484
|
+
persistent_volume_claim=PVCClaim(claimName=self.pvc_claim_name),
|
477
485
|
)
|
478
486
|
)
|
479
487
|
match self._context.run_log_store.service_name:
|
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
|
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
|