polyaxon 2.6.0rc1__py3-none-any.whl → 2.7.0rc0__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.
Files changed (103) hide show
  1. polyaxon/_cli/operations.py +1 -1
  2. polyaxon/_cli/projects.py +2 -2
  3. polyaxon/_compiler/contexts/contexts.py +5 -5
  4. polyaxon/_compiler/contexts/dask_job.py +1 -1
  5. polyaxon/_compiler/contexts/kubeflow/mpi_job.py +1 -1
  6. polyaxon/_compiler/contexts/kubeflow/mx_job.py +1 -1
  7. polyaxon/_compiler/contexts/kubeflow/paddle_job.py +1 -1
  8. polyaxon/_compiler/contexts/kubeflow/pytroch_job.py +1 -1
  9. polyaxon/_compiler/contexts/kubeflow/tf_job.py +1 -1
  10. polyaxon/_compiler/contexts/kubeflow/xgb_job.py +1 -1
  11. polyaxon/_compiler/contexts/ray_job.py +1 -1
  12. polyaxon/_compiler/resolver/agent.py +1 -1
  13. polyaxon/_compiler/resolver/runtime.py +1 -1
  14. polyaxon/_deploy/schemas/deployment.py +1 -0
  15. polyaxon/_deploy/schemas/ui.py +3 -1
  16. polyaxon/_docker/converter/base/base.py +1 -1
  17. polyaxon/_docker/converter/base/env_vars.py +1 -1
  18. polyaxon/_docker/converter/converters/job.py +1 -1
  19. polyaxon/_docker/converter/converters/service.py +1 -1
  20. polyaxon/_flow/component/component.py +4 -0
  21. polyaxon/_flow/environment/__init__.py +5 -4
  22. polyaxon/_flow/io/io.py +2 -0
  23. polyaxon/_flow/matrix/params.py +1 -1
  24. polyaxon/_flow/operations/compiled_operation.py +4 -0
  25. polyaxon/_flow/operations/operation.py +5 -3
  26. polyaxon/_flow/params/params.py +2 -2
  27. polyaxon/_flow/run/__init__.py +3 -0
  28. polyaxon/_flow/run/dag.py +6 -6
  29. polyaxon/_flow/run/dask/dask.py +10 -0
  30. polyaxon/_flow/run/kubeflow/mpi_job.py +8 -0
  31. polyaxon/_flow/run/kubeflow/mx_job.py +16 -0
  32. polyaxon/_flow/run/kubeflow/paddle_job.py +8 -0
  33. polyaxon/_flow/run/kubeflow/pytorch_job.py +8 -0
  34. polyaxon/_flow/run/kubeflow/tf_job.py +12 -0
  35. polyaxon/_flow/run/kubeflow/xgboost_job.py +19 -33
  36. polyaxon/_flow/run/patch.py +37 -9
  37. polyaxon/_flow/run/ray/ray.py +9 -0
  38. polyaxon/_flow/run/resources.py +1 -1
  39. polyaxon/_fs/fs.py +1 -1
  40. polyaxon/_k8s/converter/base/containers.py +1 -1
  41. polyaxon/_k8s/converter/converters/dask_job.py +1 -1
  42. polyaxon/_k8s/converter/converters/job.py +1 -1
  43. polyaxon/_k8s/converter/converters/kubeflow/mpi_job.py +1 -1
  44. polyaxon/_k8s/converter/converters/kubeflow/mx_job.py +1 -1
  45. polyaxon/_k8s/converter/converters/kubeflow/paddle_job.py +1 -1
  46. polyaxon/_k8s/converter/converters/kubeflow/pytroch_job.py +1 -1
  47. polyaxon/_k8s/converter/converters/kubeflow/tf_job.py +1 -1
  48. polyaxon/_k8s/converter/converters/kubeflow/xgboost_job.py +1 -1
  49. polyaxon/_k8s/converter/converters/ray_job.py +1 -2
  50. polyaxon/_k8s/converter/converters/service.py +1 -1
  51. polyaxon/_k8s/k8s_validation.py +16 -16
  52. polyaxon/_k8s/logging/async_monitor.py +4 -4
  53. polyaxon/_k8s/manager/async_manager.py +5 -3
  54. polyaxon/_k8s/manager/manager.py +6 -6
  55. polyaxon/_local_process/converter/base/env_vars.py +1 -1
  56. polyaxon/_local_process/converter/base/init.py +1 -1
  57. polyaxon/_local_process/converter/base/mounts.py +0 -2
  58. polyaxon/_local_process/converter/converters/job.py +1 -1
  59. polyaxon/_local_process/converter/converters/service.py +1 -1
  60. polyaxon/_managers/project.py +3 -2
  61. polyaxon/_polyaxonfile/check.py +4 -4
  62. polyaxon/_polyaxonfile/specs/compiled_operation.py +8 -6
  63. polyaxon/_polyaxonfile/specs/libs/parser.py +1 -3
  64. polyaxon/_polyaxonfile/specs/libs/validator.py +1 -1
  65. polyaxon/_polyaxonfile/specs/operation.py +7 -3
  66. polyaxon/_pql/manager.py +1 -1
  67. polyaxon/_pql/parser.py +29 -26
  68. polyaxon/_runner/agent/base_agent.py +1 -2
  69. polyaxon/_runner/converter/init/artifacts.py +3 -2
  70. polyaxon/_runner/converter/init/tensorboard.py +1 -1
  71. polyaxon/_schemas/client.py +1 -1
  72. polyaxon/_sdk/api/agents_v1_api.py +56 -80
  73. polyaxon/_sdk/api/artifacts_stores_v1_api.py +2 -2
  74. polyaxon/_sdk/api/auth_v1_api.py +2 -6
  75. polyaxon/_sdk/api/connections_v1_api.py +16 -20
  76. polyaxon/_sdk/api/dashboards_v1_api.py +14 -14
  77. polyaxon/_sdk/api/organizations_v1_api.py +1735 -755
  78. polyaxon/_sdk/api/presets_v1_api.py +18 -26
  79. polyaxon/_sdk/api/project_dashboards_v1_api.py +17 -19
  80. polyaxon/_sdk/api/project_searches_v1_api.py +20 -28
  81. polyaxon/_sdk/api/projects_v1_api.py +74 -92
  82. polyaxon/_sdk/api/queues_v1_api.py +22 -30
  83. polyaxon/_sdk/api/runs_v1_api.py +157 -207
  84. polyaxon/_sdk/api/searches_v1_api.py +16 -20
  85. polyaxon/_sdk/api/service_accounts_v1_api.py +30 -38
  86. polyaxon/_sdk/api/tags_v1_api.py +19 -25
  87. polyaxon/_sdk/api/teams_v1_api.py +64 -90
  88. polyaxon/_sdk/api/users_v1_api.py +17 -19
  89. polyaxon/_sdk/api/versions_v1_api.py +4 -4
  90. polyaxon/_sdk/async_client/rest.py +1 -3
  91. polyaxon/_sdk/schemas/v1_organization.py +3 -2
  92. polyaxon/_sdk/schemas/v1_project_settings.py +2 -1
  93. polyaxon/_sdk/schemas/v1_section_spec.py +1 -1
  94. polyaxon/_sdk/schemas/v1_user_access.py +3 -2
  95. polyaxon/_sdk/sync_client/api_client.py +2 -6
  96. polyaxon/_sdk/sync_client/rest.py +4 -8
  97. polyaxon/pkg.py +1 -1
  98. {polyaxon-2.6.0rc1.dist-info → polyaxon-2.7.0rc0.dist-info}/METADATA +9 -9
  99. {polyaxon-2.6.0rc1.dist-info → polyaxon-2.7.0rc0.dist-info}/RECORD +103 -103
  100. {polyaxon-2.6.0rc1.dist-info → polyaxon-2.7.0rc0.dist-info}/LICENSE +0 -0
  101. {polyaxon-2.6.0rc1.dist-info → polyaxon-2.7.0rc0.dist-info}/WHEEL +0 -0
  102. {polyaxon-2.6.0rc1.dist-info → polyaxon-2.7.0rc0.dist-info}/entry_points.txt +0 -0
  103. {polyaxon-2.6.0rc1.dist-info → polyaxon-2.7.0rc0.dist-info}/top_level.txt +0 -0
