polyaxon 2.6.0rc1__py3-none-any.whl → 2.6.1__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/operations.py +1 -1
- polyaxon/_cli/projects.py +2 -2
- polyaxon/_compiler/contexts/contexts.py +5 -5
- polyaxon/_compiler/contexts/dask_job.py +1 -1
- polyaxon/_compiler/contexts/kubeflow/mpi_job.py +1 -1
- polyaxon/_compiler/contexts/kubeflow/mx_job.py +1 -1
- polyaxon/_compiler/contexts/kubeflow/paddle_job.py +1 -1
- polyaxon/_compiler/contexts/kubeflow/pytroch_job.py +1 -1
- polyaxon/_compiler/contexts/kubeflow/tf_job.py +1 -1
- polyaxon/_compiler/contexts/kubeflow/xgb_job.py +1 -1
- polyaxon/_compiler/contexts/ray_job.py +1 -1
- polyaxon/_compiler/resolver/agent.py +1 -1
- polyaxon/_compiler/resolver/runtime.py +1 -1
- polyaxon/_deploy/schemas/ui.py +3 -1
- polyaxon/_docker/converter/base/base.py +1 -1
- polyaxon/_docker/converter/base/env_vars.py +1 -1
- polyaxon/_docker/converter/converters/job.py +1 -1
- polyaxon/_docker/converter/converters/service.py +1 -1
- polyaxon/_flow/environment/__init__.py +5 -4
- polyaxon/_flow/io/io.py +2 -0
- polyaxon/_flow/matrix/params.py +1 -1
- polyaxon/_flow/operations/operation.py +0 -1
- polyaxon/_flow/params/params.py +2 -2
- polyaxon/_flow/run/dag.py +6 -6
- polyaxon/_flow/run/resources.py +1 -1
- polyaxon/_fs/fs.py +1 -1
- polyaxon/_k8s/converter/base/containers.py +1 -1
- polyaxon/_k8s/converter/converters/dask_job.py +1 -1
- polyaxon/_k8s/converter/converters/job.py +1 -1
- polyaxon/_k8s/converter/converters/kubeflow/mpi_job.py +1 -1
- polyaxon/_k8s/converter/converters/kubeflow/mx_job.py +1 -1
- polyaxon/_k8s/converter/converters/kubeflow/paddle_job.py +1 -1
- polyaxon/_k8s/converter/converters/kubeflow/pytroch_job.py +1 -1
- polyaxon/_k8s/converter/converters/kubeflow/tf_job.py +1 -1
- polyaxon/_k8s/converter/converters/kubeflow/xgboost_job.py +1 -1
- polyaxon/_k8s/converter/converters/ray_job.py +1 -2
- polyaxon/_k8s/converter/converters/service.py +1 -1
- polyaxon/_k8s/k8s_validation.py +16 -16
- polyaxon/_k8s/logging/async_monitor.py +4 -4
- polyaxon/_k8s/manager/async_manager.py +5 -3
- polyaxon/_k8s/manager/manager.py +6 -6
- polyaxon/_local_process/converter/base/env_vars.py +1 -1
- polyaxon/_local_process/converter/base/init.py +1 -1
- polyaxon/_local_process/converter/base/mounts.py +0 -2
- polyaxon/_local_process/converter/converters/job.py +1 -1
- polyaxon/_local_process/converter/converters/service.py +1 -1
- polyaxon/_managers/project.py +3 -2
- polyaxon/_polyaxonfile/check.py +4 -4
- polyaxon/_polyaxonfile/specs/compiled_operation.py +3 -5
- polyaxon/_polyaxonfile/specs/libs/parser.py +1 -3
- polyaxon/_polyaxonfile/specs/libs/validator.py +1 -1
- polyaxon/_polyaxonfile/specs/operation.py +2 -2
- polyaxon/_pql/manager.py +1 -1
- polyaxon/_pql/parser.py +29 -26
- polyaxon/_runner/agent/base_agent.py +1 -2
- polyaxon/_runner/converter/init/artifacts.py +3 -2
- polyaxon/_runner/converter/init/tensorboard.py +1 -1
- polyaxon/_schemas/client.py +1 -1
- polyaxon/_sdk/api/agents_v1_api.py +56 -80
- polyaxon/_sdk/api/artifacts_stores_v1_api.py +2 -2
- polyaxon/_sdk/api/auth_v1_api.py +2 -6
- polyaxon/_sdk/api/connections_v1_api.py +16 -20
- polyaxon/_sdk/api/dashboards_v1_api.py +14 -14
- polyaxon/_sdk/api/organizations_v1_api.py +97 -143
- polyaxon/_sdk/api/presets_v1_api.py +18 -26
- polyaxon/_sdk/api/project_dashboards_v1_api.py +17 -19
- polyaxon/_sdk/api/project_searches_v1_api.py +20 -28
- polyaxon/_sdk/api/projects_v1_api.py +74 -92
- polyaxon/_sdk/api/queues_v1_api.py +22 -30
- polyaxon/_sdk/api/runs_v1_api.py +157 -207
- polyaxon/_sdk/api/searches_v1_api.py +16 -20
- polyaxon/_sdk/api/service_accounts_v1_api.py +30 -38
- polyaxon/_sdk/api/tags_v1_api.py +19 -25
- polyaxon/_sdk/api/teams_v1_api.py +64 -90
- polyaxon/_sdk/api/users_v1_api.py +17 -19
- polyaxon/_sdk/api/versions_v1_api.py +4 -4
- polyaxon/_sdk/async_client/rest.py +1 -3
- polyaxon/_sdk/schemas/v1_section_spec.py +1 -1
- polyaxon/_sdk/sync_client/api_client.py +2 -6
- polyaxon/_sdk/sync_client/rest.py +4 -8
- polyaxon/pkg.py +1 -1
- {polyaxon-2.6.0rc1.dist-info → polyaxon-2.6.1.dist-info}/METADATA +6 -6
- {polyaxon-2.6.0rc1.dist-info → polyaxon-2.6.1.dist-info}/RECORD +87 -87
- {polyaxon-2.6.0rc1.dist-info → polyaxon-2.6.1.dist-info}/LICENSE +0 -0
- {polyaxon-2.6.0rc1.dist-info → polyaxon-2.6.1.dist-info}/WHEEL +0 -0
- {polyaxon-2.6.0rc1.dist-info → polyaxon-2.6.1.dist-info}/entry_points.txt +0 -0
- {polyaxon-2.6.0rc1.dist-info → polyaxon-2.6.1.dist-info}/top_level.txt +0 -0
polyaxon/_cli/operations.py
CHANGED
@@ -1466,7 +1466,7 @@ def logs(ctx, project, uid, follow, hide_time, all_containers, all_info, offline
|
|
1466
1466
|
)
|
1467
1467
|
|
1468
1468
|
try:
|
1469
|
-
from traceml.logging.streamer import
|
1469
|
+
from traceml.logging.streamer import load_logs_from_path
|
1470
1470
|
|
1471
1471
|
load_logs_from_path(
|
1472
1472
|
logs_path=logs_path,
|
polyaxon/_cli/projects.py
CHANGED
@@ -46,7 +46,7 @@ def project(ctx, _project): # pylint:disable=redefined-outer-name
|
|
46
46
|
@click.option(
|
47
47
|
*OPTIONS_NAME["args"],
|
48
48
|
type=str,
|
49
|
-
help="The project name, e.g. 'mnist' or 'acme/mnist'."
|
49
|
+
help="The project name, e.g. 'mnist' or 'acme/mnist'.",
|
50
50
|
)
|
51
51
|
@click.option("--description", type=str, help="Description of the project.")
|
52
52
|
@click.option("--tags", type=str, help="Tags of the project (comma separated values).")
|
@@ -287,7 +287,7 @@ def delete(ctx, _project, yes):
|
|
287
287
|
@click.option(
|
288
288
|
*OPTIONS_NAME["args"],
|
289
289
|
type=str,
|
290
|
-
help="Name of the project, must be unique for the same user."
|
290
|
+
help="Name of the project, must be unique for the same user.",
|
291
291
|
)
|
292
292
|
@click.option("--description", type=str, help="Description of the project.")
|
293
293
|
@click.option("--tags", type=str, help="Tags of the project (comma separated values).")
|
@@ -98,24 +98,24 @@ def resolve_globals_contexts(
|
|
98
98
|
run_outputs_path = ctx_paths.CONTEXT_MOUNT_RUN_OUTPUTS_FORMAT.format(run_path)
|
99
99
|
resolved_contexts[ctx_sections.GLOBALS][
|
100
100
|
ctx_keys.RUN_ARTIFACTS_PATH
|
101
|
-
] = run_artifacts_path
|
101
|
+
] = run_artifacts_path # fmt: skip
|
102
102
|
resolved_contexts[ctx_sections.GLOBALS][
|
103
103
|
ctx_keys.RUN_OUTPUTS_PATH
|
104
|
-
] = run_outputs_path
|
104
|
+
] = run_outputs_path # fmt: skip
|
105
105
|
elif artifacts_store:
|
106
106
|
run_artifacts_path = os.path.join(artifacts_store.store_path, run_path)
|
107
107
|
run_outputs_path = os.path.join(run_artifacts_path, "outputs")
|
108
108
|
resolved_contexts[ctx_sections.GLOBALS][
|
109
109
|
ctx_keys.RUN_ARTIFACTS_PATH
|
110
|
-
] = run_artifacts_path
|
110
|
+
] = run_artifacts_path # fmt: skip
|
111
111
|
resolved_contexts[ctx_sections.GLOBALS][
|
112
112
|
ctx_keys.RUN_OUTPUTS_PATH
|
113
|
-
] = run_outputs_path
|
113
|
+
] = run_outputs_path # fmt: skip
|
114
114
|
|
115
115
|
if plugins.mount_artifacts_store and artifacts_store:
|
116
116
|
resolved_contexts[ctx_sections.GLOBALS][
|
117
117
|
ctx_keys.STORE_PATH
|
118
|
-
] = artifacts_store.store_path
|
118
|
+
] = artifacts_store.store_path # fmt: skip
|
119
119
|
return resolved_contexts
|
120
120
|
|
121
121
|
|
@@ -21,7 +21,7 @@ class DaskJobContextsManager(BaseContextsManager):
|
|
21
21
|
) -> Dict:
|
22
22
|
contexts["init"] = {}
|
23
23
|
contexts["connections"] = {}
|
24
|
-
job = compiled_operation.run
|
24
|
+
job: V1DaskJob = compiled_operation.run
|
25
25
|
|
26
26
|
def _get_replica(replica: Optional[V1DaskReplica]) -> Dict:
|
27
27
|
if not replica:
|
@@ -21,7 +21,7 @@ class MPIJobContextsManager(BaseContextsManager):
|
|
21
21
|
) -> Dict:
|
22
22
|
contexts["init"] = {}
|
23
23
|
contexts["connections"] = {}
|
24
|
-
job = compiled_operation.run
|
24
|
+
job: V1MPIJob = compiled_operation.run
|
25
25
|
|
26
26
|
def _get_replica(replica: Optional[V1KFReplica]) -> Dict:
|
27
27
|
if not replica:
|
@@ -21,7 +21,7 @@ class MXJobContextsManager(BaseContextsManager):
|
|
21
21
|
) -> Dict:
|
22
22
|
contexts["init"] = {}
|
23
23
|
contexts["connections"] = {}
|
24
|
-
job = compiled_operation.run
|
24
|
+
job: V1MXJob = compiled_operation.run
|
25
25
|
|
26
26
|
def _get_replica(replica: Optional[V1KFReplica]) -> Dict:
|
27
27
|
if not replica:
|
@@ -21,7 +21,7 @@ class PaddleJobContextsManager(BaseContextsManager):
|
|
21
21
|
) -> Dict:
|
22
22
|
contexts["init"] = {}
|
23
23
|
contexts["connections"] = {}
|
24
|
-
job = compiled_operation.run
|
24
|
+
job: V1PaddleJob = compiled_operation.run
|
25
25
|
|
26
26
|
def _get_replica(replica: Optional[V1KFReplica]) -> Dict:
|
27
27
|
if not replica:
|
@@ -21,7 +21,7 @@ class PytorchJobContextsManager(BaseContextsManager):
|
|
21
21
|
) -> Dict:
|
22
22
|
contexts["init"] = {}
|
23
23
|
contexts["connections"] = {}
|
24
|
-
job = compiled_operation.run
|
24
|
+
job: V1PytorchJob = compiled_operation.run
|
25
25
|
|
26
26
|
def _get_replica(replica: Optional[V1KFReplica]) -> Dict:
|
27
27
|
if not replica:
|
@@ -21,7 +21,7 @@ class TfJobContextsManager(BaseContextsManager):
|
|
21
21
|
) -> Dict:
|
22
22
|
contexts["init"] = {}
|
23
23
|
contexts["connections"] = {}
|
24
|
-
job = compiled_operation.run
|
24
|
+
job: V1TFJob = compiled_operation.run
|
25
25
|
|
26
26
|
def _get_replica(replica: Optional[V1KFReplica]) -> Dict:
|
27
27
|
if not replica:
|
@@ -21,7 +21,7 @@ class XGBoostJobContextsManager(BaseContextsManager):
|
|
21
21
|
) -> Dict:
|
22
22
|
contexts["init"] = {}
|
23
23
|
contexts["connections"] = {}
|
24
|
-
job = compiled_operation.run
|
24
|
+
job: V1XGBoostJob = compiled_operation.run
|
25
25
|
|
26
26
|
def _get_replica(replica: Optional[V1KFReplica]) -> Dict:
|
27
27
|
if not replica:
|
@@ -21,7 +21,7 @@ class RayJobContextsManager(BaseContextsManager):
|
|
21
21
|
) -> Dict:
|
22
22
|
contexts["init"] = {}
|
23
23
|
contexts["connections"] = {}
|
24
|
-
job = compiled_operation.run
|
24
|
+
job: V1RayJob = compiled_operation.run
|
25
25
|
|
26
26
|
def _get_replica(replica: Optional[V1RayReplica]) -> Dict:
|
27
27
|
if not replica:
|
@@ -71,7 +71,7 @@ class AgentResolver(BaseSchemaModel):
|
|
71
71
|
if agent_config.artifacts_store: # Resolve default artifacts store
|
72
72
|
self.connection_by_names[
|
73
73
|
agent_config.artifacts_store.name
|
74
|
-
] = agent_config.artifacts_store
|
74
|
+
] = agent_config.artifacts_store # fmt: skip
|
75
75
|
|
76
76
|
if (
|
77
77
|
compiled_operation.is_job_run
|
polyaxon/_deploy/schemas/ui.py
CHANGED
@@ -13,4 +13,6 @@ class UIConfig(BaseSchemaModel):
|
|
13
13
|
assets_version: Optional[StrictStr] = Field(alias="assetsVersion", default=None)
|
14
14
|
admin_enabled: Optional[bool] = Field(alias="adminEnabled", default=None)
|
15
15
|
single_url: Optional[bool] = Field(alias="singleUrl", default=None)
|
16
|
-
default_streams_url: Optional[StrictStr] = Field(
|
16
|
+
default_streams_url: Optional[StrictStr] = Field(
|
17
|
+
alias="defaultStreamsUrl", default=None
|
18
|
+
)
|
@@ -162,7 +162,7 @@ class BaseConverter(
|
|
162
162
|
if memory:
|
163
163
|
docker_resources[
|
164
164
|
"memory"
|
165
|
-
] = docker_types.V1ResourceRequirements.from_k8s_memory(memory)
|
165
|
+
] = docker_types.V1ResourceRequirements.from_k8s_memory(memory) # fmt: skip
|
166
166
|
if gpus:
|
167
167
|
docker_resources["gpus"] = gpus
|
168
168
|
return docker_types.V1ResourceRequirements.from_dict(docker_resources)
|
@@ -18,7 +18,7 @@ class JobConverter(JobMixin, BaseConverter):
|
|
18
18
|
default_sa: Optional[str] = None,
|
19
19
|
default_auth: bool = False,
|
20
20
|
) -> List[docker_types.V1Container]:
|
21
|
-
job = compiled_operation.run
|
21
|
+
job: V1Job = compiled_operation.run
|
22
22
|
plugins = V1Plugins.get_or_create(
|
23
23
|
config=compiled_operation.plugins, auth=default_auth
|
24
24
|
)
|
@@ -4,7 +4,7 @@ from polyaxon._connections import V1Connection, V1ConnectionResource
|
|
4
4
|
from polyaxon._docker import docker_types
|
5
5
|
from polyaxon._docker.converter.base import BaseConverter
|
6
6
|
from polyaxon._docker.converter.mixins import ServiceMixin
|
7
|
-
from polyaxon._flow import V1CompiledOperation, V1Plugins
|
7
|
+
from polyaxon._flow import V1CompiledOperation, V1Plugins
|
8
8
|
|
9
9
|
|
10
10
|
class ServiceConverter(ServiceMixin, BaseConverter):
|
@@ -8,6 +8,7 @@ from clipped.compact.pydantic import (
|
|
8
8
|
validation_always,
|
9
9
|
validation_before,
|
10
10
|
)
|
11
|
+
from clipped.types import GenericStr
|
11
12
|
|
12
13
|
from polyaxon._k8s import k8s_schemas, k8s_validation
|
13
14
|
from polyaxon._schemas.base import BaseSchemaModel
|
@@ -395,9 +396,9 @@ class V1Environment(BaseSchemaModel):
|
|
395
396
|
"dnsConfig",
|
396
397
|
]
|
397
398
|
|
398
|
-
labels: Optional[Dict[StrictStr,
|
399
|
-
annotations: Optional[Dict[StrictStr,
|
400
|
-
node_selector: Optional[Dict[StrictStr,
|
399
|
+
labels: Optional[Dict[StrictStr, GenericStr]] = None
|
400
|
+
annotations: Optional[Dict[StrictStr, GenericStr]] = None
|
401
|
+
node_selector: Optional[Dict[StrictStr, GenericStr]] = Field(
|
401
402
|
alias="nodeSelector", default=None
|
402
403
|
)
|
403
404
|
affinity: Optional[Union[k8s_schemas.V1Affinity, Dict]] = None
|
@@ -428,7 +429,7 @@ class V1Environment(BaseSchemaModel):
|
|
428
429
|
priority: Optional[int] = None
|
429
430
|
restart_policy: Optional[
|
430
431
|
Literal["Always", "OnFailure", "Never", "ExitCode"]
|
431
|
-
] = Field(alias="restartPolicy", default=None)
|
432
|
+
] = Field(alias="restartPolicy", default=None) # fmt: skip
|
432
433
|
|
433
434
|
@field_validator("affinity", **validation_always, **validation_before)
|
434
435
|
def validate_affinity(cls, v):
|
polyaxon/_flow/io/io.py
CHANGED
polyaxon/_flow/matrix/params.py
CHANGED
@@ -1039,7 +1039,7 @@ class V1HpQLogUniform(BaseHpParamConfig):
|
|
1039
1039
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
1040
1040
|
value: Optional[
|
1041
1041
|
Union[QLogUniform, QLogUniformList, QLogUniformStr, RefField]
|
1042
|
-
] = None
|
1042
|
+
] = None # fmt: skip
|
1043
1043
|
|
1044
1044
|
@property
|
1045
1045
|
def is_distribution(self):
|
polyaxon/_flow/params/params.py
CHANGED
@@ -386,7 +386,7 @@ class V1Param(BaseSchemaModel, ctx_refs.RefMixin, ParamValueMixin):
|
|
386
386
|
|
387
387
|
_IDENTIFIER = "param"
|
388
388
|
|
389
|
-
value: Any
|
389
|
+
value: Optional[Any] = None
|
390
390
|
ref: Optional[StrictStr] = None
|
391
391
|
context_only: Optional[bool] = Field(alias="contextOnly", default=False)
|
392
392
|
connection: Optional[StrictStr] = None
|
@@ -479,7 +479,7 @@ class ParamSpec(
|
|
479
479
|
raise PolyaxonValidationError(
|
480
480
|
"Param `{}` with type `{}`, "
|
481
481
|
"cannot be turned to an init container automatically.".format(
|
482
|
-
self.name, self.type
|
482
|
+
self.name, self.type
|
483
483
|
)
|
484
484
|
)
|
485
485
|
|
polyaxon/_flow/run/dag.py
CHANGED
@@ -444,7 +444,7 @@ class V1Dag(BaseRun):
|
|
444
444
|
for g_context in ctx_sections.GLOBALS_CONTEXTS:
|
445
445
|
self._context[
|
446
446
|
"dag.{}.{}".format(ctx_sections.GLOBALS, g_context)
|
447
|
-
] = V1IO.construct(name=g_context, type="str", value="", is_optional=True)
|
447
|
+
] = V1IO.construct(name=g_context, type="str", value="", is_optional=True) # fmt: skip
|
448
448
|
|
449
449
|
self._context["dag.{}".format(ctx_sections.INPUTS)] = V1IO.construct(
|
450
450
|
name="inputs", type="dict", value={}, is_optional=True
|
@@ -541,19 +541,19 @@ class V1Dag(BaseRun):
|
|
541
541
|
# We allow to resolve name, status, project, all outputs/inputs, iteration
|
542
542
|
self._context[
|
543
543
|
"ops.{}.{}".format(op_name, ctx_sections.INPUTS)
|
544
|
-
] = V1IO.construct(name="inputs", type="dict", value={}, is_optional=True)
|
544
|
+
] = V1IO.construct(name="inputs", type="dict", value={}, is_optional=True) # fmt: skip
|
545
545
|
self._context[
|
546
546
|
"ops.{}.{}".format(op_name, ctx_sections.OUTPUTS)
|
547
|
-
] = V1IO.construct(name="outputs", type="dict", value={}, is_optional=True)
|
547
|
+
] = V1IO.construct(name="outputs", type="dict", value={}, is_optional=True) # fmt: skip
|
548
548
|
self._context[
|
549
549
|
"ops.{}.{}".format(op_name, ctx_sections.GLOBALS)
|
550
|
-
] = V1IO.construct(name="globals", type="str", value="", is_optional=True)
|
550
|
+
] = V1IO.construct(name="globals", type="str", value="", is_optional=True) # fmt: skip
|
551
551
|
self._context[
|
552
552
|
"ops.{}.{}".format(op_name, ctx_sections.ARTIFACTS)
|
553
|
-
] = V1IO.construct(name="artifacts", type="str", value="", is_optional=True)
|
553
|
+
] = V1IO.construct(name="artifacts", type="str", value="", is_optional=True) # fmt: skip
|
554
554
|
self._context[
|
555
555
|
"ops.{}.{}".format(op_name, ctx_sections.INPUTS_OUTPUTS)
|
556
|
-
] = V1IO.construct(name="io", type="str", value={}, is_optional=True)
|
556
|
+
] = V1IO.construct(name="io", type="str", value={}, is_optional=True) # fmt: skip
|
557
557
|
|
558
558
|
for op in self.operations:
|
559
559
|
if op.has_component_reference:
|
polyaxon/_flow/run/resources.py
CHANGED
polyaxon/_fs/fs.py
CHANGED
@@ -18,7 +18,7 @@ def _get_fs_from_connection(
|
|
18
18
|
connection: Optional[V1Connection],
|
19
19
|
asynchronous: bool = False,
|
20
20
|
use_listings_cache: bool = False,
|
21
|
-
**kwargs
|
21
|
+
**kwargs,
|
22
22
|
):
|
23
23
|
# We assume that `None` refers to local store as well
|
24
24
|
if not connection or connection.kind in {
|
@@ -73,7 +73,7 @@ class ContainerMixin(BaseConverter):
|
|
73
73
|
|
74
74
|
@staticmethod
|
75
75
|
def _sanitize_resources(
|
76
|
-
resources: Union[k8s_schemas.V1ResourceRequirements, Dict]
|
76
|
+
resources: Union[k8s_schemas.V1ResourceRequirements, Dict],
|
77
77
|
) -> Optional[k8s_schemas.V1ResourceRequirements]:
|
78
78
|
def validate_resources(r_field: Dict) -> Dict:
|
79
79
|
if not r_field:
|
@@ -20,7 +20,7 @@ class DaskJobConverter(DaskJobMixin, BaseConverter):
|
|
20
20
|
default_sa: Optional[str] = None,
|
21
21
|
default_auth: bool = False,
|
22
22
|
) -> Dict:
|
23
|
-
job = compiled_operation.run
|
23
|
+
job: V1DaskJob = compiled_operation.run
|
24
24
|
|
25
25
|
def _get_replica(replica: Optional[V1DaskReplica]) -> Optional[ReplicaSpec]:
|
26
26
|
if not replica:
|
@@ -18,7 +18,7 @@ class JobConverter(JobMixin, BaseConverter):
|
|
18
18
|
default_sa: Optional[str] = None,
|
19
19
|
default_auth: bool = False,
|
20
20
|
) -> Dict:
|
21
|
-
job = compiled_operation.run
|
21
|
+
job: V1Job = compiled_operation.run
|
22
22
|
plugins = V1Plugins.get_or_create(
|
23
23
|
config=compiled_operation.plugins, auth=default_auth
|
24
24
|
)
|
@@ -20,7 +20,7 @@ class MPIJobConverter(MPIJobMixin, BaseConverter):
|
|
20
20
|
default_sa: Optional[str] = None,
|
21
21
|
default_auth: bool = False,
|
22
22
|
) -> Dict:
|
23
|
-
job = compiled_operation.run
|
23
|
+
job: V1MPIJob = compiled_operation.run
|
24
24
|
|
25
25
|
def _get_replica(replica: Optional[V1KFReplica]) -> Optional[ReplicaSpec]:
|
26
26
|
if not replica:
|
@@ -20,7 +20,7 @@ class MXJobConverter(MXJobMixin, BaseConverter):
|
|
20
20
|
default_sa: Optional[str] = None,
|
21
21
|
default_auth: bool = False,
|
22
22
|
) -> Dict:
|
23
|
-
job = compiled_operation.run
|
23
|
+
job: V1MXJob = compiled_operation.run
|
24
24
|
|
25
25
|
def _get_replica(replica: Optional[V1KFReplica]) -> Optional[ReplicaSpec]:
|
26
26
|
if not replica:
|
@@ -20,7 +20,7 @@ class PaddleJobConverter(PaddleJobMixin, BaseConverter):
|
|
20
20
|
default_sa: Optional[str] = None,
|
21
21
|
default_auth: bool = False,
|
22
22
|
) -> Dict:
|
23
|
-
job = compiled_operation.run
|
23
|
+
job: V1PaddleJob = compiled_operation.run
|
24
24
|
|
25
25
|
def _get_replica(replica: Optional[V1KFReplica]) -> Optional[ReplicaSpec]:
|
26
26
|
if not replica:
|
@@ -20,7 +20,7 @@ class PytorchJobConverter(PytorchJobMixin, BaseConverter):
|
|
20
20
|
default_sa: Optional[str] = None,
|
21
21
|
default_auth: bool = False,
|
22
22
|
) -> Dict:
|
23
|
-
job = compiled_operation.run
|
23
|
+
job: V1PytorchJob = compiled_operation.run
|
24
24
|
|
25
25
|
def _get_replica(replica: Optional[V1KFReplica]) -> Optional[ReplicaSpec]:
|
26
26
|
if not replica:
|
@@ -20,7 +20,7 @@ class TfJobConverter(TFJobMixin, BaseConverter):
|
|
20
20
|
default_sa: Optional[str] = None,
|
21
21
|
default_auth: bool = False,
|
22
22
|
) -> Dict:
|
23
|
-
job = compiled_operation.run
|
23
|
+
job: V1TFJob = compiled_operation.run
|
24
24
|
|
25
25
|
def _get_replica(replica: Optional[V1KFReplica]) -> Optional[ReplicaSpec]:
|
26
26
|
if not replica:
|
@@ -20,7 +20,7 @@ class XGBoostJobConverter(XGBoostJobMixin, BaseConverter):
|
|
20
20
|
default_sa: Optional[str] = None,
|
21
21
|
default_auth: bool = False,
|
22
22
|
) -> Dict:
|
23
|
-
job = compiled_operation.run
|
23
|
+
job: V1XGBoostJob = compiled_operation.run
|
24
24
|
|
25
25
|
def _get_replica(replica: Optional[V1KFReplica]) -> Optional[ReplicaSpec]:
|
26
26
|
if not replica:
|
@@ -1,6 +1,5 @@
|
|
1
1
|
from typing import Dict, Iterable, Optional
|
2
2
|
|
3
|
-
from clipped.utils.encoding import encode
|
4
3
|
from clipped.utils.json import orjson_dumps
|
5
4
|
|
6
5
|
from polyaxon import pkg
|
@@ -23,7 +22,7 @@ class RayJobConverter(RayJobMixin, BaseConverter):
|
|
23
22
|
default_sa: Optional[str] = None,
|
24
23
|
default_auth: bool = False,
|
25
24
|
) -> Dict:
|
26
|
-
job = compiled_operation.run
|
25
|
+
job: V1RayJob = compiled_operation.run
|
27
26
|
|
28
27
|
def _get_replica(replica: Optional[V1RayReplica]) -> Optional[ReplicaSpec]:
|
29
28
|
if not replica:
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from typing import Dict, Iterable, Optional
|
2
2
|
|
3
3
|
from polyaxon._connections import V1Connection, V1ConnectionResource
|
4
|
-
from polyaxon._flow import V1CompiledOperation, V1Plugins
|
4
|
+
from polyaxon._flow import V1CompiledOperation, V1Plugins
|
5
5
|
from polyaxon._k8s.converter.base import BaseConverter
|
6
6
|
from polyaxon._k8s.converter.mixins import ServiceMixin
|
7
7
|
from polyaxon._k8s.custom_resources.service import get_service_custom_resource
|
polyaxon/_k8s/k8s_validation.py
CHANGED
@@ -24,13 +24,13 @@ def validate_k8s_affinity(value: Optional[Union[k8s_schemas.V1Affinity, Dict]]):
|
|
24
24
|
|
25
25
|
|
26
26
|
def validate_k8s_security_context(
|
27
|
-
value: Optional[Union[k8s_schemas.V1SecurityContext, Dict]]
|
27
|
+
value: Optional[Union[k8s_schemas.V1SecurityContext, Dict]],
|
28
28
|
):
|
29
29
|
return _validate_schema(value, k8s_schemas.V1SecurityContext)
|
30
30
|
|
31
31
|
|
32
32
|
def validate_k8s_pod_dns_config(
|
33
|
-
value: Optional[Union[k8s_schemas.V1PodDNSConfig, Dict]]
|
33
|
+
value: Optional[Union[k8s_schemas.V1PodDNSConfig, Dict]],
|
34
34
|
):
|
35
35
|
return _validate_schema(value, k8s_schemas.V1PodDNSConfig)
|
36
36
|
|
@@ -56,19 +56,19 @@ def validate_k8s_volume_mount(value: Optional[Union[k8s_schemas.V1VolumeMount, D
|
|
56
56
|
|
57
57
|
|
58
58
|
def validate_k8s_container_port(
|
59
|
-
value: Optional[Union[k8s_schemas.V1ContainerPort, Dict]]
|
59
|
+
value: Optional[Union[k8s_schemas.V1ContainerPort, Dict]],
|
60
60
|
):
|
61
61
|
return _validate_schema(value, k8s_schemas.V1ContainerPort)
|
62
62
|
|
63
63
|
|
64
64
|
def validate_k8s_resource_requirements(
|
65
|
-
value: Optional[Union[k8s_schemas.V1ResourceRequirements, Dict]]
|
65
|
+
value: Optional[Union[k8s_schemas.V1ResourceRequirements, Dict]],
|
66
66
|
):
|
67
67
|
return _validate_schema(value, k8s_schemas.V1ResourceRequirements)
|
68
68
|
|
69
69
|
|
70
70
|
def validate_k8s_env_from_source(
|
71
|
-
value: Optional[Union[k8s_schemas.V1EnvFromSource, Dict]]
|
71
|
+
value: Optional[Union[k8s_schemas.V1EnvFromSource, Dict]],
|
72
72
|
):
|
73
73
|
return _validate_schema(value, k8s_schemas.V1EnvFromSource)
|
74
74
|
|
@@ -78,25 +78,25 @@ def validate_k8s_volume(value: Optional[Union[k8s_schemas.V1Volume, Dict]]):
|
|
78
78
|
|
79
79
|
|
80
80
|
def validate_k8s_object_field_selector(
|
81
|
-
value: Optional[Union[k8s_schemas.V1ObjectFieldSelector, Dict]]
|
81
|
+
value: Optional[Union[k8s_schemas.V1ObjectFieldSelector, Dict]],
|
82
82
|
):
|
83
83
|
return _validate_schema(value, k8s_schemas.V1ObjectFieldSelector)
|
84
84
|
|
85
85
|
|
86
86
|
def validate_k8s_env_var_source(
|
87
|
-
value: Optional[Union[k8s_schemas.V1EnvVarSource, Dict]]
|
87
|
+
value: Optional[Union[k8s_schemas.V1EnvVarSource, Dict]],
|
88
88
|
):
|
89
89
|
return _validate_schema(value, k8s_schemas.V1EnvVarSource)
|
90
90
|
|
91
91
|
|
92
92
|
def validate_k8s_config_map_selector(
|
93
|
-
value: Optional[Union[k8s_schemas.V1ConfigMapKeySelector, Dict]]
|
93
|
+
value: Optional[Union[k8s_schemas.V1ConfigMapKeySelector, Dict]],
|
94
94
|
):
|
95
95
|
return _validate_schema(value, k8s_schemas.V1ConfigMapKeySelector)
|
96
96
|
|
97
97
|
|
98
98
|
def validate_k8s_secret_selector(
|
99
|
-
value: Optional[Union[k8s_schemas.V1SecretKeySelector, Dict]]
|
99
|
+
value: Optional[Union[k8s_schemas.V1SecretKeySelector, Dict]],
|
100
100
|
):
|
101
101
|
return _validate_schema(value, k8s_schemas.V1SecretKeySelector)
|
102
102
|
|
@@ -110,42 +110,42 @@ def validate_k8s_object_meta(value: Optional[Union[k8s_schemas.V1ObjectMeta, Dic
|
|
110
110
|
|
111
111
|
|
112
112
|
def validate_k8s_pod_template_spec(
|
113
|
-
value: Optional[Union[k8s_schemas.V1PodTemplateSpec, Dict]]
|
113
|
+
value: Optional[Union[k8s_schemas.V1PodTemplateSpec, Dict]],
|
114
114
|
):
|
115
115
|
return _validate_schema(value, k8s_schemas.V1PodTemplateSpec)
|
116
116
|
|
117
117
|
|
118
118
|
def validate_k8s_host_path_volume_source(
|
119
|
-
value: Optional[Union[k8s_schemas.V1HostPathVolumeSource, Dict]]
|
119
|
+
value: Optional[Union[k8s_schemas.V1HostPathVolumeSource, Dict]],
|
120
120
|
):
|
121
121
|
return _validate_schema(value, k8s_schemas.V1HostPathVolumeSource)
|
122
122
|
|
123
123
|
|
124
124
|
def validate_k8s_empty_dir_volume_source(
|
125
|
-
value: Optional[Union[k8s_schemas.V1EmptyDirVolumeSource, Dict]]
|
125
|
+
value: Optional[Union[k8s_schemas.V1EmptyDirVolumeSource, Dict]],
|
126
126
|
):
|
127
127
|
return _validate_schema(value, k8s_schemas.V1EmptyDirVolumeSource)
|
128
128
|
|
129
129
|
|
130
130
|
def validate_k8s_persistent_volume_claim_volume_source(
|
131
|
-
value: Optional[Union[k8s_schemas.V1PersistentVolumeClaimVolumeSource, Dict]]
|
131
|
+
value: Optional[Union[k8s_schemas.V1PersistentVolumeClaimVolumeSource, Dict]],
|
132
132
|
):
|
133
133
|
return _validate_schema(value, k8s_schemas.V1PersistentVolumeClaimVolumeSource)
|
134
134
|
|
135
135
|
|
136
136
|
def validate_k8s_secret_volume_source(
|
137
|
-
value: Optional[Union[k8s_schemas.V1SecretVolumeSource, Dict]]
|
137
|
+
value: Optional[Union[k8s_schemas.V1SecretVolumeSource, Dict]],
|
138
138
|
):
|
139
139
|
return _validate_schema(value, k8s_schemas.V1SecretVolumeSource)
|
140
140
|
|
141
141
|
|
142
142
|
def validate_k8s_config_map_volume_source(
|
143
|
-
value: Optional[Union[k8s_schemas.V1ConfigMapVolumeSource, Dict]]
|
143
|
+
value: Optional[Union[k8s_schemas.V1ConfigMapVolumeSource, Dict]],
|
144
144
|
):
|
145
145
|
return _validate_schema(value, k8s_schemas.V1ConfigMapVolumeSource)
|
146
146
|
|
147
147
|
|
148
148
|
def validate_k8s_local_object_reference(
|
149
|
-
value: Optional[Union[k8s_schemas.V1LocalObjectReference, Dict]]
|
149
|
+
value: Optional[Union[k8s_schemas.V1LocalObjectReference, Dict]],
|
150
150
|
):
|
151
151
|
return _validate_schema(value, k8s_schemas.V1LocalObjectReference)
|
@@ -203,7 +203,7 @@ async def get_op_spec(
|
|
203
203
|
for pod in pods or []:
|
204
204
|
pods_list[
|
205
205
|
pod.metadata.name
|
206
|
-
] = k8s_manager.api_client.sanitize_for_serialization(pod)
|
206
|
+
] = k8s_manager.api_client.sanitize_for_serialization(pod) # fmt: skip
|
207
207
|
pods_list[pod.metadata.name]["events"] = await get_resource_events(
|
208
208
|
k8s_manager=k8s_manager,
|
209
209
|
resource_type="Pod",
|
@@ -213,7 +213,7 @@ async def get_op_spec(
|
|
213
213
|
for service in services or []:
|
214
214
|
services_list[
|
215
215
|
service.metadata.name
|
216
|
-
] = k8s_manager.api_client.sanitize_for_serialization(service)
|
216
|
+
] = k8s_manager.api_client.sanitize_for_serialization(service) # fmt: skip
|
217
217
|
services_list[service.metadata.name]["events"] = await get_resource_events(
|
218
218
|
k8s_manager=k8s_manager,
|
219
219
|
resource_type="Service",
|
@@ -245,7 +245,7 @@ async def get_agent_spec(
|
|
245
245
|
for pod in pods or []:
|
246
246
|
pods_list[
|
247
247
|
pod.metadata.name
|
248
|
-
] = k8s_manager.api_client.sanitize_for_serialization(pod)
|
248
|
+
] = k8s_manager.api_client.sanitize_for_serialization(pod) # fmt: skip
|
249
249
|
pods_list[pod.metadata.name]["events"] = await get_resource_events(
|
250
250
|
k8s_manager=k8s_manager,
|
251
251
|
resource_type="Pod",
|
@@ -256,7 +256,7 @@ async def get_agent_spec(
|
|
256
256
|
for service in services or []:
|
257
257
|
services_list[
|
258
258
|
service.metadata.name
|
259
|
-
] = k8s_manager.api_client.sanitize_for_serialization(service)
|
259
|
+
] = k8s_manager.api_client.sanitize_for_serialization(service) # fmt: skip
|
260
260
|
services_list[service.metadata.name]["events"] = await get_resource_events(
|
261
261
|
k8s_manager=k8s_manager,
|
262
262
|
resource_type="Service",
|
@@ -62,7 +62,9 @@ class AsyncK8sManager(BaseK8sManager):
|
|
62
62
|
async def is_pod_running(
|
63
63
|
self, pod_id: str, container_id: str, namespace: str = None
|
64
64
|
) -> bool:
|
65
|
-
event = await self.k8s_api.read_namespaced_pod_status(
|
65
|
+
event = await self.k8s_api.read_namespaced_pod_status(
|
66
|
+
pod_id, namespace=namespace or self.namespace
|
67
|
+
) # type: ignore[attr-defined]
|
66
68
|
return is_pod_running(event, container_id)
|
67
69
|
|
68
70
|
async def _list_namespace_resource(
|
@@ -108,7 +110,7 @@ class AsyncK8sManager(BaseK8sManager):
|
|
108
110
|
plural,
|
109
111
|
reraise: bool = False,
|
110
112
|
namespace: str = None,
|
111
|
-
**kwargs
|
113
|
+
**kwargs,
|
112
114
|
) -> List:
|
113
115
|
return await self._list_namespace_resource(
|
114
116
|
resource_api=self.k8s_custom_object_api.list_namespaced_custom_object, # type: ignore[attr-defined]
|
@@ -273,7 +275,7 @@ class AsyncK8sManager(BaseK8sManager):
|
|
273
275
|
field_selector: str = None,
|
274
276
|
namespace: str = None,
|
275
277
|
reraise: bool = False,
|
276
|
-
**kwargs
|
278
|
+
**kwargs,
|
277
279
|
) -> List[client.CoreV1EventList]:
|
278
280
|
return await self._list_namespace_resource(
|
279
281
|
resource_api=self.k8s_api.list_namespaced_event, # type: ignore[attr-defined]
|