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
polyaxon/_flow/matrix/params.py
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
from datetime import date, datetime, timedelta
|
2
|
-
from typing import TYPE_CHECKING, Any, List, Optional, Union
|
2
|
+
from typing import TYPE_CHECKING, Any, ClassVar, List, Optional, Union
|
3
3
|
from typing_extensions import Annotated, Literal
|
4
4
|
|
5
|
-
from clipped.compact.pydantic import
|
5
|
+
from clipped.compact.pydantic import (
|
6
|
+
PYDANTIC_VERSION,
|
7
|
+
Field,
|
8
|
+
StrictStr,
|
9
|
+
field_validator,
|
10
|
+
model_validator,
|
11
|
+
validation_after,
|
12
|
+
)
|
6
13
|
from clipped.config.schema import skip_partial
|
7
14
|
from clipped.types.numbers import StrictIntOrFloat
|
8
15
|
from clipped.types.ref_or_obj import RefField
|
@@ -30,9 +37,25 @@ def validate_pchoice(values):
|
|
30
37
|
|
31
38
|
|
32
39
|
class PChoice(tuple):
|
33
|
-
|
34
|
-
|
35
|
-
|
40
|
+
if PYDANTIC_VERSION.startswith("2."):
|
41
|
+
from pydantic_core import core_schema
|
42
|
+
|
43
|
+
@classmethod
|
44
|
+
def __get_pydantic_core_schema__(
|
45
|
+
cls, *args, **kwargs
|
46
|
+
) -> core_schema.CoreSchema:
|
47
|
+
from pydantic_core import core_schema
|
48
|
+
|
49
|
+
return core_schema.no_info_after_validator_function(
|
50
|
+
cls.validate,
|
51
|
+
core_schema.any_schema(),
|
52
|
+
)
|
53
|
+
|
54
|
+
else:
|
55
|
+
|
56
|
+
@classmethod
|
57
|
+
def __get_validators__(cls) -> "CallableGenerator":
|
58
|
+
yield cls.validate
|
36
59
|
|
37
60
|
@classmethod
|
38
61
|
def validate(cls, value):
|
@@ -70,13 +93,16 @@ def _validate_range(
|
|
70
93
|
|
71
94
|
|
72
95
|
class BaseRange(BaseSchemaModel):
|
73
|
-
_REQUIRED_KEYS = []
|
74
|
-
_OPTIONAL_KEYS = []
|
75
|
-
_CHECK_ORDER = True
|
96
|
+
_REQUIRED_KEYS: ClassVar[str] = []
|
97
|
+
_OPTIONAL_KEYS: ClassVar[str] = []
|
98
|
+
_CHECK_ORDER: ClassVar[bool] = True
|
76
99
|
|
77
|
-
@
|
100
|
+
@model_validator(**validation_after)
|
78
101
|
def validate_range(cls, values):
|
79
|
-
|
102
|
+
if hasattr(values, "to_dict"):
|
103
|
+
value = list(values.to_dict().values())
|
104
|
+
else:
|
105
|
+
value = list(values.values())
|
80
106
|
_validate_range(
|
81
107
|
value,
|
82
108
|
cls._REQUIRED_KEYS,
|
@@ -90,15 +116,31 @@ class Range(BaseRange):
|
|
90
116
|
start: Union[float]
|
91
117
|
stop: Union[float]
|
92
118
|
step: StrictIntOrFloat
|
93
|
-
_REQUIRED_KEYS = ["start", "stop", "step"]
|
119
|
+
_REQUIRED_KEYS: ClassVar[str] = ["start", "stop", "step"]
|
94
120
|
|
95
121
|
|
96
122
|
class RangeStr(StrictStr):
|
97
123
|
_CLASS = Range
|
98
124
|
|
99
|
-
|
100
|
-
|
101
|
-
|
125
|
+
if PYDANTIC_VERSION.startswith("2."):
|
126
|
+
from pydantic_core import core_schema
|
127
|
+
|
128
|
+
@classmethod
|
129
|
+
def __get_pydantic_core_schema__(
|
130
|
+
cls, *args, **kwargs
|
131
|
+
) -> core_schema.CoreSchema:
|
132
|
+
from pydantic_core import core_schema
|
133
|
+
|
134
|
+
return core_schema.no_info_after_validator_function(
|
135
|
+
cls.validate,
|
136
|
+
core_schema.str_schema(strict=True),
|
137
|
+
)
|
138
|
+
|
139
|
+
else:
|
140
|
+
|
141
|
+
@classmethod
|
142
|
+
def __get_validators__(cls) -> "CallableGenerator":
|
143
|
+
yield cls.validate
|
102
144
|
|
103
145
|
@classmethod
|
104
146
|
def validate(cls, value: str):
|
@@ -119,11 +161,28 @@ class RangeStr(StrictStr):
|
|
119
161
|
|
120
162
|
|
121
163
|
class RangeList(list):
|
122
|
-
_CLASS = Range
|
164
|
+
_CLASS: ClassVar = Range
|
123
165
|
|
124
|
-
|
125
|
-
|
126
|
-
|
166
|
+
if PYDANTIC_VERSION.startswith("2."):
|
167
|
+
from pydantic import GetCoreSchemaHandler
|
168
|
+
from pydantic_core import core_schema
|
169
|
+
|
170
|
+
@classmethod
|
171
|
+
def __get_pydantic_core_schema__(
|
172
|
+
cls, source_type: Any, handler: GetCoreSchemaHandler
|
173
|
+
) -> core_schema.CoreSchema:
|
174
|
+
from pydantic_core import core_schema
|
175
|
+
|
176
|
+
return core_schema.no_info_after_validator_function(
|
177
|
+
cls.validate,
|
178
|
+
core_schema.list_schema(),
|
179
|
+
)
|
180
|
+
|
181
|
+
else:
|
182
|
+
|
183
|
+
@classmethod
|
184
|
+
def __get_validators__(cls) -> "CallableGenerator":
|
185
|
+
yield cls.validate
|
127
186
|
|
128
187
|
@classmethod
|
129
188
|
def validate(cls, value: List):
|
@@ -149,7 +208,7 @@ class DateRange(Range):
|
|
149
208
|
|
150
209
|
|
151
210
|
class DateRangeList(RangeList):
|
152
|
-
_CLASS = DateRange
|
211
|
+
_CLASS: ClassVar = DateRange
|
153
212
|
|
154
213
|
|
155
214
|
class DateTimeRange(Range):
|
@@ -159,14 +218,14 @@ class DateTimeRange(Range):
|
|
159
218
|
|
160
219
|
|
161
220
|
class DateTimeRangeList(RangeList):
|
162
|
-
_CLASS = DateTimeRange
|
221
|
+
_CLASS: ClassVar = DateTimeRange
|
163
222
|
|
164
223
|
|
165
224
|
class Space(BaseRange):
|
166
225
|
start: Union[float]
|
167
226
|
stop: Union[float]
|
168
227
|
num: int
|
169
|
-
_REQUIRED_KEYS = ["start", "stop", "num"]
|
228
|
+
_REQUIRED_KEYS: ClassVar[str] = ["start", "stop", "num"]
|
170
229
|
|
171
230
|
|
172
231
|
class LinSpace(Space):
|
@@ -174,11 +233,11 @@ class LinSpace(Space):
|
|
174
233
|
|
175
234
|
|
176
235
|
class LinSpaceList(RangeList):
|
177
|
-
_CLASS = LinSpace
|
236
|
+
_CLASS: ClassVar = LinSpace
|
178
237
|
|
179
238
|
|
180
239
|
class LinSpaceStr(RangeStr):
|
181
|
-
_CLASS = LinSpace
|
240
|
+
_CLASS: ClassVar = LinSpace
|
182
241
|
|
183
242
|
|
184
243
|
class GeomSpace(Space):
|
@@ -186,43 +245,43 @@ class GeomSpace(Space):
|
|
186
245
|
|
187
246
|
|
188
247
|
class GeomSpaceList(RangeList):
|
189
|
-
_CLASS = GeomSpace
|
248
|
+
_CLASS: ClassVar = GeomSpace
|
190
249
|
|
191
250
|
|
192
251
|
class GeomSpaceStr(RangeStr):
|
193
|
-
_CLASS = GeomSpace
|
252
|
+
_CLASS: ClassVar = GeomSpace
|
194
253
|
|
195
254
|
|
196
255
|
class LogSpace(Space):
|
197
|
-
base: Optional[int]
|
198
|
-
_OPTIONAL_KEYS = ["base"]
|
256
|
+
base: Optional[int] = None
|
257
|
+
_OPTIONAL_KEYS: ClassVar[str] = ["base"]
|
199
258
|
|
200
259
|
|
201
260
|
class LogSpaceList(RangeList):
|
202
|
-
_CLASS = LogSpace
|
261
|
+
_CLASS: ClassVar = LogSpace
|
203
262
|
|
204
263
|
|
205
264
|
class LogSpaceStr(RangeStr):
|
206
|
-
_CLASS = LogSpace
|
265
|
+
_CLASS: ClassVar = LogSpace
|
207
266
|
|
208
267
|
|
209
268
|
class Dist(BaseRange):
|
210
269
|
low: Union[float]
|
211
270
|
high: Union[float]
|
212
|
-
size: Optional[int]
|
213
|
-
_REQUIRED_KEYS = ["low", "high"]
|
214
|
-
_OPTIONAL_KEYS = ["size"]
|
215
|
-
_CHECK_ORDER = False
|
271
|
+
size: Optional[int] = None
|
272
|
+
_REQUIRED_KEYS: ClassVar[str] = ["low", "high"]
|
273
|
+
_OPTIONAL_KEYS: ClassVar[str] = ["size"]
|
274
|
+
_CHECK_ORDER: ClassVar[bool] = False
|
216
275
|
|
217
276
|
|
218
277
|
class QDist(BaseRange):
|
219
278
|
low: Union[float]
|
220
279
|
high: Union[float]
|
221
280
|
q: StrictIntOrFloat
|
222
|
-
size: Optional[int]
|
223
|
-
_REQUIRED_KEYS = ["low", "high", "q"]
|
224
|
-
_OPTIONAL_KEYS = ["size"]
|
225
|
-
_CHECK_ORDER = False
|
281
|
+
size: Optional[int] = None
|
282
|
+
_REQUIRED_KEYS: ClassVar[str] = ["low", "high", "q"]
|
283
|
+
_OPTIONAL_KEYS: ClassVar[str] = ["size"]
|
284
|
+
_CHECK_ORDER: ClassVar[bool] = False
|
226
285
|
|
227
286
|
|
228
287
|
class Uniform(Dist):
|
@@ -230,11 +289,11 @@ class Uniform(Dist):
|
|
230
289
|
|
231
290
|
|
232
291
|
class UniformList(RangeList):
|
233
|
-
_CLASS = Uniform
|
292
|
+
_CLASS: ClassVar = Uniform
|
234
293
|
|
235
294
|
|
236
295
|
class UniformStr(RangeStr):
|
237
|
-
_CLASS = Uniform
|
296
|
+
_CLASS: ClassVar = Uniform
|
238
297
|
|
239
298
|
|
240
299
|
class QUniform(QDist):
|
@@ -242,11 +301,11 @@ class QUniform(QDist):
|
|
242
301
|
|
243
302
|
|
244
303
|
class QUniformList(RangeList):
|
245
|
-
_CLASS = QUniform
|
304
|
+
_CLASS: ClassVar = QUniform
|
246
305
|
|
247
306
|
|
248
307
|
class QUniformStr(RangeStr):
|
249
|
-
_CLASS = QUniform
|
308
|
+
_CLASS: ClassVar = QUniform
|
250
309
|
|
251
310
|
|
252
311
|
class LogUniform(Dist):
|
@@ -254,11 +313,11 @@ class LogUniform(Dist):
|
|
254
313
|
|
255
314
|
|
256
315
|
class LogUniformList(RangeList):
|
257
|
-
_CLASS = LogUniform
|
316
|
+
_CLASS: ClassVar = LogUniform
|
258
317
|
|
259
318
|
|
260
319
|
class LogUniformStr(RangeStr):
|
261
|
-
_CLASS = LogUniform
|
320
|
+
_CLASS: ClassVar = LogUniform
|
262
321
|
|
263
322
|
|
264
323
|
class QLogUniform(QDist):
|
@@ -266,46 +325,46 @@ class QLogUniform(QDist):
|
|
266
325
|
|
267
326
|
|
268
327
|
class QLogUniformList(RangeList):
|
269
|
-
_CLASS = QLogUniform
|
328
|
+
_CLASS: ClassVar = QLogUniform
|
270
329
|
|
271
330
|
|
272
331
|
class QLogUniformStr(RangeStr):
|
273
|
-
_CLASS = QLogUniform
|
332
|
+
_CLASS: ClassVar = QLogUniform
|
274
333
|
|
275
334
|
|
276
335
|
class Normal(BaseRange):
|
277
336
|
loc: Union[float]
|
278
337
|
scale: Union[float]
|
279
|
-
size: Optional[int]
|
280
|
-
_REQUIRED_KEYS = ["loc", "scale"]
|
281
|
-
_OPTIONAL_KEYS = ["size"]
|
282
|
-
_CHECK_ORDER = False
|
338
|
+
size: Optional[int] = None
|
339
|
+
_REQUIRED_KEYS: ClassVar[str] = ["loc", "scale"]
|
340
|
+
_OPTIONAL_KEYS: ClassVar[str] = ["size"]
|
341
|
+
_CHECK_ORDER: ClassVar[bool] = False
|
283
342
|
|
284
343
|
|
285
344
|
class NormalList(RangeList):
|
286
|
-
_CLASS = Normal
|
345
|
+
_CLASS: ClassVar = Normal
|
287
346
|
|
288
347
|
|
289
348
|
class NormalStr(RangeStr):
|
290
|
-
_CLASS = Normal
|
349
|
+
_CLASS: ClassVar = Normal
|
291
350
|
|
292
351
|
|
293
352
|
class QNormal(BaseRange):
|
294
353
|
loc: Union[float]
|
295
354
|
scale: Union[float]
|
296
355
|
q: StrictIntOrFloat
|
297
|
-
size: Optional[int]
|
298
|
-
_REQUIRED_KEYS = ["loc", "scale", "q"]
|
299
|
-
_OPTIONAL_KEYS = ["size"]
|
300
|
-
_CHECK_ORDER = False
|
356
|
+
size: Optional[int] = None
|
357
|
+
_REQUIRED_KEYS: ClassVar[str] = ["loc", "scale", "q"]
|
358
|
+
_OPTIONAL_KEYS: ClassVar[str] = ["size"]
|
359
|
+
_CHECK_ORDER: ClassVar[bool] = False
|
301
360
|
|
302
361
|
|
303
362
|
class QNormalList(RangeList):
|
304
|
-
_CLASS = QNormal
|
363
|
+
_CLASS: ClassVar = QNormal
|
305
364
|
|
306
365
|
|
307
366
|
class QNormalStr(RangeStr):
|
308
|
-
_CLASS = QNormal
|
367
|
+
_CLASS: ClassVar = QNormal
|
309
368
|
|
310
369
|
|
311
370
|
class LogNormal(Normal):
|
@@ -313,11 +372,11 @@ class LogNormal(Normal):
|
|
313
372
|
|
314
373
|
|
315
374
|
class LogNormalList(RangeList):
|
316
|
-
_CLASS = LogNormal
|
375
|
+
_CLASS: ClassVar = LogNormal
|
317
376
|
|
318
377
|
|
319
378
|
class LogNormalStr(RangeStr):
|
320
|
-
_CLASS = LogNormal
|
379
|
+
_CLASS: ClassVar = LogNormal
|
321
380
|
|
322
381
|
|
323
382
|
class QLogNormal(QNormal):
|
@@ -325,11 +384,11 @@ class QLogNormal(QNormal):
|
|
325
384
|
|
326
385
|
|
327
386
|
class QLogNormalList(RangeList):
|
328
|
-
_CLASS = QLogNormal
|
387
|
+
_CLASS: ClassVar = QLogNormal
|
329
388
|
|
330
389
|
|
331
390
|
class QLogNormalStr(RangeStr):
|
332
|
-
_CLASS = QLogNormal
|
391
|
+
_CLASS: ClassVar = QLogNormal
|
333
392
|
|
334
393
|
|
335
394
|
def validate_matrix(values):
|
@@ -341,7 +400,7 @@ def validate_matrix(values):
|
|
341
400
|
|
342
401
|
|
343
402
|
class BaseHpParamConfig(BaseSchemaModel):
|
344
|
-
_USE_DISCRIMINATOR = True
|
403
|
+
_USE_DISCRIMINATOR: ClassVar[bool] = True
|
345
404
|
|
346
405
|
@staticmethod
|
347
406
|
def validate_io(io: "V1IO"): # noqa
|
@@ -432,9 +491,9 @@ class V1HpPChoice(BaseHpParamConfig):
|
|
432
491
|
_IDENTIFIER = V1HPKind.PCHOICE
|
433
492
|
|
434
493
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
435
|
-
value: Optional[Union[List[PChoice], RefField]]
|
494
|
+
value: Optional[Union[List[PChoice], RefField]] = None
|
436
495
|
|
437
|
-
@
|
496
|
+
@field_validator("value")
|
438
497
|
@skip_partial
|
439
498
|
def validate_value(cls, value):
|
440
499
|
if value and isinstance(value, (list, tuple)):
|
@@ -494,7 +553,7 @@ class V1HpRange(BaseHpParamConfig):
|
|
494
553
|
_IDENTIFIER = V1HPKind.RANGE
|
495
554
|
|
496
555
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
497
|
-
value: Optional[Union[Range, RangeList, RangeStr, RefField]]
|
556
|
+
value: Optional[Union[Range, RangeList, RangeStr, RefField]] = None
|
498
557
|
|
499
558
|
@property
|
500
559
|
def is_distribution(self):
|
@@ -545,7 +604,7 @@ class V1HpDateRange(BaseHpParamConfig):
|
|
545
604
|
_IDENTIFIER = V1HPKind.DATERANGE
|
546
605
|
|
547
606
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
548
|
-
value: Optional[Union[DateRange, DateRangeList, RefField]]
|
607
|
+
value: Optional[Union[DateRange, DateRangeList, RefField]] = None
|
549
608
|
|
550
609
|
@staticmethod
|
551
610
|
def validate_io(io: "V1IO"): # noqa
|
@@ -670,7 +729,7 @@ class V1HpLinSpace(BaseHpParamConfig):
|
|
670
729
|
_IDENTIFIER = V1HPKind.LINSPACE
|
671
730
|
|
672
731
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
673
|
-
value: Optional[Union[LinSpace, LinSpaceList, LinSpaceStr, RefField]]
|
732
|
+
value: Optional[Union[LinSpace, LinSpaceList, LinSpaceStr, RefField]] = None
|
674
733
|
|
675
734
|
@property
|
676
735
|
def is_distribution(self):
|
@@ -724,7 +783,7 @@ class V1HpLogSpace(BaseHpParamConfig):
|
|
724
783
|
_IDENTIFIER = V1HPKind.LOGSPACE
|
725
784
|
|
726
785
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
727
|
-
value: Optional[Union[LogSpace, LogSpaceList, LogSpaceStr, RefField]]
|
786
|
+
value: Optional[Union[LogSpace, LogSpaceList, LogSpaceStr, RefField]] = None
|
728
787
|
|
729
788
|
@property
|
730
789
|
def is_distribution(self):
|
@@ -774,7 +833,7 @@ class V1HpGeomSpace(BaseHpParamConfig):
|
|
774
833
|
_IDENTIFIER = V1HPKind.GEOMSPACE
|
775
834
|
|
776
835
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
777
|
-
value: Optional[Union[GeomSpace, GeomSpaceList, GeomSpaceStr, RefField]]
|
836
|
+
value: Optional[Union[GeomSpace, GeomSpaceList, GeomSpaceStr, RefField]] = None
|
778
837
|
|
779
838
|
@property
|
780
839
|
def is_distribution(self):
|
@@ -824,7 +883,7 @@ class V1HpUniform(BaseHpParamConfig):
|
|
824
883
|
_IDENTIFIER = V1HPKind.UNIFORM
|
825
884
|
|
826
885
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
827
|
-
value: Optional[Union[Uniform, UniformList, UniformStr, RefField]]
|
886
|
+
value: Optional[Union[Uniform, UniformList, UniformStr, RefField]] = None
|
828
887
|
|
829
888
|
@property
|
830
889
|
def is_distribution(self):
|
@@ -876,7 +935,7 @@ class V1HpQUniform(BaseHpParamConfig):
|
|
876
935
|
_IDENTIFIER = "quniform"
|
877
936
|
|
878
937
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
879
|
-
value: Optional[Union[QUniform, QUniformList, QUniformStr, RefField]]
|
938
|
+
value: Optional[Union[QUniform, QUniformList, QUniformStr, RefField]] = None
|
880
939
|
|
881
940
|
@property
|
882
941
|
def is_distribution(self):
|
@@ -927,7 +986,7 @@ class V1HpLogUniform(BaseHpParamConfig):
|
|
927
986
|
_IDENTIFIER = V1HPKind.LOGUNIFORM
|
928
987
|
|
929
988
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
930
|
-
value: Optional[Union[LogUniform, LogUniformList, LogUniformStr, RefField]]
|
989
|
+
value: Optional[Union[LogUniform, LogUniformList, LogUniformStr, RefField]] = None
|
931
990
|
|
932
991
|
@property
|
933
992
|
def is_distribution(self):
|
@@ -978,7 +1037,9 @@ class V1HpQLogUniform(BaseHpParamConfig):
|
|
978
1037
|
_IDENTIFIER = V1HPKind.QLOGUNIFORM
|
979
1038
|
|
980
1039
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
981
|
-
value: Optional[
|
1040
|
+
value: Optional[
|
1041
|
+
Union[QLogUniform, QLogUniformList, QLogUniformStr, RefField]
|
1042
|
+
] = None
|
982
1043
|
|
983
1044
|
@property
|
984
1045
|
def is_distribution(self):
|
@@ -1033,7 +1094,7 @@ class V1HpNormal(BaseHpParamConfig):
|
|
1033
1094
|
_IDENTIFIER = V1HPKind.NORMAL
|
1034
1095
|
|
1035
1096
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
1036
|
-
value: Optional[Union[Normal, NormalList, NormalStr, RefField]]
|
1097
|
+
value: Optional[Union[Normal, NormalList, NormalStr, RefField]] = None
|
1037
1098
|
|
1038
1099
|
@property
|
1039
1100
|
def is_distribution(self):
|
@@ -1084,7 +1145,7 @@ class V1HpQNormal(BaseHpParamConfig):
|
|
1084
1145
|
_IDENTIFIER = V1HPKind.QNORMAL
|
1085
1146
|
|
1086
1147
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
1087
|
-
value: Optional[Union[QNormal, QNormalList, QNormalStr, RefField]]
|
1148
|
+
value: Optional[Union[QNormal, QNormalList, QNormalStr, RefField]] = None
|
1088
1149
|
|
1089
1150
|
@property
|
1090
1151
|
def is_distribution(self):
|
@@ -1135,7 +1196,7 @@ class V1HpLogNormal(BaseHpParamConfig):
|
|
1135
1196
|
_IDENTIFIER = V1HPKind.LOGNORMAL
|
1136
1197
|
|
1137
1198
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
1138
|
-
value: Optional[Union[LogNormal, LogNormalList, LogNormalStr, RefField]]
|
1199
|
+
value: Optional[Union[LogNormal, LogNormalList, LogNormalStr, RefField]] = None
|
1139
1200
|
|
1140
1201
|
@property
|
1141
1202
|
def is_distribution(self):
|
@@ -1186,7 +1247,7 @@ class V1HpQLogNormal(BaseHpParamConfig):
|
|
1186
1247
|
_IDENTIFIER = V1HPKind.QLOGNORMAL
|
1187
1248
|
|
1188
1249
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
1189
|
-
value: Optional[Union[QLogNormal, QLogNormalList, QLogNormalStr, RefField]]
|
1250
|
+
value: Optional[Union[QLogNormal, QLogNormalList, QLogNormalStr, RefField]] = None
|
1190
1251
|
|
1191
1252
|
@property
|
1192
1253
|
def is_distribution(self):
|
@@ -1,7 +1,12 @@
|
|
1
1
|
from typing import Dict, List, Optional, Union
|
2
2
|
from typing_extensions import Literal
|
3
3
|
|
4
|
-
from clipped.compact.pydantic import
|
4
|
+
from clipped.compact.pydantic import (
|
5
|
+
Field,
|
6
|
+
PositiveInt,
|
7
|
+
field_validator,
|
8
|
+
validation_before,
|
9
|
+
)
|
5
10
|
from clipped.types.ref_or_obj import IntOrRef, RefField
|
6
11
|
|
7
12
|
from polyaxon._flow.early_stopping import V1EarlyStopping
|
@@ -204,13 +209,13 @@ class V1RandomSearch(BaseSearchConfig):
|
|
204
209
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
205
210
|
params: Union[Dict[str, V1HpParam], RefField]
|
206
211
|
num_runs: Union[PositiveInt, RefField] = Field(alias="numRuns")
|
207
|
-
seed: Optional[IntOrRef]
|
208
|
-
concurrency: Optional[Union[PositiveInt, RefField]]
|
212
|
+
seed: Optional[IntOrRef] = None
|
213
|
+
concurrency: Optional[Union[PositiveInt, RefField]] = None
|
209
214
|
early_stopping: Optional[Union[List[V1EarlyStopping], RefField]] = Field(
|
210
|
-
alias="earlyStopping"
|
215
|
+
alias="earlyStopping", default=None
|
211
216
|
)
|
212
217
|
|
213
|
-
@
|
218
|
+
@field_validator("num_runs", "concurrency", **validation_before)
|
214
219
|
def check_values(cls, v, field):
|
215
220
|
if v and v < 1:
|
216
221
|
raise ValueError(f"{field} must be greater than 1, received `{v}` instead.")
|
polyaxon/_flow/matrix/tuner.py
CHANGED
@@ -119,7 +119,7 @@ class V1Tuner(BaseSchemaModel):
|
|
119
119
|
_IDENTIFIER = "tuner"
|
120
120
|
|
121
121
|
hub_ref: StrictStr = Field(alias="hubRef")
|
122
|
-
presets: Optional[Union[List[StrictStr], RefField]]
|
123
|
-
queue: Optional[StrictStr]
|
124
|
-
namespace: Optional[StrictStr]
|
125
|
-
params: Optional[Union[Dict[str, V1Param], RefField]]
|
122
|
+
presets: Optional[Union[List[StrictStr], RefField]] = None
|
123
|
+
queue: Optional[StrictStr] = None
|
124
|
+
namespace: Optional[StrictStr] = None
|
125
|
+
params: Optional[Union[Dict[str, V1Param], RefField]] = None
|
@@ -16,14 +16,16 @@ from polyaxon._schemas.lifecycle import V1Statuses
|
|
16
16
|
class BaseOp(BaseComponent, MatrixMixin, ScheduleMixin):
|
17
17
|
_FIELDS_SAME_KIND_PATCH = ["schedule", "matrix"]
|
18
18
|
|
19
|
-
schedule: Optional[V1Schedule]
|
20
|
-
events: Optional[Union[List[V1EventTrigger], RefField]]
|
21
|
-
matrix: Optional[V1Matrix]
|
22
|
-
joins: Optional[Union[List[V1Join], RefField]]
|
23
|
-
dependencies: Optional[Union[List[StrictStr], RefField]]
|
24
|
-
trigger: Optional[Union[V1TriggerPolicy, RefField]]
|
25
|
-
conditions: Optional[StrictStr]
|
26
|
-
skip_on_upstream_skip: Optional[bool] = Field(
|
19
|
+
schedule: Optional[V1Schedule] = None
|
20
|
+
events: Optional[Union[List[V1EventTrigger], RefField]] = None
|
21
|
+
matrix: Optional[V1Matrix] = None
|
22
|
+
joins: Optional[Union[List[V1Join], RefField]] = None
|
23
|
+
dependencies: Optional[Union[List[StrictStr], RefField]] = None
|
24
|
+
trigger: Optional[Union[V1TriggerPolicy, RefField]] = None
|
25
|
+
conditions: Optional[StrictStr] = None
|
26
|
+
skip_on_upstream_skip: Optional[bool] = Field(
|
27
|
+
alias="skipOnUpstreamSkip", default=None
|
28
|
+
)
|
27
29
|
|
28
30
|
def get_matrix_kind(self):
|
29
31
|
return self.matrix.kind if self.matrix else None
|
@@ -10,12 +10,13 @@ from polyaxon.exceptions import PolyaxonSchemaError
|
|
10
10
|
|
11
11
|
class V1CompiledOperation(BaseOp, RunMixin):
|
12
12
|
_IDENTIFIER = "compiled_operation"
|
13
|
+
_CUSTOM_DUMP_FIELDS = {"run"}
|
13
14
|
|
14
15
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
15
|
-
inputs: Optional[List[V1IO]]
|
16
|
-
outputs: Optional[List[V1IO]]
|
17
|
-
contexts: Optional[List[V1IO]]
|
18
|
-
run: V1Runtime
|
16
|
+
inputs: Optional[List[V1IO]] = None
|
17
|
+
outputs: Optional[List[V1IO]] = None
|
18
|
+
contexts: Optional[List[V1IO]] = None
|
19
|
+
run: Optional[V1Runtime] = None
|
19
20
|
|
20
21
|
def get_run_kind(self):
|
21
22
|
return self.run.kind if self.run else None
|