@@ -136,6 +136,7 @@ class V1RayJob(BaseRun, DestinationImageMixin):
136
136
 
137
137
  _IDENTIFIER = V1RunKind.RAYJOB
138
138
  _CUSTOM_DUMP_FIELDS = {"head", "workers"}
139
+ _FIELDS_DICT_PATCH = ["workers"]
139
140
 
140
141
  kind: Literal[_IDENTIFIER] = _IDENTIFIER
141
142
  entrypoint: Optional[str] = None
@@ -196,3 +197,11 @@ class V1RayJob(BaseRun, DestinationImageMixin):
196
197
  worker = self.workers[worker_name]
197
198
  init += worker.get_all_init()
198
199
  return init
200
+
201
+ def get_replica_types(self):
202
+ types = []
203
+ if self.head:
204
+ types.append("head")
205
+ if self.workers:
206
+ types += list(self.workers.keys())
207
+ return types
@@ -1,4 +1,4 @@
1
- from typing import ClassVar, Optional, Union, Set
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
polyaxon/_fs/fs.py CHANGED
@@ -18,7 +18,7 @@ def _get_fs_from_connection(
18
18
  connection: Optional[V1Connection],
19
19
  asynchronous: bool = False,
20
20
  use_listings_cache: bool = False,
21
- **kwargs
21
+ **kwargs,
22
22
  ):
