polyaxon 2.1.0rc9__py3-none-any.whl → 2.6.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/_auxiliaries/default_scheduling.py +17 -7
- polyaxon/_auxiliaries/init.py +14 -6
- polyaxon/_auxiliaries/sidecar.py +10 -8
- polyaxon/_cli/artifacts.py +96 -11
- polyaxon/_cli/components.py +96 -11
- polyaxon/_cli/config.py +31 -0
- polyaxon/_cli/dashboard.py +12 -2
- polyaxon/_cli/init.py +1 -1
- polyaxon/_cli/models.py +96 -11
- polyaxon/_cli/operations.py +133 -58
- polyaxon/_cli/project_versions.py +139 -6
- polyaxon/_cli/projects.py +23 -9
- polyaxon/_cli/run.py +43 -9
- polyaxon/_cli/services/agent.py +2 -2
- polyaxon/_cli/version.py +4 -1
- polyaxon/_client/mixin.py +39 -0
- polyaxon/_client/project.py +218 -23
- polyaxon/_client/run.py +84 -27
- polyaxon/_compiler/contexts/contexts.py +4 -0
- polyaxon/_compiler/contexts/ray_job.py +4 -2
- polyaxon/_compiler/resolver/agent.py +22 -10
- polyaxon/_compiler/resolver/runtime.py +7 -3
- polyaxon/_constants/metadata.py +1 -0
- polyaxon/_contexts/keys.py +1 -0
- polyaxon/_contexts/paths.py +1 -1
- polyaxon/_deploy/operators/compose.py +1 -27
- polyaxon/_deploy/schemas/auth.py +3 -3
- polyaxon/_deploy/schemas/celery.py +10 -8
- polyaxon/_deploy/schemas/deployment.py +148 -115
- polyaxon/_deploy/schemas/email.py +8 -8
- polyaxon/_deploy/schemas/ingress.py +7 -7
- polyaxon/_deploy/schemas/intervals.py +2 -7
- polyaxon/_deploy/schemas/operators.py +8 -8
- polyaxon/_deploy/schemas/proxy.py +9 -8
- polyaxon/_deploy/schemas/rbac.py +1 -1
- polyaxon/_deploy/schemas/root_user.py +5 -5
- polyaxon/_deploy/schemas/security_context.py +25 -15
- polyaxon/_deploy/schemas/service.py +75 -66
- polyaxon/_deploy/schemas/ssl.py +3 -3
- polyaxon/_deploy/schemas/ui.py +10 -6
- polyaxon/_docker/builder/builder.py +4 -1
- polyaxon/_docker/converter/base/containers.py +4 -7
- polyaxon/_docker/converter/base/env_vars.py +5 -5
- polyaxon/_docker/converter/base/mounts.py +2 -2
- polyaxon/_docker/docker_types.py +57 -30
- polyaxon/_env_vars/getters/owner_entity.py +4 -2
- polyaxon/_env_vars/getters/project.py +4 -2
- polyaxon/_env_vars/getters/run.py +5 -2
- polyaxon/_env_vars/keys.py +3 -0
- polyaxon/_flow/__init__.py +3 -2
- polyaxon/_flow/builds/__init__.py +8 -8
- polyaxon/_flow/cache/__init__.py +4 -4
- polyaxon/_flow/component/base.py +25 -18
- polyaxon/_flow/component/component.py +4 -3
- polyaxon/_flow/early_stopping/__init__.py +1 -1
- polyaxon/_flow/early_stopping/policies.py +12 -10
- polyaxon/_flow/environment/__init__.py +43 -25
- polyaxon/_flow/events/__init__.py +1 -1
- polyaxon/_flow/hooks/__init__.py +11 -11
- polyaxon/_flow/init/__init__.py +41 -25
- polyaxon/_flow/io/io.py +57 -47
- polyaxon/_flow/joins/__init__.py +5 -5
- polyaxon/_flow/matrix/bayes.py +23 -17
- polyaxon/_flow/matrix/grid_search.py +16 -7
- polyaxon/_flow/matrix/hyperband.py +10 -10
- polyaxon/_flow/matrix/hyperopt.py +14 -9
- polyaxon/_flow/matrix/iterative.py +14 -8
- polyaxon/_flow/matrix/mapping.py +4 -4
- polyaxon/_flow/matrix/params.py +138 -77
- polyaxon/_flow/matrix/random_search.py +10 -5
- polyaxon/_flow/matrix/tuner.py +4 -4
- polyaxon/_flow/mounts/artifacts_mounts.py +1 -1
- polyaxon/_flow/notifications/__init__.py +1 -1
- polyaxon/_flow/operations/base.py +10 -8
- polyaxon/_flow/operations/compiled_operation.py +5 -4
- polyaxon/_flow/operations/operation.py +57 -41
- polyaxon/_flow/optimization/__init__.py +2 -2
- polyaxon/_flow/params/params.py +10 -9
- polyaxon/_flow/plugins/__init__.py +19 -13
- polyaxon/_flow/run/dag.py +12 -9
- polyaxon/_flow/run/dask/dask.py +4 -4
- polyaxon/_flow/run/dask/replica.py +17 -11
- polyaxon/_flow/run/job.py +17 -11
- polyaxon/_flow/run/kubeflow/mpi_job.py +10 -5
- polyaxon/_flow/run/kubeflow/mx_job.py +25 -9
- polyaxon/_flow/run/kubeflow/paddle_job.py +16 -9
- polyaxon/_flow/run/kubeflow/pytorch_job.py +24 -17
- polyaxon/_flow/run/kubeflow/replica.py +17 -11
- polyaxon/_flow/run/kubeflow/scheduling_policy.py +7 -5
- polyaxon/_flow/run/kubeflow/tf_job.py +15 -8
- polyaxon/_flow/run/kubeflow/xgboost_job.py +9 -4
- polyaxon/_flow/run/ray/ray.py +9 -6
- polyaxon/_flow/run/ray/replica.py +25 -16
- polyaxon/_flow/run/resources.py +14 -13
- polyaxon/_flow/run/service.py +4 -4
- polyaxon/_flow/schedules/cron.py +4 -4
- polyaxon/_flow/schedules/interval.py +4 -4
- polyaxon/_flow/templates/__init__.py +3 -3
- polyaxon/_flow/termination/__init__.py +3 -3
- polyaxon/_fs/async_manager.py +1 -1
- polyaxon/_fs/fs.py +1 -1
- polyaxon/_fs/watcher.py +26 -27
- polyaxon/_k8s/converter/base/base.py +2 -1
- polyaxon/_k8s/converter/base/main.py +1 -0
- polyaxon/_k8s/converter/common/accelerators.py +7 -4
- polyaxon/_k8s/converter/converters/ray_job.py +4 -2
- polyaxon/_k8s/custom_resources/dask_job.py +3 -0
- polyaxon/_k8s/custom_resources/kubeflow/common.py +4 -1
- polyaxon/_k8s/custom_resources/ray_job.py +3 -0
- polyaxon/_k8s/custom_resources/setter.py +1 -1
- polyaxon/_k8s/executor/async_executor.py +2 -0
- polyaxon/_k8s/k8s_validation.py +1 -1
- polyaxon/_k8s/logging/async_monitor.py +82 -11
- polyaxon/_k8s/manager/async_manager.py +15 -0
- polyaxon/_k8s/manager/manager.py +16 -1
- polyaxon/_local_process/__init__.py +0 -0
- polyaxon/_local_process/agent.py +6 -0
- polyaxon/_local_process/converter/__init__.py +1 -0
- polyaxon/_local_process/converter/base/__init__.py +1 -0
- polyaxon/_local_process/converter/base/base.py +140 -0
- polyaxon/_local_process/converter/base/containers.py +66 -0
- polyaxon/_local_process/converter/base/env_vars.py +253 -0
- polyaxon/_local_process/converter/base/init.py +414 -0
- polyaxon/_local_process/converter/base/main.py +74 -0
- polyaxon/_local_process/converter/base/mounts.py +82 -0
- polyaxon/_local_process/converter/converters/__init__.py +8 -0
- polyaxon/_local_process/converter/converters/job.py +40 -0
- polyaxon/_local_process/converter/converters/service.py +41 -0
- polyaxon/_local_process/converter/mixins.py +38 -0
- polyaxon/_local_process/executor.py +132 -0
- polyaxon/_local_process/process_types.py +42 -0
- polyaxon/_polyaxonfile/specs/compiled_operation.py +1 -1
- polyaxon/_polyaxonfile/specs/libs/parser.py +1 -1
- polyaxon/_polyaxonfile/specs/libs/validator.py +1 -1
- polyaxon/_polyaxonfile/specs/operation.py +1 -1
- polyaxon/_polyaxonfile/specs/sections.py +8 -0
- polyaxon/_pql/manager.py +1 -1
- polyaxon/_runner/agent/async_agent.py +25 -11
- polyaxon/_runner/agent/base_agent.py +19 -10
- polyaxon/_runner/agent/sync_agent.py +24 -10
- polyaxon/_runner/converter/converter.py +12 -4
- polyaxon/_runner/executor.py +1 -1
- polyaxon/_schemas/agent.py +69 -37
- polyaxon/_schemas/authentication.py +4 -4
- polyaxon/_schemas/base.py +26 -2
- polyaxon/_schemas/checks.py +3 -3
- polyaxon/_schemas/cli.py +4 -6
- polyaxon/_schemas/client.py +20 -18
- polyaxon/_schemas/compatibility.py +4 -4
- polyaxon/_schemas/container_resources.py +1 -1
- polyaxon/_schemas/home.py +3 -3
- polyaxon/_schemas/installation.py +13 -9
- polyaxon/_schemas/lifecycle.py +23 -23
- polyaxon/_schemas/log_handler.py +2 -2
- polyaxon/_schemas/services.py +26 -14
- polyaxon/_schemas/types/artifacts.py +3 -3
- polyaxon/_schemas/types/dockerfile.py +14 -12
- polyaxon/_schemas/types/event.py +2 -2
- polyaxon/_schemas/types/file.py +3 -3
- polyaxon/_schemas/types/git.py +12 -4
- polyaxon/_schemas/types/tensorboard.py +14 -8
- polyaxon/_schemas/user.py +3 -3
- polyaxon/_schemas/version.py +2 -2
- polyaxon/_sdk/api/agents_v1_api.py +222 -43
- polyaxon/_sdk/api/artifacts_stores_v1_api.py +3 -3
- polyaxon/_sdk/api/auth_v1_api.py +13 -13
- polyaxon/_sdk/api/connections_v1_api.py +15 -15
- polyaxon/_sdk/api/dashboards_v1_api.py +15 -15
- polyaxon/_sdk/api/organizations_v1_api.py +85 -85
- polyaxon/_sdk/api/presets_v1_api.py +15 -15
- polyaxon/_sdk/api/project_dashboards_v1_api.py +29 -29
- polyaxon/_sdk/api/project_searches_v1_api.py +29 -29
- polyaxon/_sdk/api/projects_v1_api.py +284 -107
- polyaxon/_sdk/api/queues_v1_api.py +19 -19
- polyaxon/_sdk/api/runs_v1_api.py +313 -359
- polyaxon/_sdk/api/searches_v1_api.py +15 -15
- polyaxon/_sdk/api/service_accounts_v1_api.py +31 -31
- polyaxon/_sdk/api/tags_v1_api.py +17 -17
- polyaxon/_sdk/api/teams_v1_api.py +2854 -402
- polyaxon/_sdk/api/users_v1_api.py +254 -78
- polyaxon/_sdk/api/versions_v1_api.py +7 -7
- polyaxon/_sdk/async_client/api_client.py +4 -0
- polyaxon/_sdk/schemas/__init__.py +1 -1
- polyaxon/_sdk/schemas/v1_activity.py +8 -8
- polyaxon/_sdk/schemas/v1_agent.py +18 -16
- polyaxon/_sdk/schemas/v1_agent_state_response.py +4 -4
- polyaxon/_sdk/schemas/v1_agent_state_response_agent_state.py +10 -10
- polyaxon/_sdk/schemas/v1_agent_status_body_request.py +3 -3
- polyaxon/_sdk/schemas/v1_analytics_spec.py +4 -4
- polyaxon/_sdk/schemas/v1_artifact_tree.py +3 -3
- polyaxon/_sdk/schemas/v1_auth.py +1 -1
- polyaxon/_sdk/schemas/v1_cloning.py +3 -3
- polyaxon/_sdk/schemas/v1_connection_response.py +9 -9
- polyaxon/_sdk/schemas/v1_dashboard.py +9 -9
- polyaxon/_sdk/schemas/v1_dashboard_spec.py +5 -1
- polyaxon/_sdk/schemas/v1_entities_tags.py +2 -2
- polyaxon/_sdk/schemas/v1_entities_transfer.py +2 -2
- polyaxon/_sdk/schemas/v1_entity_notification_body.py +7 -7
- polyaxon/_sdk/schemas/v1_entity_stage_body_request.py +5 -5
- polyaxon/_sdk/schemas/v1_entity_status_body_request.py +5 -5
- polyaxon/_sdk/schemas/v1_events_response.py +2 -2
- polyaxon/_sdk/schemas/v1_list_activities_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_agents_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_bookmarks_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_connections_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_dashboards_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_organization_members_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_organizations_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_presets_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_project_versions_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_projects_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_queues_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_run_artifacts_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_run_connections_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_run_edges_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_runs_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_searches_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_service_accounts_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_tags_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_team_members_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_teams_response.py +4 -4
- polyaxon/_sdk/schemas/v1_list_token_response.py +4 -4
- polyaxon/_sdk/schemas/v1_operation_body.py +8 -8
- polyaxon/_sdk/schemas/v1_organization.py +16 -16
- polyaxon/_sdk/schemas/v1_organization_member.py +6 -6
- polyaxon/_sdk/schemas/v1_password_change.py +3 -3
- polyaxon/_sdk/schemas/v1_pipeline.py +3 -3
- polyaxon/_sdk/schemas/v1_preset.py +16 -9
- polyaxon/_sdk/schemas/v1_project.py +17 -17
- polyaxon/_sdk/schemas/v1_project_settings.py +12 -10
- polyaxon/_sdk/schemas/v1_project_version.py +20 -20
- polyaxon/_sdk/schemas/v1_queue.py +12 -12
- polyaxon/_sdk/schemas/v1_run.py +38 -38
- polyaxon/_sdk/schemas/v1_run_connection.py +3 -3
- polyaxon/_sdk/schemas/v1_run_edge.py +5 -5
- polyaxon/_sdk/schemas/v1_run_edge_lineage.py +3 -3
- polyaxon/_sdk/schemas/v1_run_edges_graph.py +1 -1
- polyaxon/_sdk/schemas/v1_run_reference_catalog.py +4 -4
- polyaxon/_sdk/schemas/v1_run_settings.py +9 -9
- polyaxon/_sdk/schemas/v1_search.py +10 -10
- polyaxon/_sdk/schemas/v1_search_spec.py +14 -14
- polyaxon/_sdk/schemas/v1_section_spec.py +12 -7
- polyaxon/_sdk/schemas/v1_service_account.py +9 -9
- polyaxon/_sdk/schemas/v1_settings_catalog.py +4 -3
- polyaxon/_sdk/schemas/v1_tag.py +6 -6
- polyaxon/_sdk/schemas/v1_team.py +11 -8
- polyaxon/_sdk/schemas/v1_team_member.py +6 -6
- polyaxon/_sdk/schemas/v1_team_settings.py +2 -2
- polyaxon/_sdk/schemas/v1_token.py +10 -10
- polyaxon/_sdk/schemas/v1_trial_start.py +6 -6
- polyaxon/_sdk/schemas/v1_user.py +6 -7
- polyaxon/_sdk/schemas/v1_user_access.py +17 -0
- polyaxon/_sdk/schemas/v1_user_email.py +1 -1
- polyaxon/_sdk/schemas/v1_user_singup.py +5 -5
- polyaxon/_sdk/schemas/v1_uuids.py +1 -1
- polyaxon/_sidecar/container/__init__.py +39 -20
- polyaxon/_sidecar/container/monitors/logs.py +10 -13
- polyaxon/_sidecar/ignore.py +0 -1
- polyaxon/_utils/cli_constants.py +2 -0
- polyaxon/_utils/fqn_utils.py +25 -2
- polyaxon/_utils/test_utils.py +2 -1
- polyaxon/pkg.py +1 -1
- polyaxon/schemas.py +1 -1
- {polyaxon-2.1.0rc9.dist-info → polyaxon-2.6.0.dist-info}/METADATA +43 -43
- {polyaxon-2.1.0rc9.dist-info → polyaxon-2.6.0.dist-info}/RECORD +269 -252
- {polyaxon-2.1.0rc9.dist-info → polyaxon-2.6.0.dist-info}/WHEEL +1 -1
- polyaxon/_sdk/schemas/v1_project_user_access.py +0 -10
- {polyaxon-2.1.0rc9.dist-info → polyaxon-2.6.0.dist-info}/LICENSE +0 -0
- {polyaxon-2.1.0rc9.dist-info → polyaxon-2.6.0.dist-info}/entry_points.txt +0 -0
- {polyaxon-2.1.0rc9.dist-info → polyaxon-2.6.0.dist-info}/top_level.txt +0 -0
@@ -19,8 +19,10 @@ class V1SchedulingPolicy(BaseSchemaModel):
|
|
19
19
|
|
20
20
|
_IDENTIFIER = "schedulingPolicy"
|
21
21
|
|
22
|
-
min_available: Optional[IntOrRef] = Field(alias="minAvailable")
|
23
|
-
queue: Optional[StrictStr]
|
24
|
-
min_resources: Optional[IntOrRef] = Field(alias="minResources")
|
25
|
-
priority_class: Optional[StrictStr] = Field(alias="priorityClass")
|
26
|
-
schedule_timeout_seconds: Optional[IntOrRef] = Field(
|
22
|
+
min_available: Optional[IntOrRef] = Field(alias="minAvailable", default=None)
|
23
|
+
queue: Optional[StrictStr] = Field(default=None)
|
24
|
+
min_resources: Optional[IntOrRef] = Field(alias="minResources", default=None)
|
25
|
+
priority_class: Optional[StrictStr] = Field(alias="priorityClass", default=None)
|
26
|
+
schedule_timeout_seconds: Optional[IntOrRef] = Field(
|
27
|
+
alias="scheduleTimeoutSeconds", default=None
|
28
|
+
)
|
@@ -169,16 +169,23 @@ class V1TFJob(BaseRun, DestinationImageMixin):
|
|
169
169
|
"""
|
170
170
|
|
171
171
|
_IDENTIFIER = V1RunKind.TFJOB
|
172
|
+
_CUSTOM_DUMP_FIELDS = {"chief", "ps", "worker", "evaluator"}
|
172
173
|
|
173
174
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
174
|
-
clean_pod_policy: Optional[V1CleanPodPolicy] = Field(
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
175
|
+
clean_pod_policy: Optional[V1CleanPodPolicy] = Field(
|
176
|
+
alias="cleanPodPolicy", default=None
|
177
|
+
)
|
178
|
+
scheduling_policy: Optional[V1SchedulingPolicy] = Field(
|
179
|
+
alias="schedulingPolicy", default=None
|
180
|
+
)
|
181
|
+
enable_dynamic_worker: Optional[bool] = Field(
|
182
|
+
alias="enableDynamicWorker", default=None
|
183
|
+
)
|
184
|
+
success_policy: Optional[str] = Field(alias="successPolicy", default=None)
|
185
|
+
chief: Optional[Union[V1KFReplica, RefField]] = None
|
186
|
+
ps: Optional[Union[V1KFReplica, RefField]] = None
|
187
|
+
worker: Optional[Union[V1KFReplica, RefField]] = None
|
188
|
+
evaluator: Optional[Union[V1KFReplica, RefField]] = None
|
182
189
|
|
183
190
|
def apply_image_destination(self, image: str):
|
184
191
|
if self.chief:
|
@@ -117,12 +117,17 @@ class V1XGBoostJob(BaseRun, DestinationImageMixin):
|
|
117
117
|
"""
|
118
118
|
|
119
119
|
_IDENTIFIER = V1RunKind.XGBJOB
|
120
|
+
_CUSTOM_DUMP_FIELDS = {"master", "worker"}
|
120
121
|
|
121
122
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
122
|
-
clean_pod_policy: Optional[V1CleanPodPolicy] = Field(
|
123
|
-
|
124
|
-
|
125
|
-
|
123
|
+
clean_pod_policy: Optional[V1CleanPodPolicy] = Field(
|
124
|
+
alias="cleanPodPolicy", default=None
|
125
|
+
)
|
126
|
+
scheduling_policy: Optional[V1SchedulingPolicy] = Field(
|
127
|
+
alias="schedulingPolicy", default=None
|
128
|
+
)
|
129
|
+
master: Optional[Union[V1KFReplica, RefField]] = None
|
130
|
+
worker: Optional[Union[V1KFReplica, RefField]] = None
|
126
131
|
|
127
132
|
def apply_image_destination(self, image: str):
|
128
133
|
if self.chief:
|
polyaxon/_flow/run/ray/ray.py
CHANGED
@@ -135,14 +135,17 @@ class V1RayJob(BaseRun, DestinationImageMixin):
|
|
135
135
|
"""
|
136
136
|
|
137
137
|
_IDENTIFIER = V1RunKind.RAYJOB
|
138
|
+
_CUSTOM_DUMP_FIELDS = {"head", "workers"}
|
138
139
|
|
139
140
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
140
|
-
entrypoint: Optional[str]
|
141
|
-
runtime_env: Optional[Union[Dict[str, Any], RefField]] = Field(
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
141
|
+
entrypoint: Optional[str] = None
|
142
|
+
runtime_env: Optional[Union[Dict[str, Any], RefField]] = Field(
|
143
|
+
alias="runtimeEnv", default=None
|
144
|
+
)
|
145
|
+
metadata: Optional[Union[Dict[str, str], RefField]] = Field(default=None)
|
146
|
+
ray_version: Optional[str] = Field(alias="rayVersion", default=None)
|
147
|
+
head: Optional[Union[V1RayReplica, RefField]] = None
|
148
|
+
workers: Optional[Dict[str, Union[V1RayReplica, RefField]]] = Field(default=None)
|
146
149
|
|
147
150
|
def apply_image_destination(self, image: str):
|
148
151
|
if self.head:
|
@@ -1,6 +1,12 @@
|
|
1
1
|
from typing import Dict, List, Optional, Union
|
2
2
|
|
3
|
-
from clipped.compact.pydantic import
|
3
|
+
from clipped.compact.pydantic import (
|
4
|
+
Field,
|
5
|
+
StrictStr,
|
6
|
+
field_validator,
|
7
|
+
validation_always,
|
8
|
+
validation_before,
|
9
|
+
)
|
4
10
|
from clipped.types.ref_or_obj import IntOrRef, RefField
|
5
11
|
|
6
12
|
from polyaxon._flow.environment import V1Environment
|
@@ -210,31 +216,34 @@ class V1RayReplica(BaseSchemaModel):
|
|
210
216
|
|
211
217
|
_IDENTIFIER = "replica"
|
212
218
|
_SWAGGER_FIELDS = ["volumes", "sidecars", "container"]
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
219
|
+
_CUSTOM_DUMP_FIELDS = {"environment"}
|
220
|
+
|
221
|
+
replicas: Optional[IntOrRef] = None
|
222
|
+
min_replicas: Optional[IntOrRef] = Field(alias="minReplicas", default=None)
|
223
|
+
max_replicas: Optional[IntOrRef] = Field(alias="maxReplicas", default=None)
|
224
|
+
ray_start_params: Optional[Dict[str, str]] = Field(
|
225
|
+
alias="rayStartParams", default=None
|
226
|
+
)
|
227
|
+
environment: Optional[Union[V1Environment, RefField]] = None
|
228
|
+
connections: Optional[Union[List[StrictStr], RefField]] = None
|
229
|
+
volumes: Optional[Union[List[k8s_schemas.V1Volume], RefField]] = None
|
230
|
+
init: Optional[Union[List[V1Init], RefField]] = None
|
231
|
+
sidecars: Optional[Union[List[k8s_schemas.V1Container], RefField]] = None
|
232
|
+
container: Optional[Union[k8s_schemas.V1Container, RefField]] = None
|
233
|
+
|
234
|
+
@field_validator("volumes", **validation_always, **validation_before)
|
226
235
|
def validate_volumes(cls, v):
|
227
236
|
if not v:
|
228
237
|
return v
|
229
238
|
return [k8s_validation.validate_k8s_volume(vi) for vi in v]
|
230
239
|
|
231
|
-
@
|
240
|
+
@field_validator("sidecars", **validation_always, **validation_before)
|
232
241
|
def validate_helper_containers(cls, v):
|
233
242
|
if not v:
|
234
243
|
return v
|
235
244
|
return [k8s_validation.validate_k8s_container(vi) for vi in v]
|
236
245
|
|
237
|
-
@
|
246
|
+
@field_validator("container", **validation_always, **validation_before)
|
238
247
|
def validate_container(cls, v):
|
239
248
|
return k8s_validation.validate_k8s_container(v)
|
240
249
|
|
polyaxon/_flow/run/resources.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Optional, Union
|
1
|
+
from typing import ClassVar, Optional, Set, Union
|
2
2
|
|
3
3
|
from clipped.compact.pydantic import StrictStr
|
4
4
|
from clipped.types.numbers import StrictIntOrFloat
|
@@ -9,18 +9,19 @@ from polyaxon._schemas.base import BaseSchemaModel
|
|
9
9
|
|
10
10
|
|
11
11
|
class V1RunResources(BaseSchemaModel):
|
12
|
-
cpu: Optional[Union[StrictIntOrFloat, StrictStr]]
|
13
|
-
memory: Optional[Union[StrictIntOrFloat, StrictStr]]
|
14
|
-
gpu: Optional[Union[StrictIntOrFloat, StrictStr]]
|
15
|
-
custom: Optional[Union[StrictIntOrFloat, StrictStr]]
|
16
|
-
cost: Optional[Union[StrictIntOrFloat, StrictStr]]
|
17
|
-
|
18
|
-
_MEMORY = "memory"
|
19
|
-
_CPU = "cpu"
|
20
|
-
_GPU = "gpu"
|
21
|
-
_CUSTOM_RESOURCE = "custom"
|
22
|
-
_COST = "cost"
|
23
|
-
|
12
|
+
cpu: Optional[Union[StrictIntOrFloat, StrictStr]] = None
|
13
|
+
memory: Optional[Union[StrictIntOrFloat, StrictStr]] = None
|
14
|
+
gpu: Optional[Union[StrictIntOrFloat, StrictStr]] = None
|
15
|
+
custom: Optional[Union[StrictIntOrFloat, StrictStr]] = None
|
16
|
+
cost: Optional[Union[StrictIntOrFloat, StrictStr]] = None
|
17
|
+
|
18
|
+
_MEMORY: ClassVar[str] = "memory"
|
19
|
+
_CPU: ClassVar[str] = "cpu"
|
20
|
+
_GPU: ClassVar[str] = "gpu"
|
21
|
+
_CUSTOM_RESOURCE: ClassVar[str] = "custom"
|
22
|
+
_COST: ClassVar[str] = "cost"
|
23
|
+
|
24
|
+
_VALUES: ClassVar[Set[str]] = {_MEMORY, _CPU, _GPU, _CUSTOM_RESOURCE, _COST}
|
24
25
|
|
25
26
|
@classmethod
|
26
27
|
def validate_memory(cls, value):
|
polyaxon/_flow/run/service.py
CHANGED
@@ -272,7 +272,7 @@ class V1Service(V1Job):
|
|
272
272
|
_IDENTIFIER = V1RunKind.SERVICE
|
273
273
|
|
274
274
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
275
|
-
ports: Optional[Union[List[StrictInt], RefField]]
|
276
|
-
rewrite_path: Optional[BoolOrRef] = Field(alias="rewritePath")
|
277
|
-
is_external: Optional[BoolOrRef] = Field(alias="isExternal")
|
278
|
-
replicas: Optional[IntOrRef]
|
275
|
+
ports: Optional[Union[List[StrictInt], RefField]] = None
|
276
|
+
rewrite_path: Optional[BoolOrRef] = Field(alias="rewritePath", default=None)
|
277
|
+
is_external: Optional[BoolOrRef] = Field(alias="isExternal", default=None)
|
278
|
+
replicas: Optional[IntOrRef] = None
|
polyaxon/_flow/schedules/cron.py
CHANGED
@@ -114,7 +114,7 @@ class V1CronSchedule(BaseSchemaModel):
|
|
114
114
|
|
115
115
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
116
116
|
cron: StrictStr
|
117
|
-
start_at: Optional[DatetimeOrRef] = Field(alias="startAt")
|
118
|
-
end_at: Optional[DatetimeOrRef] = Field(alias="endAt")
|
119
|
-
max_runs: Optional[IntOrRef] = Field(alias="maxRuns")
|
120
|
-
depends_on_past: Optional[BoolOrRef] = Field(alias="dependsOnPast")
|
117
|
+
start_at: Optional[DatetimeOrRef] = Field(alias="startAt", default=None)
|
118
|
+
end_at: Optional[DatetimeOrRef] = Field(alias="endAt", default=None)
|
119
|
+
max_runs: Optional[IntOrRef] = Field(alias="maxRuns", default=None)
|
120
|
+
depends_on_past: Optional[BoolOrRef] = Field(alias="dependsOnPast", default=None)
|
@@ -117,8 +117,8 @@ class V1IntervalSchedule(BaseSchemaModel):
|
|
117
117
|
_USE_DISCRIMINATOR = True
|
118
118
|
|
119
119
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
120
|
-
start_at: Optional[DatetimeOrRef] = Field(alias="startAt")
|
121
|
-
end_at: Optional[DatetimeOrRef] = Field(alias="endAt")
|
122
|
-
max_runs: Optional[IntOrRef] = Field(alias="maxRuns")
|
120
|
+
start_at: Optional[DatetimeOrRef] = Field(alias="startAt", default=None)
|
121
|
+
end_at: Optional[DatetimeOrRef] = Field(alias="endAt", default=None)
|
122
|
+
max_runs: Optional[IntOrRef] = Field(alias="maxRuns", default=None)
|
123
123
|
frequency: TimeDeltaOrRef
|
124
|
-
depends_on_past: Optional[BoolOrRef] = Field(alias="dependsOnPast")
|
124
|
+
depends_on_past: Optional[BoolOrRef] = Field(alias="dependsOnPast", default=None)
|
@@ -80,9 +80,9 @@ class V1Template(BaseSchemaModel):
|
|
80
80
|
|
81
81
|
_IDENTIFIER = "template"
|
82
82
|
|
83
|
-
enabled: Optional[BoolOrRef]
|
84
|
-
description: Optional[StrictStr]
|
85
|
-
fields: Optional[Union[List[StrictStr], RefField]]
|
83
|
+
enabled: Optional[BoolOrRef] = None
|
84
|
+
description: Optional[StrictStr] = None
|
85
|
+
fields: Optional[Union[List[StrictStr], RefField]] = None
|
86
86
|
|
87
87
|
|
88
88
|
class TemplateMixinConfig:
|
@@ -99,6 +99,6 @@ class V1Termination(BaseSchemaModel):
|
|
99
99
|
|
100
100
|
_IDENTIFIER = "termination"
|
101
101
|
|
102
|
-
max_retries: Optional[IntOrRef] = Field(alias="maxRetries")
|
103
|
-
ttl: Optional[IntOrRef]
|
104
|
-
timeout: Optional[IntOrRef]
|
102
|
+
max_retries: Optional[IntOrRef] = Field(alias="maxRetries", default=None)
|
103
|
+
ttl: Optional[IntOrRef] = None
|
104
|
+
timeout: Optional[IntOrRef] = None
|
polyaxon/_fs/async_manager.py
CHANGED
@@ -314,7 +314,7 @@ async def list_files(
|
|
314
314
|
|
315
315
|
|
316
316
|
async def delete_file_or_dir(
|
317
|
-
fs: FSSystem, store_path: str, subpath:
|
317
|
+
fs: FSSystem, store_path: str, subpath: Optional[str], is_file: bool
|
318
318
|
) -> bool:
|
319
319
|
try:
|
320
320
|
await ensure_async_execution(
|
polyaxon/_fs/fs.py
CHANGED
@@ -56,7 +56,7 @@ def _get_fs_from_connection(
|
|
56
56
|
|
57
57
|
async def get_async_fs_from_connection(connection: Optional[V1Connection], **kwargs):
|
58
58
|
fs = _get_fs_from_connection(connection=connection, asynchronous=True, **kwargs)
|
59
|
-
if fs
|
59
|
+
if hasattr(fs, "async_impl") and hasattr(fs, "set_session"):
|
60
60
|
await fs.set_session()
|
61
61
|
return fs
|
62
62
|
|
polyaxon/_fs/watcher.py
CHANGED
@@ -3,36 +3,43 @@ import os
|
|
3
3
|
from datetime import datetime
|
4
4
|
from typing import Dict, List, Optional, Set, Tuple
|
5
5
|
|
6
|
+
from clipped.compact.pydantic import PYDANTIC_VERSION
|
6
7
|
from clipped.utils.dates import path_last_modified
|
7
8
|
from clipped.utils.paths import get_files_and_dirs_in_path
|
8
9
|
|
9
10
|
from polyaxon._contexts import paths as ctx_paths
|
10
|
-
from polyaxon._schemas.base import BaseSchemaModel
|
11
|
+
from polyaxon._schemas.base import BaseSchemaModel, RootModel
|
11
12
|
|
12
13
|
|
13
|
-
class PathData(
|
14
|
-
|
14
|
+
class PathData(RootModel):
|
15
|
+
if PYDANTIC_VERSION.startswith("2."):
|
16
|
+
root: Tuple[str, datetime, str]
|
17
|
+
else:
|
18
|
+
__root__: Tuple[str, datetime, str]
|
15
19
|
|
16
|
-
class Config
|
20
|
+
class Config:
|
17
21
|
validate_assignment = False
|
18
22
|
|
19
23
|
@property
|
20
24
|
def base(self) -> str:
|
21
|
-
return self.
|
25
|
+
return self.get_root()[0]
|
22
26
|
|
23
27
|
@property
|
24
28
|
def ts(self) -> datetime:
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
root = self.get_root()
|
30
|
+
if isinstance(root[1], str):
|
31
|
+
self.set_root(
|
32
|
+
(
|
33
|
+
root[0],
|
34
|
+
datetime.fromisoformat(root[1]),
|
35
|
+
root[1],
|
36
|
+
)
|
30
37
|
)
|
31
|
-
return
|
38
|
+
return root[1]
|
32
39
|
|
33
40
|
@property
|
34
41
|
def op(self) -> str:
|
35
|
-
return self.
|
42
|
+
return self.get_root()[2]
|
36
43
|
|
37
44
|
|
38
45
|
class FSWatcher(BaseSchemaModel):
|
@@ -42,8 +49,8 @@ class FSWatcher(BaseSchemaModel):
|
|
42
49
|
_RM = "rm"
|
43
50
|
_NOOP = ""
|
44
51
|
|
45
|
-
dir_mapping: Optional[Dict[str, PathData]]
|
46
|
-
file_mapping: Optional[Dict[str, PathData]]
|
52
|
+
dir_mapping: Optional[Dict[str, PathData]] = None
|
53
|
+
file_mapping: Optional[Dict[str, PathData]] = None
|
47
54
|
|
48
55
|
@property
|
49
56
|
def dirs_mp(self) -> Dict[str, PathData]:
|
@@ -71,17 +78,11 @@ class FSWatcher(BaseSchemaModel):
|
|
71
78
|
data = mapping.get(rel_path)
|
72
79
|
if data:
|
73
80
|
if current_ts > data.ts:
|
74
|
-
mapping[rel_path] = PathData.
|
75
|
-
__root__=(base_path, current_ts, self._PUT)
|
76
|
-
)
|
81
|
+
mapping[rel_path] = PathData.make((base_path, current_ts, self._PUT))
|
77
82
|
else:
|
78
|
-
mapping[rel_path] = PathData.
|
79
|
-
__root__=(base_path, data.ts, self._NOOP)
|
80
|
-
)
|
83
|
+
mapping[rel_path] = PathData.make((base_path, data.ts, self._NOOP))
|
81
84
|
else:
|
82
|
-
mapping[rel_path] = PathData.
|
83
|
-
__root__=(base_path, current_ts, self._PUT)
|
84
|
-
)
|
85
|
+
mapping[rel_path] = PathData.make((base_path, current_ts, self._PUT))
|
85
86
|
return mapping
|
86
87
|
|
87
88
|
def sync_file(self, path: str, base_path: str):
|
@@ -92,12 +93,10 @@ class FSWatcher(BaseSchemaModel):
|
|
92
93
|
|
93
94
|
def init(self):
|
94
95
|
self.dir_mapping = {
|
95
|
-
p: PathData.
|
96
|
-
for p, d in self.dirs_mp.items()
|
96
|
+
p: PathData.make((d.base, d.ts, self._RM)) for p, d in self.dirs_mp.items()
|
97
97
|
}
|
98
98
|
self.file_mapping = {
|
99
|
-
p: PathData.
|
100
|
-
for p, d in self.files_mp.items()
|
99
|
+
p: PathData.make((d.base, d.ts, self._RM)) for p, d in self.files_mp.items()
|
101
100
|
}
|
102
101
|
|
103
102
|
def sync(self, path: str, exclude: Optional[List[str]] = None):
|
@@ -2,6 +2,7 @@ import copy
|
|
2
2
|
|
3
3
|
from typing import Dict, Iterable, List, Optional
|
4
4
|
|
5
|
+
from clipped.utils.enums import get_enum_value
|
5
6
|
from clipped.utils.sanitizers import sanitize_string_dict
|
6
7
|
from clipped.utils.strings import slugify
|
7
8
|
|
@@ -85,7 +86,7 @@ class BaseConverter(
|
|
85
86
|
"operation.polyaxon.com/name": self.run_name,
|
86
87
|
"operation.polyaxon.com/owner": self.owner_name,
|
87
88
|
"operation.polyaxon.com/project": self.project_name,
|
88
|
-
"operation.polyaxon.com/kind": self.K8S_ANNOTATIONS_KIND,
|
89
|
+
"operation.polyaxon.com/kind": get_enum_value(self.K8S_ANNOTATIONS_KIND),
|
89
90
|
}
|
90
91
|
|
91
92
|
def get_annotations(
|
@@ -37,14 +37,17 @@ def requests_gpu(resources: k8s_schemas.V1ResourceRequirements) -> bool:
|
|
37
37
|
if not resources:
|
38
38
|
return False
|
39
39
|
|
40
|
+
if not isinstance(resources, k8s_schemas.V1ResourceRequirements):
|
41
|
+
resources = k8s_schemas.V1ResourceRequirements(**resources)
|
42
|
+
|
40
43
|
if resources.requests:
|
41
|
-
for key in resources.requests.
|
42
|
-
if "gpu" in key:
|
44
|
+
for key, val in resources.requests.items():
|
45
|
+
if "gpu" in key and val is not None and val > 0:
|
43
46
|
return True
|
44
47
|
|
45
48
|
if resources.limits:
|
46
|
-
for key in resources.limits.
|
47
|
-
if "gpu" in key:
|
49
|
+
for key, val in resources.limits.items():
|
50
|
+
if "gpu" in key and val is not None and val > 0:
|
48
51
|
return True
|
49
52
|
|
50
53
|
return False
|
@@ -58,7 +58,9 @@ class RayJobConverter(RayJobMixin, BaseConverter):
|
|
58
58
|
config=compiled_operation.plugins, auth=default_auth
|
59
59
|
)
|
60
60
|
head = _get_replica(job.head)
|
61
|
-
workers =
|
61
|
+
workers = None
|
62
|
+
if job.workers:
|
63
|
+
workers = {n: _get_replica(w) for n, w in job.workers.items()}
|
62
64
|
labels = self.get_labels(version=pkg.VERSION, labels={})
|
63
65
|
|
64
66
|
return get_ray_job_custom_resource(
|
@@ -68,7 +70,7 @@ class RayJobConverter(RayJobMixin, BaseConverter):
|
|
68
70
|
workers=workers,
|
69
71
|
entrypoint=job.entrypoint,
|
70
72
|
metadata=job.metadata,
|
71
|
-
runtime_env=
|
73
|
+
runtime_env=orjson_dumps(job.runtime_env),
|
72
74
|
ray_version=job.ray_version,
|
73
75
|
termination=compiled_operation.termination,
|
74
76
|
collect_logs=plugins.collect_logs,
|
@@ -46,6 +46,9 @@ def get_dask_replicas_template(
|
|
46
46
|
if liveness_probe and replica.main_container.liveness_probe is None:
|
47
47
|
replica.main_container.liveness_probe = liveness_probe
|
48
48
|
|
49
|
+
labels = {**labels, **replica.labels}
|
50
|
+
annotations = {**annotations, **replica.annotations}
|
51
|
+
|
49
52
|
metadata, pod_spec = get_pod_spec(
|
50
53
|
namespace=namespace,
|
51
54
|
main_container=replica.main_container,
|
@@ -16,6 +16,9 @@ def get_kf_replicas_template(
|
|
16
16
|
if not replica:
|
17
17
|
return
|
18
18
|
|
19
|
+
labels = {**labels, **replica.labels}
|
20
|
+
annotations = {**annotations, **replica.annotations}
|
21
|
+
|
19
22
|
metadata, pod_spec = get_pod_spec(
|
20
23
|
namespace=namespace,
|
21
24
|
main_container=replica.main_container,
|
@@ -30,6 +33,6 @@ def get_kf_replicas_template(
|
|
30
33
|
|
31
34
|
template_spec[replica_name] = {
|
32
35
|
"replicas": replica.num_replicas,
|
33
|
-
"restartPolicy": pod_spec.restart_policy or "
|
36
|
+
"restartPolicy": pod_spec.restart_policy or "OnFailure",
|
34
37
|
"template": get_pod_template_spec(metadata=metadata, pod_spec=pod_spec),
|
35
38
|
}
|
@@ -26,6 +26,9 @@ def _get_ray_replicas_template(
|
|
26
26
|
if not replica:
|
27
27
|
return
|
28
28
|
|
29
|
+
labels = {**labels, **replica.labels}
|
30
|
+
annotations = {**annotations, **replica.annotations}
|
31
|
+
|
29
32
|
metadata, pod_spec = get_pod_spec(
|
30
33
|
namespace=namespace,
|
31
34
|
main_container=replica.main_container,
|
@@ -46,7 +46,7 @@ def set_notify(custom_object: Dict, notifications: List[V1Notification]) -> Dict
|
|
46
46
|
def set_clean_pod_policy(template_spec: Dict, clean_pod_policy: str) -> Dict:
|
47
47
|
if not clean_pod_policy:
|
48
48
|
# Sets default clean pod policy
|
49
|
-
clean_pod_policy = "
|
49
|
+
clean_pod_policy = "None"
|
50
50
|
|
51
51
|
template_spec["cleanPodPolicy"] = clean_pod_policy.capitalize()
|
52
52
|
return template_spec
|
polyaxon/_k8s/k8s_validation.py
CHANGED
@@ -14,7 +14,7 @@ def _validate_schema(value: Optional[Union[Swagger, Dict]], cls: Type[Swagger]):
|
|
14
14
|
return cls(**{to_snake_case(k): value[k] for k in value})
|
15
15
|
if isinstance(value, cls):
|
16
16
|
return value
|
17
|
-
raise
|
17
|
+
raise ValueError(
|
18
18
|
"This field expects a dict or an instance of {}.".format(cls.__name__)
|
19
19
|
)
|
20
20
|
|