polyaxon 2.0.6rc9__py3-none-any.whl → 2.1.0__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.
- polyaxon/_cli/config.py +1 -1
- polyaxon/_cli/run.py +8 -0
- polyaxon/_cli/services/clean_artifacts.py +1 -1
- polyaxon/_client/client.py +17 -0
- polyaxon/_client/run.py +12 -0
- polyaxon/_compiler/resolver/agent.py +1 -1
- polyaxon/_compiler/resolver/runtime.py +1 -1
- polyaxon/_deploy/schemas/service.py +3 -0
- polyaxon/_docker/executor.py +10 -4
- polyaxon/_env_vars/getters/run.py +3 -0
- polyaxon/_env_vars/keys.py +3 -0
- polyaxon/_flow/__init__.py +2 -0
- polyaxon/_flow/builds/__init__.py +19 -6
- polyaxon/_flow/component/base.py +1 -0
- polyaxon/_flow/component/component.py +14 -0
- polyaxon/_flow/environment/__init__.py +5 -5
- polyaxon/_flow/hooks/__init__.py +19 -6
- polyaxon/_flow/matrix/tuner.py +18 -6
- polyaxon/_flow/operations/operation.py +19 -0
- polyaxon/_flow/run/__init__.py +2 -2
- polyaxon/_flow/run/kubeflow/paddle_job.py +34 -2
- polyaxon/_flow/run/kubeflow/pytorch_job.py +50 -3
- polyaxon/_flow/run/kubeflow/scheduling_policy.py +4 -0
- polyaxon/_flow/run/kubeflow/tf_job.py +2 -1
- polyaxon/_fs/fs.py +5 -0
- polyaxon/_k8s/converter/converters/job.py +1 -1
- polyaxon/_k8s/converter/converters/kubeflow/paddle_job.py +1 -0
- polyaxon/_k8s/converter/converters/kubeflow/pytroch_job.py +2 -0
- polyaxon/_k8s/converter/converters/kubeflow/tf_job.py +1 -0
- polyaxon/_k8s/custom_resources/kubeflow/paddle_job.py +10 -1
- polyaxon/_k8s/custom_resources/kubeflow/pytorch_job.py +14 -1
- polyaxon/_k8s/custom_resources/kubeflow/tf_job.py +4 -0
- polyaxon/_k8s/executor/base.py +23 -6
- polyaxon/_k8s/logging/async_monitor.py +73 -12
- polyaxon/_k8s/manager/async_manager.py +81 -23
- polyaxon/_k8s/manager/base.py +4 -0
- polyaxon/_k8s/manager/manager.py +266 -133
- polyaxon/_operations/tuner.py +1 -0
- polyaxon/_polyaxonfile/check.py +2 -0
- polyaxon/_polyaxonfile/manager/operations.py +3 -0
- polyaxon/_polyaxonfile/manager/workflows.py +2 -0
- polyaxon/_polyaxonfile/specs/compiled_operation.py +1 -0
- polyaxon/_polyaxonfile/specs/operation.py +1 -0
- polyaxon/_polyaxonfile/specs/sections.py +3 -0
- polyaxon/_runner/agent/async_agent.py +94 -18
- polyaxon/_runner/agent/base_agent.py +25 -7
- polyaxon/_runner/agent/client.py +15 -1
- polyaxon/_runner/agent/sync_agent.py +83 -18
- polyaxon/_runner/executor.py +13 -7
- polyaxon/_schemas/agent.py +27 -1
- polyaxon/_schemas/client.py +30 -3
- polyaxon/_sdk/api/agents_v1_api.py +875 -51
- polyaxon/_sdk/api/service_accounts_v1_api.py +12 -12
- polyaxon/_sdk/schemas/__init__.py +3 -0
- polyaxon/_sdk/schemas/v1_agent_reconcile_body_request.py +14 -0
- polyaxon/_sidecar/container/__init__.py +1 -1
- polyaxon/_sidecar/container/monitors/spec.py +1 -1
- polyaxon/pkg.py +1 -1
- {polyaxon-2.0.6rc9.dist-info → polyaxon-2.1.0.dist-info}/METADATA +6 -6
- {polyaxon-2.0.6rc9.dist-info → polyaxon-2.1.0.dist-info}/RECORD +64 -63
- {polyaxon-2.0.6rc9.dist-info → polyaxon-2.1.0.dist-info}/LICENSE +0 -0
- {polyaxon-2.0.6rc9.dist-info → polyaxon-2.1.0.dist-info}/WHEEL +0 -0
- {polyaxon-2.0.6rc9.dist-info → polyaxon-2.1.0.dist-info}/entry_points.txt +0 -0
- {polyaxon-2.0.6rc9.dist-info → polyaxon-2.1.0.dist-info}/top_level.txt +0 -0
polyaxon/_schemas/agent.py
CHANGED
@@ -18,6 +18,7 @@ from polyaxon._connections import V1Connection, V1ConnectionKind, V1HostPathConn
|
|
18
18
|
from polyaxon._contexts import paths as ctx_paths
|
19
19
|
from polyaxon._env_vars.getters import get_artifacts_store_name
|
20
20
|
from polyaxon._env_vars.keys import (
|
21
|
+
ENV_KEYS_ADDITIONAL_NAMESPACES,
|
21
22
|
ENV_KEYS_AGENT_ARTIFACTS_STORE,
|
22
23
|
ENV_KEYS_AGENT_CLEANER,
|
23
24
|
ENV_KEYS_AGENT_CONNECTIONS,
|
@@ -35,6 +36,8 @@ from polyaxon._env_vars.keys import (
|
|
35
36
|
ENV_KEYS_ARTIFACTS_STORE_NAME,
|
36
37
|
ENV_KEYS_K8S_APP_SECRET_NAME,
|
37
38
|
ENV_KEYS_K8S_NAMESPACE,
|
39
|
+
ENV_KEYS_SINGLE_NAMESPACE,
|
40
|
+
ENV_KEYS_WATCH_CLUSTER,
|
38
41
|
)
|
39
42
|
from polyaxon._fs.utils import get_store_path
|
40
43
|
from polyaxon._schemas.base import BaseSchemaModel
|
@@ -185,6 +188,11 @@ class AgentConfig(BaseAgentConfig):
|
|
185
188
|
_IDENTIFIER = "agent"
|
186
189
|
|
187
190
|
is_replica: Optional[bool] = Field(alias=ENV_KEYS_AGENT_IS_REPLICA)
|
191
|
+
watch_cluster: Optional[bool] = Field(alias=ENV_KEYS_WATCH_CLUSTER)
|
192
|
+
single_namespace: Optional[bool] = Field(alias=ENV_KEYS_SINGLE_NAMESPACE)
|
193
|
+
additional_namespaces: Optional[List[StrictStr]] = Field(
|
194
|
+
alias=ENV_KEYS_ADDITIONAL_NAMESPACES
|
195
|
+
)
|
188
196
|
sidecar: Optional[V1PolyaxonSidecarContainer] = Field(alias=ENV_KEYS_AGENT_SIDECAR)
|
189
197
|
init: Optional[V1PolyaxonInitContainer] = Field(alias=ENV_KEYS_AGENT_INIT)
|
190
198
|
notifier: Optional[V1PolyaxonNotifier] = Field(alias=ENV_KEYS_AGENT_NOTIFIER)
|
@@ -217,6 +225,24 @@ class AgentConfig(BaseAgentConfig):
|
|
217
225
|
and "isReplica" in values
|
218
226
|
):
|
219
227
|
values[ENV_KEYS_AGENT_IS_REPLICA] = values["isReplica"]
|
228
|
+
if (
|
229
|
+
not values.get("watch_cluster")
|
230
|
+
and not values.get(ENV_KEYS_WATCH_CLUSTER)
|
231
|
+
and "watchCluster" in values
|
232
|
+
):
|
233
|
+
values[ENV_KEYS_WATCH_CLUSTER] = values["watchCluster"]
|
234
|
+
if (
|
235
|
+
not values.get("single_namespace")
|
236
|
+
and not values.get(ENV_KEYS_SINGLE_NAMESPACE)
|
237
|
+
and "singleNamespace" in values
|
238
|
+
):
|
239
|
+
values[ENV_KEYS_SINGLE_NAMESPACE] = values["singleNamespace"]
|
240
|
+
if (
|
241
|
+
not values.get("additional_namespace")
|
242
|
+
and not values.get(ENV_KEYS_ADDITIONAL_NAMESPACES)
|
243
|
+
and "additionalNamespaces" in values
|
244
|
+
):
|
245
|
+
values[ENV_KEYS_ADDITIONAL_NAMESPACES] = values["additionalNamespaces"]
|
220
246
|
if (
|
221
247
|
not values.get("use_proxy_env_vars_use_in_ops")
|
222
248
|
and not values.get(ENV_KEYS_AGENT_USE_PROXY_ENV_VARS_IN_OPS)
|
@@ -312,7 +338,7 @@ class AgentConfig(BaseAgentConfig):
|
|
312
338
|
"Received an invalid {} `{}`".format(field.alias, v)
|
313
339
|
) from e
|
314
340
|
|
315
|
-
@validator("default_image_pull_secrets", pre=True)
|
341
|
+
@validator("additional_namespaces", "default_image_pull_secrets", pre=True)
|
316
342
|
def validate_str_list(cls, v, field):
|
317
343
|
try:
|
318
344
|
return ConfigParser.parse(str)(
|
polyaxon/_schemas/client.py
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
import os
|
2
|
+
|
1
3
|
from typing import Dict, Optional, Union
|
2
4
|
|
3
5
|
import urllib3
|
@@ -29,6 +31,7 @@ from polyaxon._env_vars.keys import (
|
|
29
31
|
ENV_KEYS_NO_API,
|
30
32
|
ENV_KEYS_NO_OP,
|
31
33
|
ENV_KEYS_RETRIES,
|
34
|
+
ENV_KEYS_SECRET_INTERNAL_TOKEN,
|
32
35
|
ENV_KEYS_SSL_CA_CERT,
|
33
36
|
ENV_KEYS_TIME_ZONE,
|
34
37
|
ENV_KEYS_TIMEOUT,
|
@@ -137,6 +140,10 @@ class ClientConfig(BaseSchemaModel):
|
|
137
140
|
self.client_header["header_name"] = self.header
|
138
141
|
self.client_header["header_value"] = self.header_service
|
139
142
|
|
143
|
+
def get_internal_header(self) -> Dict:
|
144
|
+
header = PolyaxonServiceHeaders.get_header(PolyaxonServiceHeaders.INTERNAL)
|
145
|
+
return {"header_name": header, "header_value": self.header_service}
|
146
|
+
|
140
147
|
def get_full_headers(self, headers=None, auth_key="Authorization") -> Dict:
|
141
148
|
request_headers = {}
|
142
149
|
request_headers.update(headers or {})
|
@@ -151,7 +158,19 @@ class ClientConfig(BaseSchemaModel):
|
|
151
158
|
return request_headers
|
152
159
|
|
153
160
|
@property
|
154
|
-
def sdk_config(self)
|
161
|
+
def sdk_config(self):
|
162
|
+
return self.get_sdk_config()
|
163
|
+
|
164
|
+
@property
|
165
|
+
def internal_sdk_config(self):
|
166
|
+
return self.get_sdk_config(
|
167
|
+
token=os.environ.get(ENV_KEYS_SECRET_INTERNAL_TOKEN),
|
168
|
+
authentication_type=AuthenticationTypes.INTERNAL_TOKEN,
|
169
|
+
)
|
170
|
+
|
171
|
+
def get_sdk_config(
|
172
|
+
self, token: str = None, authentication_type: AuthenticationTypes = None
|
173
|
+
) -> Configuration:
|
155
174
|
if not self.host and not self.in_cluster:
|
156
175
|
raise PolyaxonClientException(
|
157
176
|
"Api config requires at least a host if not running in-cluster."
|
@@ -171,8 +190,10 @@ class ClientConfig(BaseSchemaModel):
|
|
171
190
|
if self.connection_pool_maxsize:
|
172
191
|
config.connection_pool_maxsize = self.connection_pool_maxsize
|
173
192
|
if self.token:
|
174
|
-
config.api_key["ApiKey"] = self.token
|
175
|
-
config.api_key_prefix["ApiKey"] =
|
193
|
+
config.api_key["ApiKey"] = token or self.token
|
194
|
+
config.api_key_prefix["ApiKey"] = (
|
195
|
+
authentication_type or self.authentication_type
|
196
|
+
)
|
176
197
|
return config
|
177
198
|
|
178
199
|
@property
|
@@ -181,6 +202,12 @@ class ClientConfig(BaseSchemaModel):
|
|
181
202
|
config.connection_pool_maxsize = 100
|
182
203
|
return config
|
183
204
|
|
205
|
+
@property
|
206
|
+
def async_internal_sdk_config(self) -> Configuration:
|
207
|
+
config = self.internal_sdk_config
|
208
|
+
config.connection_pool_maxsize = 100
|
209
|
+
return config
|
210
|
+
|
184
211
|
@classmethod
|
185
212
|
def patch_from(cls, config: "ClientConfig", **kwargs) -> "ClientConfig":
|
186
213
|
data = {**config.to_dict(), **kwargs}
|