23
23
  # We assume that `None` refers to local store as well
24
24
  if not connection or connection.kind in {
@@ -73,7 +73,7 @@ class ContainerMixin(BaseConverter):
73
73
 
74
74
  @staticmethod
75
75
  def _sanitize_resources(
76
- resources: Union[k8s_schemas.V1ResourceRequirements, Dict]
76
+ resources: Union[k8s_schemas.V1ResourceRequirements, Dict],
77
77
  ) -> Optional[k8s_schemas.V1ResourceRequirements]:
78
78
  def validate_resources(r_field: Dict) -> Dict:
79
79
  if not r_field:
@@ -20,7 +20,7 @@ class DaskJobConverter(DaskJobMixin, BaseConverter):
20
20
  default_sa: Optional[str] = None,
21
21
  default_auth: bool = False,
22
22
  ) -> Dict:
23
- job = compiled_operation.run # type: V1DaskJob
23
+ job: V1DaskJob = compiled_operation.run
24
24
 
25
25
  def _get_replica(replica: Optional[V1DaskReplica]) -> Optional[ReplicaSpec]:
26
26
  if not replica:
@@ -18,7 +18,7 @@ class JobConverter(JobMixin, BaseConverter):
18
18
  default_sa: Optional[str] = None,
19
19
  default_auth: bool = False,
20
20
  ) -> Dict:
21
- job = compiled_operation.run # type: V1Job
21
+ job: V1Job = compiled_operation.run
22
22
  plugins = V1Plugins.get_or_create(
23
23
  config=compiled_operation.plugins, auth=default_auth
24
24
  )
@@ -20,7 +20,7 @@ class MPIJobConverter(MPIJobMixin, BaseConverter):
20
20
  default_sa: Optional[str] = None,
21
21
  default_auth: bool = False,
22
22
  ) -> Dict:
23
- job = compiled_operation.run # type: V1MPIJob
23
+ job: V1MPIJob = compiled_operation.run
24
24
 
25
25
  def _get_replica(replica: Optional[V1KFReplica]) -> Optional[ReplicaSpec]:
26
26
  if not replica:
@@ -20,7 +20,7 @@ class MXJobConverter(MXJobMixin, BaseConverter):
20
20
  default_sa: Optional[str] = None,
21
21
  default_auth: bool = False,
22
22
  ) -> Dict:
23
- job = compiled_operation.run # type: V1MXJob
23
+ job: V1MXJob = compiled_operation.run
24
24
 
25
25
  def _get_replica(replica: Optional[V1KFReplica]) -> Optional[ReplicaSpec]:
26
26
  if not replica:
@@ -20,7 +20,7 @@ class PaddleJobConverter(PaddleJobMixin, BaseConverter):
20
20
  default_sa: Optional[str] = None,
21
21
  default_auth: bool = False,
22
22
  ) -> Dict:
23
- job = compiled_operation.run # type: V1PaddleJob
23
+ job: V1PaddleJob = compiled_operation.run
24
24
 
25
25
  def _get_replica(replica: Optional[V1KFReplica]) -> Optional[ReplicaSpec]:
26
26
  if not replica:
@@ -20,7 +20,7 @@ class PytorchJobConverter(PytorchJobMixin, BaseConverter):
20
20
  default_sa: Optional[str] = None,
21
21
  default_auth: bool = False,
22
22
  ) -> Dict:
23
- job = compiled_operation.run # type: V1PytorchJob
23
+ job: V1PytorchJob = compiled_operation.run
24
24
 
25
25
  def _get_replica(replica: Optional[V1KFReplica]) -> Optional[ReplicaSpec]:
26
26
  if not replica:
@@ -20,7 +20,7 @@ class TfJobConverter(TFJobMixin, BaseConverter):
20
20
  default_sa: Optional[str] = None,
21
21
  default_auth: bool = False,
22
22
  ) -> Dict:
23
- job = compiled_operation.run # type: V1TFJob
23
+ job: V1TFJob = compiled_operation.run
24
24
 
25
25
  def _get_replica(replica: Optional[V1KFReplica]) -> Optional[ReplicaSpec]:
26
26
  if not replica:
