polyaxon 2.0.6rc8__py3-none-any.whl → 2.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- polyaxon/_cli/config.py +1 -1
- polyaxon/_cli/run.py +8 -0
- polyaxon/_cli/services/clean_artifacts.py +1 -1
- polyaxon/_client/client.py +17 -0
- polyaxon/_client/run.py +12 -0
- polyaxon/_compiler/resolver/agent.py +1 -1
- polyaxon/_compiler/resolver/runtime.py +1 -1
- polyaxon/_deploy/schemas/service.py +4 -0
- polyaxon/_docker/executor.py +10 -4
- polyaxon/_env_vars/getters/run.py +3 -0
- polyaxon/_env_vars/keys.py +5 -0
- polyaxon/_flow/__init__.py +2 -0
- polyaxon/_flow/builds/__init__.py +19 -6
- polyaxon/_flow/component/base.py +1 -0
- polyaxon/_flow/component/component.py +14 -0
- polyaxon/_flow/environment/__init__.py +5 -5
- polyaxon/_flow/hooks/__init__.py +19 -6
- polyaxon/_flow/matrix/tuner.py +18 -6
- polyaxon/_flow/operations/operation.py +19 -0
- polyaxon/_flow/run/__init__.py +2 -2
- polyaxon/_flow/run/kubeflow/paddle_job.py +34 -2
- polyaxon/_flow/run/kubeflow/pytorch_job.py +50 -3
- polyaxon/_flow/run/kubeflow/scheduling_policy.py +4 -0
- polyaxon/_flow/run/kubeflow/tf_job.py +2 -1
- polyaxon/_fs/fs.py +5 -0
- polyaxon/_k8s/converter/converters/job.py +1 -1
- polyaxon/_k8s/converter/converters/kubeflow/paddle_job.py +1 -0
- polyaxon/_k8s/converter/converters/kubeflow/pytroch_job.py +2 -0
- polyaxon/_k8s/converter/converters/kubeflow/tf_job.py +1 -0
- polyaxon/_k8s/custom_resources/kubeflow/paddle_job.py +10 -1
- polyaxon/_k8s/custom_resources/kubeflow/pytorch_job.py +14 -1
- polyaxon/_k8s/custom_resources/kubeflow/tf_job.py +4 -0
- polyaxon/_k8s/executor/base.py +23 -6
- polyaxon/_k8s/logging/async_monitor.py +73 -12
- polyaxon/_k8s/manager/async_manager.py +81 -23
- polyaxon/_k8s/manager/base.py +4 -0
- polyaxon/_k8s/manager/manager.py +266 -133
- polyaxon/_operations/tuner.py +1 -0
- polyaxon/_polyaxonfile/check.py +2 -0
- polyaxon/_polyaxonfile/manager/operations.py +3 -0
- polyaxon/_polyaxonfile/manager/workflows.py +2 -0
- polyaxon/_polyaxonfile/specs/compiled_operation.py +1 -0
- polyaxon/_polyaxonfile/specs/operation.py +1 -0
- polyaxon/_polyaxonfile/specs/sections.py +3 -0
- polyaxon/_runner/agent/async_agent.py +94 -18
- polyaxon/_runner/agent/base_agent.py +25 -7
- polyaxon/_runner/agent/client.py +15 -1
- polyaxon/_runner/agent/sync_agent.py +83 -18
- polyaxon/_runner/executor.py +13 -7
- polyaxon/_schemas/agent.py +27 -1
- polyaxon/_schemas/client.py +30 -3
- polyaxon/_sdk/api/agents_v1_api.py +875 -51
- polyaxon/_sdk/api/service_accounts_v1_api.py +12 -12
- polyaxon/_sdk/schemas/__init__.py +3 -0
- polyaxon/_sdk/schemas/v1_agent_reconcile_body_request.py +14 -0
- polyaxon/_sidecar/container/__init__.py +1 -1
- polyaxon/_sidecar/container/monitors/spec.py +1 -1
- polyaxon/pkg.py +1 -1
- {polyaxon-2.0.6rc8.dist-info → polyaxon-2.1.0.dist-info}/METADATA +6 -6
- {polyaxon-2.0.6rc8.dist-info → polyaxon-2.1.0.dist-info}/RECORD +64 -63
- {polyaxon-2.0.6rc8.dist-info → polyaxon-2.1.0.dist-info}/LICENSE +0 -0
- {polyaxon-2.0.6rc8.dist-info → polyaxon-2.1.0.dist-info}/WHEEL +0 -0
- {polyaxon-2.0.6rc8.dist-info → polyaxon-2.1.0.dist-info}/entry_points.txt +0 -0
- {polyaxon-2.0.6rc8.dist-info → polyaxon-2.1.0.dist-info}/top_level.txt +0 -0
polyaxon/_cli/config.py
CHANGED
polyaxon/_cli/run.py
CHANGED
@@ -334,6 +334,12 @@ def _run(
|
|
334
334
|
"If the name is not namespaced by the agent name the default agent is used: "
|
335
335
|
"queue-name or agent-name/queue-name",
|
336
336
|
)
|
337
|
+
@click.option(
|
338
|
+
"--namespace",
|
339
|
+
"-ns",
|
340
|
+
type=str,
|
341
|
+
help="Namespace to use for this run. By default it will use the agent's namespace.",
|
342
|
+
)
|
337
343
|
@click.option(
|
338
344
|
"--nocache",
|
339
345
|
is_flag=True,
|
@@ -412,6 +418,7 @@ def run(
|
|
412
418
|
matrix_num_runs,
|
413
419
|
presets,
|
414
420
|
queue,
|
421
|
+
namespace,
|
415
422
|
nocache,
|
416
423
|
cache,
|
417
424
|
approved,
|
@@ -533,6 +540,7 @@ def run(
|
|
533
540
|
matrix_num_runs=matrix_num_runs,
|
534
541
|
presets=presets,
|
535
542
|
queue=queue,
|
543
|
+
namespace=namespace,
|
536
544
|
cache=cache,
|
537
545
|
nocache=nocache,
|
538
546
|
approved=approved,
|
polyaxon/_client/client.py
CHANGED
@@ -92,6 +92,7 @@ class PolyaxonClient:
|
|
92
92
|
self._users_v1 = None
|
93
93
|
self._versions_v1 = None
|
94
94
|
self._agents_v1 = None
|
95
|
+
self._internal_agents_v1 = None
|
95
96
|
self._queues_v1 = None
|
96
97
|
self._service_accounts_v1 = None
|
97
98
|
self._presets_v1 = None
|
@@ -109,6 +110,15 @@ class PolyaxonClient:
|
|
109
110
|
)
|
110
111
|
return ApiClient(self.config.sdk_config, **self.config.client_header)
|
111
112
|
|
113
|
+
def _get_internal_client(self):
|
114
|
+
if self.is_async:
|
115
|
+
return AsyncApiClient(
|
116
|
+
self.config.internal_sdk_config, **self.config.get_internal_header()
|
117
|
+
)
|
118
|
+
return ApiClient(
|
119
|
+
self.config.internal_sdk_config, **self.config.get_internal_header()
|
120
|
+
)
|
121
|
+
|
112
122
|
def reset(self):
|
113
123
|
self._projects_v1 = None
|
114
124
|
self._runs_v1 = None
|
@@ -118,6 +128,7 @@ class PolyaxonClient:
|
|
118
128
|
self._users_v1 = None
|
119
129
|
self._versions_v1 = None
|
120
130
|
self._agents_v1 = None
|
131
|
+
self._internal_agents_v1 = None
|
121
132
|
self._queues_v1 = None
|
122
133
|
self._service_accounts_v1 = None
|
123
134
|
self._presets_v1 = None
|
@@ -169,6 +180,12 @@ class PolyaxonClient:
|
|
169
180
|
self._agents_v1 = AgentsV1Api(self.api_client)
|
170
181
|
return self._agents_v1
|
171
182
|
|
183
|
+
@property
|
184
|
+
def internal_agents_v1(self):
|
185
|
+
if not self._internal_agents_v1:
|
186
|
+
self._internal_agents_v1 = AgentsV1Api(self._get_internal_client())
|
187
|
+
return self._internal_agents_v1
|
188
|
+
|
172
189
|
@property
|
173
190
|
def queues_v1(self):
|
174
191
|
if not self._queues_v1:
|
polyaxon/_client/run.py
CHANGED
@@ -501,6 +501,7 @@ class RunClient:
|
|
501
501
|
matrix: Optional[Union[Dict, V1Matrix]] = None,
|
502
502
|
presets: Optional[List[str]] = None,
|
503
503
|
queue: Optional[str] = None,
|
504
|
+
namespace: Optional[str] = None,
|
504
505
|
nocache: Optional[bool] = None,
|
505
506
|
cache: Optional[Union[int, str, bool]] = None,
|
506
507
|
approved: Optional[Union[int, str, bool]] = None,
|
@@ -530,6 +531,8 @@ class RunClient:
|
|
530
531
|
[presets](/docs/core/scheduling-presets/).
|
531
532
|
queue: str, optional, the name of the
|
532
533
|
[queue](/docs/core/scheduling-strategies/queues/) to assign the run to.
|
534
|
+
namespace: str, optional, the namespace to create the run under, by default it will
|
535
|
+
use the agent's namespace.
|
533
536
|
nocache: bool, optional, DEPRECATED Please use `cache='f'`
|
534
537
|
simple flag to disable
|
535
538
|
[cache check](/docs/automation/helpers/cache/).
|
@@ -555,6 +558,7 @@ class RunClient:
|
|
555
558
|
matrix=matrix,
|
556
559
|
presets=presets,
|
557
560
|
queue=queue,
|
561
|
+
namespace=namespace,
|
558
562
|
nocache=nocache,
|
559
563
|
cache=cache,
|
560
564
|
approved=approved,
|
@@ -576,6 +580,7 @@ class RunClient:
|
|
576
580
|
matrix: Optional[Union[Dict, V1Matrix]] = None,
|
577
581
|
presets: Optional[List[str]] = None,
|
578
582
|
queue: Optional[str] = None,
|
583
|
+
namespace: Optional[str] = None,
|
579
584
|
nocache: Optional[bool] = None,
|
580
585
|
cache: Optional[Union[int, str, bool]] = None,
|
581
586
|
approved: Optional[Union[int, str, bool]] = None,
|
@@ -604,6 +609,8 @@ class RunClient:
|
|
604
609
|
[presets](/docs/core/scheduling-presets/).
|
605
610
|
queue: str, optional, the name of the
|
606
611
|
[queue](/docs/core/scheduling-strategies/queues/) to assign the run to.
|
612
|
+
namespace: str, optional, the namespace to create the run under, by default it will
|
613
|
+
use the agent's namespace.
|
607
614
|
nocache: bool, optional, DEPRECATED Please use `cache='f'`
|
608
615
|
simple flag to disable
|
609
616
|
[cache check](/docs/automation/helpers/cache/).
|
@@ -629,6 +636,7 @@ class RunClient:
|
|
629
636
|
matrix=matrix,
|
630
637
|
presets=presets,
|
631
638
|
queue=queue,
|
639
|
+
namespace=namespace,
|
632
640
|
nocache=nocache,
|
633
641
|
cache=cache,
|
634
642
|
approved=approved,
|
@@ -650,6 +658,7 @@ class RunClient:
|
|
650
658
|
matrix: Optional[Union[Dict, V1Matrix]] = None,
|
651
659
|
presets: Optional[List[str]] = None,
|
652
660
|
queue: Optional[str] = None,
|
661
|
+
namespace: Optional[str] = None,
|
653
662
|
nocache: Optional[bool] = None,
|
654
663
|
cache: Optional[Union[int, str, bool]] = None,
|
655
664
|
approved: Optional[Union[int, str, bool]] = None,
|
@@ -677,6 +686,8 @@ class RunClient:
|
|
677
686
|
[presets](/docs/core/scheduling-presets/).
|
678
687
|
queue: str, optional, the name of the
|
679
688
|
[queue](/docs/core/scheduling-strategies/queues/) to assign the run to.
|
689
|
+
namespace: str, optional, the namespace to create the run under, by default it will
|
690
|
+
use the agent's namespace.
|
680
691
|
nocache: bool, optional, DEPRECATED Please use `cache='f'`
|
681
692
|
simple flag to disable
|
682
693
|
[cache check](/docs/automation/helpers/cache/).
|
@@ -702,6 +713,7 @@ class RunClient:
|
|
702
713
|
matrix=matrix,
|
703
714
|
presets=presets,
|
704
715
|
queue=queue,
|
716
|
+
namespace=namespace,
|
705
717
|
nocache=nocache,
|
706
718
|
cache=cache,
|
707
719
|
approved=approved,
|
@@ -49,7 +49,7 @@ class AgentResolver(BaseSchemaModel):
|
|
49
49
|
|
50
50
|
self.polyaxon_sidecar = agent_config.sidecar or get_default_sidecar_container()
|
51
51
|
self.polyaxon_init = agent_config.init or get_default_init_container()
|
52
|
-
self.namespace = agent_config.namespace
|
52
|
+
self.namespace = compiled_operation.namespace or agent_config.namespace
|
53
53
|
|
54
54
|
def _resolve_run_connections(
|
55
55
|
self, compiled_operation: V1CompiledOperation, agent_config: AgentConfig
|
@@ -181,7 +181,7 @@ class BaseResolver:
|
|
181
181
|
)
|
182
182
|
self.polyaxon_sidecar = agent_env.polyaxon_sidecar
|
183
183
|
self.polyaxon_init = agent_env.polyaxon_init
|
184
|
-
self.namespace = agent_env.namespace
|
184
|
+
self.namespace = self.compiled_operation.namespace or agent_env.namespace
|
185
185
|
self.secrets = agent_env.secrets
|
186
186
|
self.config_maps = agent_env.config_maps
|
187
187
|
self.connection_by_names = agent_env.connection_by_names
|
@@ -12,6 +12,7 @@ class DeploymentService(BaseServiceConfig):
|
|
12
12
|
enabled: Optional[bool]
|
13
13
|
replicas: Optional[StrictInt]
|
14
14
|
concurrency: Optional[StrictInt]
|
15
|
+
per_core: Optional[bool] = Field(alias="perCore")
|
15
16
|
scheme: Optional[StrictStr]
|
16
17
|
|
17
18
|
|
@@ -22,6 +23,8 @@ class WorkerServiceConfig(DeploymentService):
|
|
22
23
|
class AgentServiceConfig(DeploymentService):
|
23
24
|
instance: Optional[StrictStr]
|
24
25
|
token: Optional[StrictStr]
|
26
|
+
watch_cluster: Optional[bool] = Field(alias="watchCluster")
|
27
|
+
additional_namespaces: Optional[List[str]] = Field(alias="additionalNamespaces")
|
25
28
|
is_replica: Optional[bool] = Field(alias="isReplica")
|
26
29
|
|
27
30
|
|
@@ -50,6 +53,7 @@ class HooksConfig(DeploymentService):
|
|
50
53
|
tables: Optional[bool] = Field(alias="tables")
|
51
54
|
sync_db: Optional[bool] = Field(alias="syncdb")
|
52
55
|
admin_user: Optional[bool] = Field(alias="adminUser")
|
56
|
+
default_org: Optional[bool] = Field(alias="defaultOrg")
|
53
57
|
|
54
58
|
|
55
59
|
class ThirdPartyService(DeploymentService):
|
polyaxon/_docker/executor.py
CHANGED
@@ -35,6 +35,7 @@ class Executor(BaseExecutor):
|
|
35
35
|
run_uuid: str,
|
36
36
|
run_kind: str,
|
37
37
|
resource: List[docker_types.V1Container],
|
38
|
+
namespace: str = None,
|
38
39
|
) -> Dict:
|
39
40
|
logger.info(f"[Executor] Starting operation {run_uuid} {run_kind}.")
|
40
41
|
self._ops[run_uuid] = []
|
@@ -62,13 +63,15 @@ class Executor(BaseExecutor):
|
|
62
63
|
self._clean_temp_execution_path(run_uuid)
|
63
64
|
return {"status": V1Statuses.SUCCEEDED, "tasks": self._ops[run_uuid]}
|
64
65
|
|
65
|
-
def apply(
|
66
|
+
def apply(
|
67
|
+
self, run_uuid: str, run_kind: str, resource: Dict, namespace: str = None
|
68
|
+
) -> Dict:
|
66
69
|
raise PolyaxonAgentError(
|
67
70
|
"Docker executor does not support apply method.\n"
|
68
71
|
"Run: <kind: {}, uuid: {}>".format(run_kind, run_uuid)
|
69
72
|
)
|
70
73
|
|
71
|
-
def stop(self, run_uuid: str, run_kind: str):
|
74
|
+
def stop(self, run_uuid: str, run_kind: str, namespace: str = None):
|
72
75
|
proc = self._get_op_proc(run_uuid)
|
73
76
|
if proc.poll() is None:
|
74
77
|
# Kill the process tree rooted at the child if it's the leader of its own process
|
@@ -85,7 +88,7 @@ class Executor(BaseExecutor):
|
|
85
88
|
logger.debug(_msg)
|
86
89
|
proc.wait()
|
87
90
|
|
88
|
-
def clean(self, run_uuid: str, run_kind: str):
|
91
|
+
def clean(self, run_uuid: str, run_kind: str, namespace: str = None):
|
89
92
|
return self.apply(
|
90
93
|
run_uuid=run_uuid,
|
91
94
|
run_kind=run_kind,
|
@@ -100,6 +103,9 @@ class Executor(BaseExecutor):
|
|
100
103
|
return V1Statuses.SUCCEEDED
|
101
104
|
return V1Statuses.FAILED
|
102
105
|
|
103
|
-
def get(self, run_uuid: str, run_kind: str) -> V1Statuses:
|
106
|
+
def get(self, run_uuid: str, run_kind: str, namespace: str = None) -> V1Statuses:
|
104
107
|
procs = self._get_op_proc(run_uuid)
|
105
108
|
return self._get_task_status(procs[-1])
|
109
|
+
|
110
|
+
def list_ops(self, namespace: str = None):
|
111
|
+
return []
|
@@ -74,7 +74,10 @@ def get_run_info(run_instance: Optional[str] = None):
|
|
74
74
|
"Could not get run info, "
|
75
75
|
"please make sure this is run is correctly started by Polyaxon."
|
76
76
|
)
|
77
|
+
return get_run_info_from_instance(run_instance)
|
77
78
|
|
79
|
+
|
80
|
+
def get_run_info_from_instance(run_instance: str):
|
78
81
|
parts = run_instance.split(".")
|
79
82
|
if not len(parts) == 4:
|
80
83
|
raise PolyaxonClientException(
|
polyaxon/_env_vars/keys.py
CHANGED
@@ -78,6 +78,9 @@ ENV_KEYS_AGENT_ARTIFACTS_STORE = "POLYAXON_AGENT_ARTIFACTS_STORE"
|
|
78
78
|
ENV_KEYS_AGENT_CONNECTIONS = "POLYAXON_AGENT_CONNECTIONS"
|
79
79
|
ENV_KEYS_SET_AGENT = "POLYAXON_SET_AGENT"
|
80
80
|
ENV_KEYS_K8S_APP_SECRET_NAME = "POLYAXON_K8S_APP_SECRET_NAME" # noqa
|
81
|
+
ENV_KEYS_WATCH_CLUSTER = "POLYAXON_WATCH_CLUSTER"
|
82
|
+
ENV_KEYS_SINGLE_NAMESPACE = "POLYAXON_SINGLE_NAMESPACE"
|
83
|
+
ENV_KEYS_ADDITIONAL_NAMESPACES = "POLYAXON_ADDITIONAL_NAMESPACES"
|
81
84
|
ENV_KEYS_AGENT_SECRET_NAME = "POLYAXON_AGENT_SECRET_NAME" # noqa
|
82
85
|
ENV_KEYS_AGENT_RUNS_SA = "POLYAXON_AGENT_RUNS_SA"
|
83
86
|
ENV_KEYS_AGENT_ENABLE_HEALTH_CHECKS = "POLYAXON_AGENT_ENABLE_HEALTH_CHECKS"
|
@@ -120,6 +123,8 @@ ENV_KEYS_PROXY_NAMESPACES = "POLYAXON_PROXY_NAMESPACES"
|
|
120
123
|
ENV_KEYS_PROXY_GATEWAY_PORT = "POLYAXON_PROXY_GATEWAY_PORT"
|
121
124
|
ENV_KEYS_PROXY_GATEWAY_TARGET_PORT = "POLYAXON_PROXY_GATEWAY_TARGET_PORT"
|
122
125
|
ENV_KEYS_PROXY_GATEWAY_HOST = "POLYAXON_PROXY_GATEWAY_HOST"
|
126
|
+
ENV_KEYS_PROXY_GATEWAY_CONCURRENCY = "POLYAXON_PROXY_GATEWAY_CONCURRENCY"
|
127
|
+
ENV_KEYS_PROXY_GATEWAY_PER_CORE = "POLYAXON_PROXY_GATEWAY_PER_CORE"
|
123
128
|
ENV_KEYS_PROXY_STREAMS_PORT = "POLYAXON_PROXY_STREAMS_PORT"
|
124
129
|
ENV_KEYS_PROXY_STREAMS_TARGET_PORT = "POLYAXON_PROXY_STREAMS_TARGET_PORT"
|
125
130
|
ENV_KEYS_PROXY_STREAMS_HOST = "POLYAXON_PROXY_STREAMS_HOST"
|
polyaxon/_flow/__init__.py
CHANGED
@@ -28,6 +28,7 @@ class V1Build(BaseSchemaModel):
|
|
28
28
|
hub_ref: str
|
29
29
|
connection: str
|
30
30
|
queue: str, optional
|
31
|
+
namespace: str, optional
|
31
32
|
presets: List[str], optional
|
32
33
|
cache: [V1Cache](/docs/automation/helpers/cache/), optional
|
33
34
|
params: Dict[str, [V1Param](/docs/core/specification/params/)], optional
|
@@ -94,6 +95,17 @@ class V1Build(BaseSchemaModel):
|
|
94
95
|
...
|
95
96
|
```
|
96
97
|
|
98
|
+
### presets
|
99
|
+
|
100
|
+
The [presets](/docs/management/organizations/presets/) to use for the hook operation,
|
101
|
+
if provided, it will override the component's presets otherwise
|
102
|
+
the presets of the component will be used if available.
|
103
|
+
|
104
|
+
```yaml
|
105
|
+
>>> build:
|
106
|
+
>>> presets: [test]
|
107
|
+
```
|
108
|
+
|
97
109
|
### queue
|
98
110
|
|
99
111
|
The [queue](/docs/core/scheduling-strategies/queues/) to use.
|
@@ -112,15 +124,15 @@ class V1Build(BaseSchemaModel):
|
|
112
124
|
>>> queue: queue-name
|
113
125
|
```
|
114
126
|
|
115
|
-
###
|
127
|
+
### namespace
|
116
128
|
|
117
|
-
|
118
|
-
|
119
|
-
|
129
|
+
> **Note**: Please note that this field is only available in some commercial editions.
|
130
|
+
|
131
|
+
The namespace to use, if not provided, it will default to the agent's namespace.
|
120
132
|
|
121
133
|
```yaml
|
122
134
|
>>> build:
|
123
|
-
>>>
|
135
|
+
>>> namespace: polyaxon
|
124
136
|
```
|
125
137
|
|
126
138
|
### cache
|
@@ -211,8 +223,9 @@ class V1Build(BaseSchemaModel):
|
|
211
223
|
_IDENTIFIER = "build"
|
212
224
|
hub_ref: StrictStr = Field(alias="hubRef")
|
213
225
|
connection: Optional[StrictStr]
|
214
|
-
queue: Optional[StrictStr]
|
215
226
|
presets: Optional[Union[List[StrictStr], RefField]]
|
227
|
+
queue: Optional[StrictStr]
|
228
|
+
namespace: Optional[StrictStr]
|
216
229
|
cache: Optional[Union[V1Cache, RefField]]
|
217
230
|
params: Optional[Dict[str, Union[V1Param, RefField]]]
|
218
231
|
run_patch: Optional[Dict[str, Any]] = Field(alias="runPatch")
|
polyaxon/_flow/component/base.py
CHANGED
@@ -20,6 +20,7 @@ class BaseComponent(BaseSchemaModel):
|
|
20
20
|
tags: Optional[List[StrictStr]]
|
21
21
|
presets: Optional[List[StrictStr]]
|
22
22
|
queue: Optional[StrictStr]
|
23
|
+
namespace: Optional[StrictStr]
|
23
24
|
cache: Optional[Union[V1Cache, RefField]]
|
24
25
|
termination: Optional[Union[V1Termination, RefField]]
|
25
26
|
plugins: Optional[Union[V1Plugins, RefField]]
|
@@ -39,6 +39,7 @@ class V1Component(
|
|
39
39
|
tags: List[str], optional
|
40
40
|
presets: List[str], optional
|
41
41
|
queue: str, optional
|
42
|
+
namespace: str, optional
|
42
43
|
cache: [V1Cache](/docs/automation/helpers/cache/), optional
|
43
44
|
termination: [V1Termination](/docs/core/specification/termination/), optional
|
44
45
|
plugins: [V1Plugins](/docs/core/specification/plugins/), optional
|
@@ -60,6 +61,7 @@ class V1Component(
|
|
60
61
|
>>> tags:
|
61
62
|
>>> presets:
|
62
63
|
>>> queue:
|
64
|
+
>>> namespace:
|
63
65
|
>>> cache:
|
64
66
|
>>> termination:
|
65
67
|
>>> plugins:
|
@@ -85,6 +87,7 @@ class V1Component(
|
|
85
87
|
>>> tags=["test"],
|
86
88
|
>>> presets=["test"],
|
87
89
|
>>> queue="test",
|
90
|
+
>>> namespace="test",
|
88
91
|
>>> cache=V1Cache(...),
|
89
92
|
>>> termination=V1Termination(...),
|
90
93
|
>>> plugins=V1Plugins(...),
|
@@ -197,6 +200,17 @@ class V1Component(
|
|
197
200
|
>>> queue: queue-name
|
198
201
|
```
|
199
202
|
|
203
|
+
### namespace
|
204
|
+
|
205
|
+
> **Note**: Please note that this field is only available in some commercial editions.
|
206
|
+
|
207
|
+
The namespace to use, if not provided, it will default to the agent's namespace.
|
208
|
+
|
209
|
+
```yaml
|
210
|
+
>>> component:
|
211
|
+
>>> namespace: polyaxon
|
212
|
+
```
|
213
|
+
|
200
214
|
### cache
|
201
215
|
|
202
216
|
The default component [cache](/docs/automation/helpers/cache/).
|
@@ -207,14 +207,14 @@ class V1Environment(BaseSchemaModel):
|
|
207
207
|
```yaml
|
208
208
|
>>> rules:
|
209
209
|
>>> - apiGroups: [""]
|
210
|
-
>>> resources: ["pods"]
|
210
|
+
>>> resources: ["pods", "services", "events", "pods/status", "pods/log"]
|
211
211
|
>>> verbs: ["get", "watch", "list"]
|
212
212
|
>>> - apiGroups: ["metrics.k8s.io"]
|
213
|
-
>>> resources: ["pods", "nodes"
|
213
|
+
>>> resources: ["pods", "nodes"]
|
214
214
|
>>> verbs: ["get", "list", "watch"]
|
215
|
-
>>> - apiGroups: [""
|
216
|
-
>>> resources: ["
|
217
|
-
>>> verbs: ["
|
215
|
+
>>> - apiGroups: ["core.polyaxon.com"]
|
216
|
+
>>> resources: ["operations"]
|
217
|
+
>>> verbs: ["get", "watch", "list"]
|
218
218
|
```
|
219
219
|
|
220
220
|
### hostAliases
|
polyaxon/_flow/hooks/__init__.py
CHANGED
@@ -49,6 +49,7 @@ class V1Hook(BaseSchemaModel):
|
|
49
49
|
hub_ref: str
|
50
50
|
conditions: str, optional
|
51
51
|
queue: str, optional
|
52
|
+
namespace: str, optional
|
52
53
|
presets: List[str], optional
|
53
54
|
disableDefaults: bool, optional
|
54
55
|
params: Dict[str, [V1Param](/docs/core/specification/params/)], optional
|
@@ -131,6 +132,17 @@ class V1Hook(BaseSchemaModel):
|
|
131
132
|
In the example above, the hook will only run if a param is passed, or an output is logged and
|
132
133
|
is equal to "some-value".
|
133
134
|
|
135
|
+
### presets
|
136
|
+
|
137
|
+
The [presets](/docs/management/organizations/presets/) to use for the hook operation,
|
138
|
+
if provided, it will override the component's presets otherwise
|
139
|
+
the presets of the component will be used if available.
|
140
|
+
|
141
|
+
```yaml
|
142
|
+
>>> hook:
|
143
|
+
>>> presets: [test]
|
144
|
+
```
|
145
|
+
|
134
146
|
### queue
|
135
147
|
|
136
148
|
The [queue](/docs/core/scheduling-strategies/queues/) to use.
|
@@ -149,15 +161,15 @@ class V1Hook(BaseSchemaModel):
|
|
149
161
|
>>> queue: queue-name
|
150
162
|
```
|
151
163
|
|
152
|
-
###
|
164
|
+
### namespace
|
153
165
|
|
154
|
-
|
155
|
-
|
156
|
-
|
166
|
+
> **Note**: Please note that this field is only available in some commercial editions.
|
167
|
+
|
168
|
+
The namespace to use, if not provided, it will default to the agent's namespace.
|
157
169
|
|
158
170
|
```yaml
|
159
171
|
>>> hook:
|
160
|
-
>>>
|
172
|
+
>>> namespace: polyaxon
|
161
173
|
```
|
162
174
|
|
163
175
|
### disableDefaults
|
@@ -199,8 +211,9 @@ class V1Hook(BaseSchemaModel):
|
|
199
211
|
connection: Optional[StrictStr]
|
200
212
|
trigger: Optional[V1Statuses]
|
201
213
|
conditions: Optional[StrictStr]
|
202
|
-
queue: Optional[StrictStr]
|
203
214
|
presets: Optional[List[StrictStr]]
|
215
|
+
queue: Optional[StrictStr]
|
216
|
+
namespace: Optional[StrictStr]
|
204
217
|
params: Optional[Union[Dict[str, V1Param], RefField]]
|
205
218
|
disable_defaults: Optional[BoolOrRef] = Field(alias="disableDefaults")
|
206
219
|
|
polyaxon/_flow/matrix/tuner.py
CHANGED
@@ -60,6 +60,17 @@ class V1Tuner(BaseSchemaModel):
|
|
60
60
|
...
|
61
61
|
```
|
62
62
|
|
63
|
+
### presets
|
64
|
+
|
65
|
+
The [presets](/docs/management/organizations/presets/) to use for the tuner operation,
|
66
|
+
if provided, it will override the component's presets otherwise
|
67
|
+
the presets of the component will be used if available.
|
68
|
+
|
69
|
+
```yaml
|
70
|
+
>>> tuner:
|
71
|
+
>>> presets: [test]
|
72
|
+
```
|
73
|
+
|
63
74
|
### queue
|
64
75
|
|
65
76
|
The [queue](/docs/core/scheduling-strategies/queues/) to use.
|
@@ -78,15 +89,15 @@ class V1Tuner(BaseSchemaModel):
|
|
78
89
|
>>> queue: queue-name
|
79
90
|
```
|
80
91
|
|
81
|
-
###
|
92
|
+
### namespace
|
82
93
|
|
83
|
-
|
84
|
-
|
85
|
-
|
94
|
+
> **Note**: Please note that this field is only available in some commercial editions.
|
95
|
+
|
96
|
+
The namespace to use, if not provided, it will default to the agent's namespace.
|
86
97
|
|
87
98
|
```yaml
|
88
99
|
>>> tuner:
|
89
|
-
>>>
|
100
|
+
>>> namespace: polyaxon
|
90
101
|
```
|
91
102
|
|
92
103
|
### params
|
@@ -108,6 +119,7 @@ class V1Tuner(BaseSchemaModel):
|
|
108
119
|
_IDENTIFIER = "tuner"
|
109
120
|
|
110
121
|
hub_ref: StrictStr = Field(alias="hubRef")
|
111
|
-
queue: Optional[StrictStr]
|
112
122
|
presets: Optional[Union[List[StrictStr], RefField]]
|
123
|
+
queue: Optional[StrictStr]
|
124
|
+
namespace: Optional[StrictStr]
|
113
125
|
params: Optional[Union[Dict[str, V1Param], RefField]]
|
@@ -45,6 +45,7 @@ class V1Operation(BaseOp, TemplateMixinConfig):
|
|
45
45
|
tags: List[str], optional
|
46
46
|
presets: str, optional
|
47
47
|
queue: str, optional
|
48
|
+
namespace: str, optional
|
48
49
|
cache: [V1Cache](/docs/automation/helpers/cache/), optional
|
49
50
|
termination: [V1Termination](/docs/core/specification/termination/), optional
|
50
51
|
plugins: [V1Plugins](/docs/core/specification/plugins/), optional
|
@@ -81,6 +82,7 @@ class V1Operation(BaseOp, TemplateMixinConfig):
|
|
81
82
|
>>> tags:
|
82
83
|
>>> presets:
|
83
84
|
>>> queue:
|
85
|
+
>>> namespace:
|
84
86
|
>>> cache:
|
85
87
|
>>> termination:
|
86
88
|
>>> plugins:
|
@@ -111,6 +113,7 @@ class V1Operation(BaseOp, TemplateMixinConfig):
|
|
111
113
|
>>> tags=["test"],
|
112
114
|
>>> presets=["test"],
|
113
115
|
>>> queue="test",
|
116
|
+
>>> namespace="test",
|
114
117
|
>>> cache=V1Cache(...),
|
115
118
|
>>> termination=V1Termination(...),
|
116
119
|
>>> plugins=V1Plugins(...),
|
@@ -248,6 +251,20 @@ class V1Operation(BaseOp, TemplateMixinConfig):
|
|
248
251
|
>>> queue: queue-name
|
249
252
|
```
|
250
253
|
|
254
|
+
### namespace
|
255
|
+
|
256
|
+
> **Note**: Please note that this field is only available in some commercial editions.
|
257
|
+
|
258
|
+
The namespace to use for this operation run,
|
259
|
+
if provided, it will override the component's namespace otherwise
|
260
|
+
the namesace of the component will be used if it exists or
|
261
|
+
it will default to the agent's namespace.
|
262
|
+
|
263
|
+
```yaml
|
264
|
+
>>> operation:
|
265
|
+
>>> namespace: polyaxon
|
266
|
+
```
|
267
|
+
|
251
268
|
### cache
|
252
269
|
|
253
270
|
The [cache](/docs/automation/helpers/cache/) to use for this operation run,
|
@@ -650,6 +667,7 @@ class V1Operation(BaseOp, TemplateMixinConfig):
|
|
650
667
|
hub_ref=hook.hub_ref,
|
651
668
|
presets=hook.presets,
|
652
669
|
queue=hook.queue,
|
670
|
+
namespace=hook.namespace,
|
653
671
|
params=params,
|
654
672
|
)
|
655
673
|
|
@@ -674,6 +692,7 @@ class V1Operation(BaseOp, TemplateMixinConfig):
|
|
674
692
|
hub_ref=build.hub_ref,
|
675
693
|
presets=build.presets,
|
676
694
|
queue=build.queue,
|
695
|
+
namespace=build.namespace,
|
677
696
|
cache=build.cache,
|
678
697
|
params=params,
|
679
698
|
)
|
polyaxon/_flow/run/__init__.py
CHANGED
@@ -17,8 +17,8 @@ from polyaxon._flow.run.job import V1Job
|
|
17
17
|
from polyaxon._flow.run.kubeflow.clean_pod_policy import V1CleanPodPolicy
|
18
18
|
from polyaxon._flow.run.kubeflow.mpi_job import V1MPIJob
|
19
19
|
from polyaxon._flow.run.kubeflow.mx_job import MXJobMode, V1MXJob
|
20
|
-
from polyaxon._flow.run.kubeflow.paddle_job import V1PaddleJob
|
21
|
-
from polyaxon._flow.run.kubeflow.pytorch_job import V1PytorchJob
|
20
|
+
from polyaxon._flow.run.kubeflow.paddle_job import V1PaddleElasticPolicy, V1PaddleJob
|
21
|
+
from polyaxon._flow.run.kubeflow.pytorch_job import V1PytorchElasticPolicy, V1PytorchJob
|
22
22
|
from polyaxon._flow.run.kubeflow.replica import V1KFReplica
|
23
23
|
from polyaxon._flow.run.kubeflow.scheduling_policy import V1SchedulingPolicy
|
24
24
|
from polyaxon._flow.run.kubeflow.tf_job import V1TFJob
|
@@ -1,8 +1,8 @@
|
|
1
|
-
from typing import Optional, Union
|
1
|
+
from typing import Dict, List, Optional, Union
|
2
2
|
from typing_extensions import Literal
|
3
3
|
|
4
4
|
from clipped.compact.pydantic import Field
|
5
|
-
from clipped.types.ref_or_obj import RefField
|
5
|
+
from clipped.types.ref_or_obj import IntOrRef, RefField
|
6
6
|
|
7
7
|
from polyaxon._flow.run.base import BaseRun
|
8
8
|
from polyaxon._flow.run.enums import V1RunKind
|
@@ -12,6 +12,25 @@ from polyaxon._flow.run.kubeflow.scheduling_policy import V1SchedulingPolicy
|
|
12
12
|
from polyaxon._flow.run.resources import V1RunResources
|
13
13
|
from polyaxon._flow.run.utils import DestinationImageMixin
|
14
14
|
from polyaxon._k8s.k8s_schemas import V1Container
|
15
|
+
from polyaxon._schemas.base import BaseSchemaModel
|
16
|
+
|
17
|
+
|
18
|
+
class V1PaddleElasticPolicy(BaseSchemaModel):
|
19
|
+
"""Elastic policy for Paddle distributed runs.
|
20
|
+
|
21
|
+
Args:
|
22
|
+
minReplicas: int, optional
|
23
|
+
maxReplicas: int, optional
|
24
|
+
maxRestarts: int, optional
|
25
|
+
metrics: List[Dict], optional
|
26
|
+
"""
|
27
|
+
|
28
|
+
_IDENTIFIER = "elasticPolicy"
|
29
|
+
|
30
|
+
min_replicas: Optional[IntOrRef] = Field(alias="minReplicas")
|
31
|
+
max_replicas: Optional[IntOrRef] = Field(alias="maxReplicas")
|
32
|
+
max_restarts: Optional[IntOrRef] = Field(alias="maxRestarts")
|
33
|
+
metrics: Optional[List[Dict]] = Field(alias="Metrics")
|
15
34
|
|
16
35
|
|
17
36
|
class V1PaddleJob(BaseRun, DestinationImageMixin):
|
@@ -88,6 +107,18 @@ class V1PaddleJob(BaseRun, DestinationImageMixin):
|
|
88
107
|
>>> ...
|
89
108
|
```
|
90
109
|
|
110
|
+
### elasticPolicy
|
111
|
+
|
112
|
+
Elastic policy for Paddle distributed runs.
|
113
|
+
|
114
|
+
```yaml
|
115
|
+
>>> run:
|
116
|
+
>>> kind: paddlejob
|
117
|
+
>>> elasticPolicy:
|
118
|
+
>>> ...
|
119
|
+
>>> ...
|
120
|
+
```
|
121
|
+
|
91
122
|
### master
|
92
123
|
|
93
124
|
The ,aster is responsible for orchestrating training and performing
|
@@ -124,6 +155,7 @@ class V1PaddleJob(BaseRun, DestinationImageMixin):
|
|
124
155
|
kind: Literal[_IDENTIFIER] = _IDENTIFIER
|
125
156
|
clean_pod_policy: Optional[V1CleanPodPolicy] = Field(alias="cleanPodPolicy")
|
126
157
|
scheduling_policy: Optional[V1SchedulingPolicy] = Field(alias="schedulingPolicy")
|
158
|
+
elastic_policy: Optional[V1PaddleElasticPolicy] = Field(alias="elasticPolicy")
|
127
159
|
master: Optional[Union[V1KFReplica, RefField]]
|
128
160
|
worker: Optional[Union[V1KFReplica, RefField]]
|
129
161
|
|