runnable 0.28.2__py3-none-any.whl → 0.28.4__py3-none-any.whl
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.
- extensions/job_executor/k8s.py +46 -30
- {runnable-0.28.2.dist-info → runnable-0.28.4.dist-info}/METADATA +1 -1
- {runnable-0.28.2.dist-info → runnable-0.28.4.dist-info}/RECORD +6 -6
- {runnable-0.28.2.dist-info → runnable-0.28.4.dist-info}/WHEEL +0 -0
- {runnable-0.28.2.dist-info → runnable-0.28.4.dist-info}/entry_points.txt +0 -0
- {runnable-0.28.2.dist-info → runnable-0.28.4.dist-info}/licenses/LICENSE +0 -0
extensions/job_executor/k8s.py
CHANGED
@@ -39,7 +39,17 @@ class TolerationOperator(str, Enum):
|
|
39
39
|
EQUAL = "Equal"
|
40
40
|
|
41
41
|
|
42
|
-
class
|
42
|
+
class BaseModelWIthConfig(BaseModel, use_enum_values=True):
|
43
|
+
model_config = ConfigDict(
|
44
|
+
extra="forbid",
|
45
|
+
alias_generator=to_camel,
|
46
|
+
populate_by_name=True,
|
47
|
+
from_attributes=True,
|
48
|
+
validate_default=True,
|
49
|
+
)
|
50
|
+
|
51
|
+
|
52
|
+
class Toleration(BaseModelWIthConfig):
|
43
53
|
key: str
|
44
54
|
operator: TolerationOperator = TolerationOperator.EQUAL
|
45
55
|
value: Optional[str]
|
@@ -47,79 +57,82 @@ class Toleration(BaseModel):
|
|
47
57
|
toleration_seconds: Optional[int] = Field(default=None)
|
48
58
|
|
49
59
|
|
50
|
-
class LabelSelectorRequirement(
|
60
|
+
class LabelSelectorRequirement(BaseModelWIthConfig):
|
51
61
|
key: str
|
52
62
|
operator: Operator
|
53
63
|
values: list[str]
|
54
64
|
|
55
65
|
|
56
|
-
class LabelSelector(
|
66
|
+
class LabelSelector(BaseModelWIthConfig):
|
57
67
|
match_expressions: list[LabelSelectorRequirement]
|
58
68
|
match_labels: dict[str, str]
|
59
69
|
|
60
70
|
|
61
|
-
class ObjectMetaData(
|
71
|
+
class ObjectMetaData(BaseModelWIthConfig):
|
62
72
|
generate_name: Optional[str]
|
63
73
|
annotations: Optional[dict[str, str]]
|
64
74
|
namespace: Optional[str] = "default"
|
65
75
|
|
66
76
|
|
67
|
-
class EnvVar(
|
77
|
+
class EnvVar(BaseModelWIthConfig):
|
68
78
|
name: str
|
69
79
|
value: str
|
70
80
|
|
71
81
|
|
72
|
-
|
82
|
+
VendorGPU = Annotated[
|
83
|
+
Optional[int],
|
84
|
+
PlainSerializer(lambda x: str(x), return_type=str, when_used="unless-none"),
|
85
|
+
]
|
86
|
+
|
87
|
+
|
88
|
+
class Request(BaseModelWIthConfig):
|
73
89
|
"""
|
74
90
|
The default requests
|
75
91
|
"""
|
76
92
|
|
77
93
|
memory: str = "1Gi"
|
78
94
|
cpu: str = "250m"
|
95
|
+
gpu: VendorGPU = Field(default=None, serialization_alias="nvidia.com/gpu")
|
79
96
|
|
80
97
|
|
81
|
-
|
82
|
-
Optional[int],
|
83
|
-
PlainSerializer(lambda x: str(x), return_type=str, when_used="unless-none"),
|
84
|
-
]
|
85
|
-
|
86
|
-
|
87
|
-
class Limit(Request):
|
98
|
+
class Limit(BaseModelWIthConfig):
|
88
99
|
"""
|
89
100
|
The default limits
|
90
101
|
"""
|
91
102
|
|
103
|
+
memory: str = "1Gi"
|
104
|
+
cpu: str = "250m"
|
92
105
|
gpu: VendorGPU = Field(default=None, serialization_alias="nvidia.com/gpu")
|
93
106
|
|
94
107
|
|
95
|
-
class Resources(
|
108
|
+
class Resources(BaseModelWIthConfig):
|
96
109
|
limits: Limit = Limit()
|
97
|
-
requests: Request =
|
110
|
+
requests: Optional[Request] = Field(default=None)
|
98
111
|
|
99
112
|
|
100
|
-
class VolumeMount(
|
113
|
+
class VolumeMount(BaseModelWIthConfig):
|
101
114
|
name: str
|
102
115
|
mount_path: str
|
103
116
|
|
104
117
|
|
105
|
-
class Container(
|
118
|
+
class Container(BaseModelWIthConfig):
|
106
119
|
image: str
|
107
120
|
env: list[EnvVar] = Field(default_factory=list)
|
108
|
-
image_pull_policy: ImagePullPolicy = ImagePullPolicy.NEVER
|
121
|
+
image_pull_policy: ImagePullPolicy = Field(default=ImagePullPolicy.NEVER)
|
109
122
|
resources: Resources = Resources()
|
110
123
|
volume_mounts: Optional[list[VolumeMount]] = Field(default_factory=lambda: [])
|
111
124
|
|
112
125
|
|
113
|
-
class HostPath(
|
126
|
+
class HostPath(BaseModelWIthConfig):
|
114
127
|
path: str
|
115
128
|
|
116
129
|
|
117
|
-
class HostPathVolume(
|
130
|
+
class HostPathVolume(BaseModelWIthConfig):
|
118
131
|
name: str
|
119
132
|
host_path: HostPath
|
120
133
|
|
121
134
|
|
122
|
-
class PVCClaim(
|
135
|
+
class PVCClaim(BaseModelWIthConfig):
|
123
136
|
claim_name: str
|
124
137
|
|
125
138
|
model_config = ConfigDict(
|
@@ -129,12 +142,12 @@ class PVCClaim(BaseModel):
|
|
129
142
|
)
|
130
143
|
|
131
144
|
|
132
|
-
class PVCVolume(
|
145
|
+
class PVCVolume(BaseModelWIthConfig):
|
133
146
|
name: str
|
134
147
|
persistent_volume_claim: PVCClaim
|
135
148
|
|
136
149
|
|
137
|
-
class K8sTemplateSpec(
|
150
|
+
class K8sTemplateSpec(BaseModelWIthConfig):
|
138
151
|
active_deadline_seconds: int = Field(default=60 * 60 * 2) # 2 hours
|
139
152
|
node_selector: Optional[dict[str, str]] = None
|
140
153
|
tolerations: Optional[list[Toleration]] = None
|
@@ -146,12 +159,12 @@ class K8sTemplateSpec(BaseModel):
|
|
146
159
|
container: Container
|
147
160
|
|
148
161
|
|
149
|
-
class K8sTemplate(
|
162
|
+
class K8sTemplate(BaseModelWIthConfig):
|
150
163
|
spec: K8sTemplateSpec
|
151
164
|
metadata: Optional[ObjectMetaData] = None
|
152
165
|
|
153
166
|
|
154
|
-
class Spec(
|
167
|
+
class Spec(BaseModelWIthConfig):
|
155
168
|
active_deadline_seconds: Optional[int] = Field(default=60 * 60 * 2) # 2 hours
|
156
169
|
backoff_limit: int = 6
|
157
170
|
selector: Optional[LabelSelector] = None
|
@@ -248,7 +261,7 @@ class GenericK8sJobExecutor(GenericJobExecutor):
|
|
248
261
|
command = utils.get_job_execution_command()
|
249
262
|
|
250
263
|
container_env = [
|
251
|
-
self._client.V1EnvVar(**env.model_dump(
|
264
|
+
self._client.V1EnvVar(**env.model_dump())
|
252
265
|
for env in self.job_spec.template.spec.container.env
|
253
266
|
]
|
254
267
|
|
@@ -257,8 +270,12 @@ class GenericK8sJobExecutor(GenericJobExecutor):
|
|
257
270
|
env=container_env,
|
258
271
|
name="default",
|
259
272
|
volume_mounts=container_volume_mounts,
|
273
|
+
resources=self.job_spec.template.spec.container.resources.model_dump(
|
274
|
+
by_alias=True, exclude_none=True
|
275
|
+
),
|
260
276
|
**self.job_spec.template.spec.container.model_dump(
|
261
|
-
exclude_none=True,
|
277
|
+
exclude_none=True,
|
278
|
+
exclude={"volume_mounts", "command", "env", "resources"},
|
262
279
|
),
|
263
280
|
)
|
264
281
|
|
@@ -266,14 +283,13 @@ class GenericK8sJobExecutor(GenericJobExecutor):
|
|
266
283
|
self._volumes += self.job_spec.template.spec.volumes
|
267
284
|
|
268
285
|
spec_volumes = [
|
269
|
-
self._client.V1Volume(**vol.model_dump(
|
270
|
-
for vol in self._volumes
|
286
|
+
self._client.V1Volume(**vol.model_dump()) for vol in self._volumes
|
271
287
|
]
|
272
288
|
|
273
289
|
tolerations = None
|
274
290
|
if self.job_spec.template.spec.tolerations:
|
275
291
|
tolerations = [
|
276
|
-
self._client.V1Toleration(**toleration.model_dump(
|
292
|
+
self._client.V1Toleration(**toleration.model_dump())
|
277
293
|
for toleration in self.job_spec.template.spec.tolerations
|
278
294
|
]
|
279
295
|
|
@@ -8,7 +8,7 @@ extensions/catalog/pyproject.toml,sha256=lLNxY6v04c8I5QK_zKw_E6sJTArSJRA_V-79kta
|
|
8
8
|
extensions/catalog/s3.py,sha256=Sw5t8_kVRprn3uGGJCiHn7M9zw1CLaCOFj6YErtfG0o,287
|
9
9
|
extensions/job_executor/README.md,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
extensions/job_executor/__init__.py,sha256=E2R6GV5cZTlZdqA5SVJ6ajZFh4oruM0k8AKHkpOZ3W8,5772
|
11
|
-
extensions/job_executor/k8s.py,sha256=
|
11
|
+
extensions/job_executor/k8s.py,sha256=yL6vMLO9CCf4jWopLvx0C0rK0xxWcOvvuJeumy-LgjA,16356
|
12
12
|
extensions/job_executor/k8s_job_spec.yaml,sha256=7aFpxHdO_p6Hkc3YxusUOuAQTD1Myu0yTPX9DrhxbOg,1158
|
13
13
|
extensions/job_executor/local.py,sha256=FvxTk0vyxdrbLOAyNkLyjvmmowypabWOSITQBK_ffVE,1907
|
14
14
|
extensions/job_executor/local_container.py,sha256=hyFnpicCp3_87mZsW64P6KSVbz7XMLjwJUWVjeCJ0_I,6627
|
@@ -56,8 +56,8 @@ runnable/sdk.py,sha256=T1nqDpLN9fULvvU9L-oY0EHqYdKUI9qk7oekLynm02Y,33568
|
|
56
56
|
runnable/secrets.py,sha256=PXcEJw-4WPzeWRLfsatcPPyr1zkqgHzdRWRcS9vvpvM,2354
|
57
57
|
runnable/tasks.py,sha256=X6xijut7ffwpfYDcXoN6y0AcRVd7fWHs676DJ00Kma4,29134
|
58
58
|
runnable/utils.py,sha256=hBr7oGwGL2VgfITlQCTz-a1iwvvf7Mfl-HY8UdENZac,19929
|
59
|
-
runnable-0.28.
|
60
|
-
runnable-0.28.
|
61
|
-
runnable-0.28.
|
62
|
-
runnable-0.28.
|
63
|
-
runnable-0.28.
|
59
|
+
runnable-0.28.4.dist-info/METADATA,sha256=fRMAv5diO4kDj1yQ515tE_-oyaxHr_kMpPOkbJPiiMI,10047
|
60
|
+
runnable-0.28.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
61
|
+
runnable-0.28.4.dist-info/entry_points.txt,sha256=ioMbWojILtdibYVgh1jXJ00SpK-tX3gy7oVGDq61cSk,1839
|
62
|
+
runnable-0.28.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
63
|
+
runnable-0.28.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|