@@ -20,7 +20,7 @@ class XGBoostJobConverter(XGBoostJobMixin, BaseConverter):
20
20
  default_sa: Optional[str] = None,
21
21
  default_auth: bool = False,
22
22
  ) -> Dict:
23
- job = compiled_operation.run # type: V1XGBoostJob
23
+ job: V1XGBoostJob = compiled_operation.run
24
24
 
25
25
  def _get_replica(replica: Optional[V1KFReplica]) -> Optional[ReplicaSpec]:
26
26
  if not replica:
@@ -1,6 +1,5 @@
1
1
  from typing import Dict, Iterable, Optional
2
2
 
3
- from clipped.utils.encoding import encode
4
3
  from clipped.utils.json import orjson_dumps
5
4
 
6
5
  from polyaxon import pkg
@@ -23,7 +22,7 @@ class RayJobConverter(RayJobMixin, BaseConverter):
23
22
  default_sa: Optional[str] = None,
24
23
  default_auth: bool = False,
25
24
  ) -> Dict:
26
- job = compiled_operation.run # type: V1RayJob
25
+ job: V1RayJob = compiled_operation.run
27
26
 
28
27
  def _get_replica(replica: Optional[V1RayReplica]) -> Optional[ReplicaSpec]:
29
28
  if not replica:
@@ -1,7 +1,7 @@
1
1
  from typing import Dict, Iterable, Optional
2
2
 
3
3
  from polyaxon._connections import V1Connection, V1ConnectionResource
4
- from polyaxon._flow import V1CompiledOperation, V1Plugins, V1Service
4
+ from polyaxon._flow import V1CompiledOperation, V1Plugins
5
5
  from polyaxon._k8s.converter.base import BaseConverter
6
6
  from polyaxon._k8s.converter.mixins import ServiceMixin
7
7
  from polyaxon._k8s.custom_resources.service import get_service_custom_resource
@@ -24,13 +24,13 @@ def validate_k8s_affinity(value: Optional[Union[k8s_schemas.V1Affinity, Dict]]):
24
24
 
25
25
 
26
26
  def validate_k8s_security_context(
27
- value: Optional[Union[k8s_schemas.V1SecurityContext, Dict]]
27
+ value: Optional[Union[k8s_schemas.V1SecurityContext, Dict]],
28
28
  ):
29
29
  return _validate_schema(value, k8s_schemas.V1SecurityContext)
30
30
 
31
31
 
32
32
  def validate_k8s_pod_dns_config(
33
- value: Optional[Union[k8s_schemas.V1PodDNSConfig, Dict]]
33
+ value: Optional[Union[k8s_schemas.V1PodDNSConfig, Dict]],
34
34
  ):
35
35
  return _validate_schema(value, k8s_schemas.V1PodDNSConfig)
36
36
 
@@ -56,19 +56,19 @@ def validate_k8s_volume_mount(value: Optional[Union[k8s_schemas.V1VolumeMount, D
56
56
 
57
57
 
58
58
  def validate_k8s_container_port(
59
- value: Optional[Union[k8s_schemas.V1ContainerPort, Dict]]
59
+ value: Optional[Union[k8s_schemas.V1ContainerPort, Dict]],
60
60
  ):
61
61
  return _validate_schema(value, k8s_schemas.V1ContainerPort)
62
62
 
63
63
 
64
64
  def validate_k8s_resource_requirements(
65
- value: Optional[Union[k8s_schemas.V1ResourceRequirements, Dict]]
65
+ value: Optional[Union[k8s_schemas.V1ResourceRequirements, Dict]],
66
66
  ):
67
67
  return _validate_schema(value, k8s_schemas.V1ResourceRequirements)
68
68
 
69
69
 
70
70
  def validate_k8s_env_from_source(
71
- value: Optional[Union[k8s_schemas.V1EnvFromSource, Dict]]
71
+ value: Optional[Union[k8s_schemas.V1EnvFromSource, Dict]],
72
72
  ):
73
73
  return _validate_schema(value, k8s_schemas.V1EnvFromSource)
74
74
 
@@ -78,25 +78,25 @@ def validate_k8s_volume(value: Optional[Union[k8s_schemas.V1Volume, Dict]]):
78
78
 
79
79
 
80
80
  def validate_k8s_object_field_selector(
81
- value: Optional[Union[k8s_schemas.V1ObjectFieldSelector, Dict]]
81
+ value: Optional[Union[k8s_schemas.V1ObjectFieldSelector, Dict]],
82
82
  ):
83
83
  return _validate_schema(value, k8s_schemas.V1ObjectFieldSelector)
84
84
 
85
85
 
86
86
  def validate_k8s_env_var_source(
87
- value: Optional[Union[k8s_schemas.V1EnvVarSource, Dict]]
87
+ value: Optional[Union[k8s_schemas.V1EnvVarSource, Dict]],
88
88
  ):
89
89
  return _validate_schema(value, k8s_schemas.V1EnvVarSource)
90
90
 
91
91
 
92
92
  def validate_k8s_config_map_selector(
93
- value: Optional[Union[k8s_schemas.V1ConfigMapKeySelector, Dict]]
93
+ value: Optional[Union[k8s_schemas.V1ConfigMapKeySelector, Dict]],
94
94
  ):
95
95
  return _validate_schema(value, k8s_schemas.V1ConfigMapKeySelector)
96
96
 
97
97
 
98
98
  def validate_k8s_secret_selector(
99
- value: Optional[Union[k8s_schemas.V1SecretKeySelector, Dict]]
99
+ value: Optional[Union[k8s_schemas.V1SecretKeySelector, Dict]],
100
100
  ):
101
101
  return _validate_schema(value, k8s_schemas.V1SecretKeySelector)
102
102
 
@@ -110,42 +110,42 @@ def validate_k8s_object_meta(value: Optional[Union[k8s_schemas.V1ObjectMeta, Dic
110
110
 
111
111
 
112
112
  def validate_k8s_pod_template_spec(
113
- value: Optional[Union[k8s_schemas.V1PodTemplateSpec, Dict]]
113
+ value: Optional[Union[k8s_schemas.V1PodTemplateSpec, Dict]],
114
114
  ):
115
115
  return _validate_schema(value, k8s_schemas.V1PodTemplateSpec)
116
116
 
117
117
 
118
118
  def validate_k8s_host_path_volume_source(
119
- value: Optional[Union[k8s_schemas.V1HostPathVolumeSource, Dict]]
119
+ value: Optional[Union[k8s_schemas.V1HostPathVolumeSource, Dict]],
120
120
  ):
121
121
  return _validate_schema(value, k8s_schemas.V1HostPathVolumeSource)
122
122
 
123
123
 
124
124
  def validate_k8s_empty_dir_volume_source(
125
- value: Optional[Union[k8s_schemas.V1EmptyDirVolumeSource, Dict]]
125
+ value: Optional[Union[k8s_schemas.V1EmptyDirVolumeSource, Dict]],
126
126
  ):
127
127
  return _validate_schema(value, k8s_schemas.V1EmptyDirVolumeSource)
128
128
 
129
129
 
130
130
  def validate_k8s_persistent_volume_claim_volume_source(
131
- value: Optional[Union[k8s_schemas.V1PersistentVolumeClaimVolumeSource, Dict]]
131
+ value: Optional[Union[k8s_schemas.V1PersistentVolumeClaimVolumeSource, Dict]],
132
132
  ):
133
133
  return _validate_schema(value, k8s_schemas.V1PersistentVolumeClaimVolumeSource)
134
134
 
135
135
 
136
136
  def validate_k8s_secret_volume_source(
137
- value: Optional[Union[k8s_schemas.V1SecretVolumeSource, Dict]]
137
+ value: Optional[Union[k8s_schemas.V1SecretVolumeSource, Dict]],
138
138
  ):
139
139
  return _validate_schema(value, k8s_schemas.V1SecretVolumeSource)
140
140
 
141
141
 
142
142
  def validate_k8s_config_map_volume_source(
143
- value: Optional[Union[k8s_schemas.V1ConfigMapVolumeSource, Dict]]
143
+ value: Optional[Union[k8s_schemas.V1ConfigMapVolumeSource, Dict]],
144
144
  ):
145
145
  return _validate_schema(value, k8s_schemas.V1ConfigMapVolumeSource)
146
146
 
147
147
 
148
148
  def validate_k8s_local_object_reference(
149
- value: Optional[Union[k8s_schemas.V1LocalObjectReference, Dict]]
149
+ value: Optional[Union[k8s_schemas.V1LocalObjectReference, Dict]],
150
150
  ):
151
151
  return _validate_schema(value, k8s_schemas.V1LocalObjectReference)
@@ -203,7 +203,7 @@ async def get_op_spec(
203
203
  for pod in pods or []:
204
204
  pods_list[
205
205
  pod.metadata.name
206
- ] = k8s_manager.api_client.sanitize_for_serialization(pod)
206
+ ] = k8s_manager.api_client.sanitize_for_serialization(pod) # fmt: skip
207
207
  pods_list[pod.metadata.name]["events"] = await get_resource_events(
208
208
  k8s_manager=k8s_manager,
209
209
  resource_type="Pod",
@@ -213,7 +213,7 @@ async def get_op_spec(
213
213
  for service in services or []:
214
214
  services_list[
215
215
  service.metadata.name
216
- ] = k8s_manager.api_client.sanitize_for_serialization(service)
216
+ ] = k8s_manager.api_client.sanitize_for_serialization(service) # fmt: skip
217
217
  services_list[service.metadata.name]["events"] = await get_resource_events(
218
218
  k8s_manager=k8s_manager,
219
219
  resource_type="Service",
@@ -245,7 +245,7 @@ async def get_agent_spec(
245
245
  for pod in pods or []:
246
246
  pods_list[
247
247
  pod.metadata.name
248
- ] = k8s_manager.api_client.sanitize_for_serialization(pod)
248
+ ] = k8s_manager.api_client.sanitize_for_serialization(pod) # fmt: skip
249
249
  pods_list[pod.metadata.name]["events"] = await get_resource_events(
250
250
  k8s_manager=k8s_manager,
251
251
  resource_type="Pod",
@@ -256,7 +256,7 @@ async def get_agent_spec(
256
256
  for service in services or []:
257
257
  services_list[
258
258
  service.metadata.name
259
- ] = k8s_manager.api_client.sanitize_for_serialization(service)
259
+ ] = k8s_manager.api_client.sanitize_for_serialization(service) # fmt: skip
260
260
  services_list[service.metadata.name]["events"] = await get_resource_events(
261
261
  k8s_manager=k8s_manager,
262
262
  resource_type="Service",
@@ -62,7 +62,9 @@ class AsyncK8sManager(BaseK8sManager):
62
62
  async def is_pod_running(
63
63
  self, pod_id: str, container_id: str, namespace: str = None
64
64
  ) -> bool:
65
- event = await self.k8s_api.read_namespaced_pod_status(pod_id, namespace=namespace or self.namespace) # type: ignore[attr-defined]
65
+ event = await self.k8s_api.read_namespaced_pod_status(
66
+ pod_id, namespace=namespace or self.namespace
67
+ ) # type: ignore[attr-defined]
66
68
  return is_pod_running(event, container_id)
67
69
 
68
70
  async def _list_namespace_resource(
@@ -108,7 +110,7 @@ class AsyncK8sManager(BaseK8sManager):
108
110
  plural,
109
111
  reraise: bool = False,
110
112
  namespace: str = None,
111
- **kwargs
113
+ **kwargs,
112
114
  ) -> List:
113
115
  return await self._list_namespace_resource(
114
116
  resource_api=self.k8s_custom_object_api.list_namespaced_custom_object, # type: ignore[attr-defined]
@@ -273,7 +275,7 @@ class AsyncK8sManager(BaseK8sManager):
273
275
  field_selector: str = None,
274
276
  namespace: str = None,
275
277
  reraise: bool = False,
276
- **kwargs
278
+ **kwargs,
277
279
  ) -> List[client.CoreV1EventList]:
278
280
  return await self._list_namespace_resource(
279
281
  resource_api=self.k8s_api.list_namespaced_event, # type: ignore[attr-defined]
@@ -75,7 +75,7 @@ class K8sManager(BaseK8sManager):
75
75
  include_uninitialized=True,
76
76
  reraise: bool = False,
77
77
  namespace: str = None,
78
- **kwargs
78
+ **kwargs,
79
79
  ):
80
80
  return self._list_namespace_resource(
81
81
  resource_api=self.k8s_api.list_namespaced_pod,
@@ -89,7 +89,7 @@ class K8sManager(BaseK8sManager):
89
89
  include_uninitialized=True,
90
90
  reraise: bool = False,
91
91
  namespace: str = None,
92
- **kwargs
92
+ **kwargs,
93
93
  ):
94
94
  return self._list_namespace_resource(
95
95
  resource_api=self.k8s_batch_api.list_namespaced_job,
@@ -105,7 +105,7 @@ class K8sManager(BaseK8sManager):
105
105
  plural,
106
106
  reraise: bool = False,
107
107
  namespace: str = None,
108
- **kwargs
108
+ **kwargs,
109
109
  ):
110
110
  return self._list_namespace_resource(
111
111
  resource_api=self.k8s_custom_object_api.list_namespaced_custom_object,
@@ -747,7 +747,7 @@ class K8sManager(BaseK8sManager):
747
747
  include_uninitialized=True,
748
748
  reraise: bool = False,
749
749
  namespace: str = None,
750
- **kwargs
750
+ **kwargs,
751
751
  ):
752
752
  objs = self.list_pods(
753
753
  include_uninitialized=include_uninitialized,
@@ -765,7 +765,7 @@ class K8sManager(BaseK8sManager):
765
765
  include_uninitialized=True,
766
766
  reraise: bool = False,
767
767
  namespace: str = None,
768
- **kwargs
768
+ **kwargs,
769
769
  ):
770
770
  objs = self.list_jobs(
771
771
  include_uninitialized=include_uninitialized,
@@ -812,7 +812,7 @@ class K8sManager(BaseK8sManager):
812
812
  field_selector: str = None,
813
813
  namespace: str = None,
814
814
  reraise: bool = False,
815
- **kwargs
815
+ **kwargs,
816
816
  ) -> List[client.CoreV1EventList]:
817
817
  return self._list_namespace_resource(
818
818
  resource_api=self.k8s_api.list_namespaced_event, # type: ignore[attr-defined]
@@ -98,7 +98,7 @@ class EnvMixin(BaseConverter):
98
98
 
99
99
  try:
100
100
  secret_value = orjson_loads(resource.name)
101
- except orjson.JSONDecodeError as e:
101
+ except orjson.JSONDecodeError:
102
102
  return items_from
103
103
 
104
104
  for item in resource.items:
@@ -50,7 +50,7 @@ class InitConverter(_BaseConverter):
50
50
  env_from: List[Any],
51
51
  args: List[str],
52
52
  command: Optional[List[str]] = None,
53
- **kwargs
53
+ **kwargs,
54
54
  ) -> Optional[process_types.V1Container]:
55
55
  env = env or []
56
56
 
@@ -1,8 +1,6 @@
1
1
  from typing import List, Optional
2
2
 
3
3
  from polyaxon._connections import V1Connection, V1ConnectionResource
4
- from polyaxon._contexts import paths as ctx_paths
5
- from polyaxon._local_process import process_types
6
4
  from polyaxon._runner.converter import BaseConverter
7
5
 
8
6
 
@@ -18,7 +18,7 @@ class JobConverter(JobMixin, BaseConverter):
18
18
  default_sa: Optional[str] = None,
19
19
  default_auth: bool = False,
20
20
  ) -> List[process_types.V1Container]:
21
- job = compiled_operation.run # type: V1Job
21
+ job: V1Job = compiled_operation.run
22
22
  plugins = V1Plugins.get_or_create(
23
23
  config=compiled_operation.plugins, auth=default_auth
24
24
  )
@@ -1,7 +1,7 @@
1
1
  from typing import Dict, Iterable, List, Optional
2
2
 
3
3
  from polyaxon._connections import V1Connection, V1ConnectionResource
4
- from polyaxon._flow import V1CompiledOperation, V1Plugins, V1Service
4
+ from polyaxon._flow import V1CompiledOperation, V1Plugins
5
5
  from polyaxon._local_process import process_types
6
6
  from polyaxon._local_process.converter.base import BaseConverter
7
7
  from polyaxon._local_process.converter.mixins import ServiceMixin
@@ -22,8 +22,9 @@ class ProjectConfigManager(ConfigManager):
22
22
  project = cls.get_config()
23
23
  if not project:
24
24
  Printer.error(
25
- "No project was found, please initialize a project."
26
- " {}".format(cli_constants.INIT_COMMAND)
25
+ "No project was found, please initialize a project." " {}".format(
26
+ cli_constants.INIT_COMMAND
27
+ )
27
28
  )
28
29
  sys.exit(1)
29
30
 
@@ -93,8 +93,7 @@ def check_polyaxonfile(
93
93
  ):
94
94
  if sum([1 for i in [python_module, url, hub] if i]) > 1:
95
95
  message = (
96
- "You can only use one and only one option: "
97
- "hub, url, or a python module.".format(hub)
96
+ "You can only use one and only one option: hub, url, or a python module."
98
97
  )
99
98
  if is_cli:
100
99
  Printer.error(message, sys_exit=True)
@@ -213,8 +212,9 @@ def check_polyaxonfile(
213
212
  def check_polyaxonfile_kind(specification, kind):
214
213
  if specification.kind != kind:
215
214
  Printer.error(
216
- "Your polyaxonfile must be of kind: `{}`, "
217
- "received: `{}`.".format(kind, specification.kind),
215
+ "Your polyaxonfile must be of kind: `{}`, " "received: `{}`.".format(
216
+ kind, specification.kind
217
+ ),
218
218
  sys_exit=True,
219
219
  )
220
220
 
@@ -87,7 +87,7 @@ class CompiledOperationSpecification(BaseSpecification):
87
87
 
88
88
  @staticmethod
89
89
  def _apply_dag_context(config: V1CompiledOperation) -> V1CompiledOperation:
90
- dag_run = config.run # type: V1Dag
90
+ dag_run: V1Dag = config.run
91
91
  dag_run.process_dag()
92
92
  dag_run.validate_dag()
93
93
  dag_run.process_components(config.inputs)
@@ -318,12 +318,14 @@ class CompiledOperationSpecification(BaseSpecification):
318
318
  ) -> V1CompiledOperation:
319
319
  if not preset:
320
320
  return config
321
- preset = OperationSpecification.read(
322
- preset, is_preset=True
323
- ) # type: V1Operation
321
+ preset = OperationSpecification.read(preset, is_preset=True) # type: V1Operation
324
322
  if preset.run_patch:
325
323
  config.run = config.run.patch(
326
- validate_run_patch(preset.run_patch, config.run.kind),
324
+ validate_run_patch(
325
+ preset.run_patch,
326
+ config.run.kind,
327
+ replica_types=config.get_replica_types(),
328
+ ),
327
329
  strategy=preset.patch_strategy,
328
330
  )
329
331
  patch_keys = {
@@ -348,7 +350,7 @@ class CompiledOperationSpecification(BaseSpecification):
348
350
  "conditions",
349
351
  "skip_on_upstream_skip",
350
352
  }
351
- patch_keys = patch_keys.intersection(preset.__fields_set__)
353
+ patch_keys = patch_keys.intersection(preset.model_fields_set)
352
354
  patch_data = {k: getattr(preset, k) for k in patch_keys}
353
355
  patch_compiled = V1CompiledOperation.construct(**patch_data)
354
356
  return config.patch(patch_compiled, strategy=preset.patch_strategy)
@@ -61,9 +61,7 @@ class PolyaxonfileParser:
61
61
  return parsed_params
62
62
 
63
63
  @classmethod
64
- def parse_operation(
65
- cls, config, param_spec: Dict[str, ParamSpec]
66
- ): # pylint:disable=too-many-branches
64
+ def parse_operation(cls, config, param_spec: Dict[str, ParamSpec]): # pylint:disable=too-many-branches
67
65
  parsed_params = cls.get_parsed_params(param_spec)
68
66
 
69
67
  parsed_data = {Sections.VERSION: config.version, Sections.KIND: config.kind}
@@ -11,7 +11,7 @@ def validate(spec, data):
11
11
 
12
12
  def validate_keys(section, config, section_data):
13
13
  extra_args = [
14
- key for key in section_data.keys() if key not in config.__fields__.keys()
14
+ key for key in section_data.keys() if key not in config.model_fields.keys()
15
15
  ]
16
16
  if extra_args:
17
17
  raise PolyaxonfileError(
@@ -39,7 +39,7 @@ class OperationSpecification(BaseSpecification):
39
39
 
40
40
  config = config.patch(preset, preset.patch_strategy)
41
41
  # Patch run
42
- component = config.component # type: V1Component
42
+ component: V1Component = config.component
43
43
  if not component:
44
44
  raise PolyaxonSchemaError(
45
45
  "Compile operation received an invalid configuration: "
@@ -54,7 +54,11 @@ class OperationSpecification(BaseSpecification):
54
54
  else config.patch_strategy
55
55
  )
56
56
  component.run = component.run.patch(
57
- validate_run_patch(config.run_patch, component.run.kind),
57
+ validate_run_patch(
58
+ config.run_patch,
59
+ component.run.kind,
60
+ replica_types=component.get_replica_types(),
61
+ ),
58
62
  strategy=patch_strategy,
59
63
  )
60
64
 
@@ -107,7 +111,7 @@ class OperationSpecification(BaseSpecification):
107
111
  "conditions",
108
112
  "skip_on_upstream_skip",
109
113
  }
110
- patch_keys = patch_keys.intersection(config.__fields_set__)
114
+ patch_keys = patch_keys.intersection(config.model_fields_set)
111
115
  patch_data = {k: getattr(config, k) for k in patch_keys}
112
116
  patch_compiled = V1CompiledOperation.construct(contexts=contexts, **patch_data)
113
117
 
polyaxon/_pql/manager.py CHANGED
@@ -59,7 +59,7 @@ class PQLManager:
59
59
  if cls.FIELDS_TRANS[field].get("type"):
60
60
  update_tokenized_query[
61
61
  "{}_type".format(field_trans)
62
- ] = cls.FIELDS_TRANS[field]["type"]
62
+ ] = cls.FIELDS_TRANS[field]["type"] # fmt: skip
63
63
  else:
64
64
  update_tokenized_query[key] = tokenized_query[key]
65
65