anyscale 0.26.47__py3-none-any.whl → 0.26.49__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 (79) hide show
  1. anyscale/__init__.py +0 -7
  2. anyscale/_private/anyscale_client/README.md +115 -0
  3. anyscale/_private/anyscale_client/anyscale_client.py +12 -213
  4. anyscale/_private/anyscale_client/common.py +0 -55
  5. anyscale/_private/anyscale_client/fake_anyscale_client.py +19 -46
  6. anyscale/_private/docgen/__main__.py +32 -47
  7. anyscale/_private/docgen/generator.py +32 -16
  8. anyscale/_private/docgen/generator_legacy.py +58 -6
  9. anyscale/_private/docgen/models.md +3 -2
  10. anyscale/_private/workload/workload_config.py +16 -8
  11. anyscale/_private/workload/workload_sdk.py +24 -7
  12. anyscale/client/README.md +10 -2
  13. anyscale/client/openapi_client/__init__.py +6 -2
  14. anyscale/client/openapi_client/api/default_api.py +558 -8
  15. anyscale/client/openapi_client/models/__init__.py +6 -2
  16. anyscale/client/openapi_client/models/{alert_type.py → alert_issue_type.py} +8 -20
  17. anyscale/client/openapi_client/models/baseimagesenum.py +1 -2
  18. anyscale/client/openapi_client/models/cloud.py +31 -3
  19. anyscale/client/openapi_client/models/cloud_deployment.py +30 -3
  20. anyscale/client/openapi_client/models/cloud_with_cloud_resource.py +29 -1
  21. anyscale/client/openapi_client/models/cloud_with_cloud_resource_gcp.py +29 -1
  22. anyscale/client/openapi_client/models/dataset_metrics.py +6 -6
  23. anyscale/client/openapi_client/models/dataset_state.py +2 -1
  24. anyscale/client/openapi_client/models/decorated_cloud_deployment.py +481 -0
  25. anyscale/client/openapi_client/models/decoratedclouddeployment_response.py +121 -0
  26. anyscale/client/openapi_client/models/describe_system_workload_response.py +32 -6
  27. anyscale/client/openapi_client/models/experimental_workspace.py +29 -1
  28. anyscale/client/openapi_client/models/experimental_workspaces_sort_field.py +2 -1
  29. anyscale/client/openapi_client/models/metrics_query_response.py +121 -0
  30. anyscale/client/openapi_client/models/{clouddeployment_response.py → metricsqueryresponse_response.py} +11 -11
  31. anyscale/client/openapi_client/models/operator_metrics.py +8 -9
  32. anyscale/client/openapi_client/models/operator_status.py +102 -0
  33. anyscale/client/openapi_client/models/organization_usage_alert.py +20 -20
  34. anyscale/client/openapi_client/models/supportedbaseimagesenum.py +1 -2
  35. anyscale/cloud/models.py +330 -0
  36. anyscale/commands/cloud_commands.py +136 -44
  37. anyscale/commands/command_examples.py +54 -134
  38. anyscale/commands/compute_config_commands.py +7 -11
  39. anyscale/compute_config/__init__.py +2 -16
  40. anyscale/compute_config/_private/compute_config_sdk.py +27 -17
  41. anyscale/compute_config/commands.py +14 -44
  42. anyscale/compute_config/models.py +49 -26
  43. anyscale/controllers/cloud_controller.py +289 -171
  44. anyscale/controllers/cloud_file_storage_utils.py +204 -0
  45. anyscale/controllers/kubernetes_verifier.py +1570 -0
  46. anyscale/job/_private/job_sdk.py +17 -8
  47. anyscale/job/models.py +1 -1
  48. anyscale/scripts.py +0 -2
  49. anyscale/sdk/anyscale_client/models/baseimagesenum.py +1 -2
  50. anyscale/sdk/anyscale_client/models/cloud.py +31 -3
  51. anyscale/sdk/anyscale_client/models/supportedbaseimagesenum.py +1 -2
  52. anyscale/shared_anyscale_utils/headers.py +3 -0
  53. anyscale/shared_anyscale_utils/utils/id_gen.py +1 -0
  54. anyscale/version.py +1 -1
  55. anyscale/workspace/models.py +14 -7
  56. {anyscale-0.26.47.dist-info → anyscale-0.26.49.dist-info}/METADATA +1 -1
  57. {anyscale-0.26.47.dist-info → anyscale-0.26.49.dist-info}/RECORD +62 -73
  58. anyscale/commands/llm/dataset_commands.py +0 -269
  59. anyscale/commands/llm/group.py +0 -15
  60. anyscale/commands/llm/models_commands.py +0 -123
  61. anyscale/controllers/llm/__init__.py +0 -0
  62. anyscale/controllers/llm/models_controller.py +0 -144
  63. anyscale/llm/__init__.py +0 -2
  64. anyscale/llm/dataset/__init__.py +0 -2
  65. anyscale/llm/dataset/_private/__init__.py +0 -0
  66. anyscale/llm/dataset/_private/docs.py +0 -63
  67. anyscale/llm/dataset/_private/models.py +0 -71
  68. anyscale/llm/dataset/_private/sdk.py +0 -147
  69. anyscale/llm/model/__init__.py +0 -2
  70. anyscale/llm/model/_private/models_sdk.py +0 -62
  71. anyscale/llm/model/commands.py +0 -93
  72. anyscale/llm/model/models.py +0 -171
  73. anyscale/llm/model/sdk.py +0 -62
  74. anyscale/llm/sdk.py +0 -27
  75. {anyscale-0.26.47.dist-info → anyscale-0.26.49.dist-info}/WHEEL +0 -0
  76. {anyscale-0.26.47.dist-info → anyscale-0.26.49.dist-info}/entry_points.txt +0 -0
  77. {anyscale-0.26.47.dist-info → anyscale-0.26.49.dist-info}/licenses/LICENSE +0 -0
  78. {anyscale-0.26.47.dist-info → anyscale-0.26.49.dist-info}/licenses/NOTICE +0 -0
  79. {anyscale-0.26.47.dist-info → anyscale-0.26.49.dist-info}/top_level.txt +0 -0
@@ -16,6 +16,7 @@ from anyscale.cluster_compute import parse_cluster_compute_name_version
16
16
  from anyscale.compute_config.models import (
17
17
  CloudDeployment,
18
18
  ComputeConfig,
19
+ ComputeConfigType,
19
20
  ComputeConfigVersion,
20
21
  HeadNodeConfig,
21
22
  MarketType,
@@ -121,7 +122,7 @@ class PrivateComputeConfigSDK(BaseSDK):
121
122
 
122
123
  return api_models
123
124
 
124
- def _convert_compute_config_to_api_model(
125
+ def _convert_single_deployment_compute_config_to_api_model(
125
126
  self, compute_config: ComputeConfig
126
127
  ) -> CloudDeploymentComputeConfig:
127
128
  # We should only make the head node schedulable when it's the *only* node in the cluster.
@@ -167,7 +168,7 @@ class PrivateComputeConfigSDK(BaseSDK):
167
168
  )
168
169
 
169
170
  def create_compute_config(
170
- self, compute_config: ComputeConfig, *, name: Optional[str] = None
171
+ self, compute_config: ComputeConfigType, *, name: Optional[str] = None
171
172
  ) -> Tuple[str, str]:
172
173
  """Register the provided compute config and return its internal ID."""
173
174
 
@@ -179,10 +180,27 @@ class PrivateComputeConfigSDK(BaseSDK):
179
180
  "The latest version tag will be generated and returned."
180
181
  )
181
182
 
183
+ if isinstance(compute_config, MultiDeploymentComputeConfig):
184
+ return self.create_multi_deployment_compute_config(
185
+ compute_config, name=name
186
+ )
187
+ else:
188
+ assert isinstance(compute_config, ComputeConfig)
189
+ return self.create_single_deployment_compute_config(
190
+ compute_config, name=name
191
+ )
192
+
193
+ def create_single_deployment_compute_config(
194
+ self, compute_config: ComputeConfig, *, name: Optional[str] = None,
195
+ ) -> Tuple[str, str]:
196
+ """Register the provided single-deployment compute config and return its internal ID."""
197
+
182
198
  # Returns the default cloud if user-provided cloud is not specified (`None`).
183
199
  cloud_id = self.client.get_cloud_id(cloud_name=compute_config.cloud) # type: ignore
184
200
 
185
- deployment_config = self._convert_compute_config_to_api_model(compute_config)
201
+ deployment_config = self._convert_single_deployment_compute_config_to_api_model(
202
+ compute_config
203
+ )
186
204
 
187
205
  compute_config_api_model = ComputeTemplateConfig(
188
206
  cloud_id=cloud_id,
@@ -214,14 +232,6 @@ class PrivateComputeConfigSDK(BaseSDK):
214
232
  name: Optional[str] = None,
215
233
  ) -> Tuple[str, str]:
216
234
  """Register the provided multi-deployment compute config and return its internal ID."""
217
- if name is not None:
218
- _, version = parse_cluster_compute_name_version(name)
219
- if version is not None:
220
- raise ValueError(
221
- "A version tag cannot be provided when creating a compute config. "
222
- "The latest version tag will be generated and returned."
223
- )
224
-
225
235
  # Returns the default cloud if user-provided cloud is not specified (`None`).
226
236
  cloud_id = self.client.get_cloud_id(cloud_name=compute_config.cloud) # type: ignore
227
237
 
@@ -230,7 +240,9 @@ class PrivateComputeConfigSDK(BaseSDK):
230
240
  deployment_configs = []
231
241
  for config in compute_config.configs:
232
242
  assert isinstance(config, ComputeConfig)
233
- deployment_configs.append(self._convert_compute_config_to_api_model(config))
243
+ deployment_configs.append(
244
+ self._convert_single_deployment_compute_config_to_api_model(config)
245
+ )
234
246
  default_config = deployment_configs[0]
235
247
 
236
248
  compute_config_api_model = ComputeTemplateConfig(
@@ -369,7 +381,7 @@ class PrivateComputeConfigSDK(BaseSDK):
369
381
 
370
382
  return configs
371
383
 
372
- def _convert_cloud_deployment_compute_config_api_model_to_compute_config(
384
+ def _convert_cloud_deployment_compute_config_api_model_to_single_deployment_compute_config(
373
385
  self, cloud_name: str, api_model: CloudDeploymentComputeConfig,
374
386
  ) -> ComputeConfig:
375
387
  worker_nodes = None
@@ -431,7 +443,7 @@ class PrivateComputeConfigSDK(BaseSDK):
431
443
  configs = None
432
444
  if api_model_config.deployment_configs:
433
445
  configs = [
434
- self._convert_cloud_deployment_compute_config_api_model_to_compute_config(
446
+ self._convert_cloud_deployment_compute_config_api_model_to_single_deployment_compute_config(
435
447
  cloud.name, config
436
448
  )
437
449
  for config in api_model_config.deployment_configs
@@ -446,9 +458,7 @@ class PrivateComputeConfigSDK(BaseSDK):
446
458
  return ComputeConfigVersion(
447
459
  name=f"{api_model.name}:{api_model.version}",
448
460
  id=api_model.id,
449
- multi_deployment_config=MultiDeploymentComputeConfig(
450
- cloud=cloud.name, configs=configs,
451
- ),
461
+ config=MultiDeploymentComputeConfig(cloud=cloud.name, configs=configs),
452
462
  )
453
463
 
454
464
  # If there are no deployment configs, this is a compute config for a single cloud deployment - parse the top-level fields.
@@ -3,9 +3,8 @@ from typing import Optional
3
3
  from anyscale._private.sdk import sdk_command
4
4
  from anyscale.compute_config._private.compute_config_sdk import PrivateComputeConfigSDK
5
5
  from anyscale.compute_config.models import (
6
- ComputeConfig,
6
+ ComputeConfigType,
7
7
  ComputeConfigVersion,
8
- MultiDeploymentComputeConfig,
9
8
  )
10
9
 
11
10
 
@@ -15,7 +14,7 @@ _CREATE_EXAMPLE = """
15
14
  import anyscale
16
15
  from anyscale.compute_config.models import ComputeConfig, HeadNodeConfig, MarketType, WorkerNodeGroupConfig
17
16
 
18
- config = ComputeConfig(
17
+ single_deployment_compute_config = ComputeConfig(
19
18
  head_node=HeadNodeConfig(
20
19
  instance_type="m5.8xlarge",
21
20
  ),
@@ -33,39 +32,9 @@ config = ComputeConfig(
33
32
  ),
34
33
  ],
35
34
  )
36
- full_name: str = anyscale.compute_config.create(config, name="my-compute-config")
37
- """
35
+ full_name: str = anyscale.compute_config.create(single_deployment_compute_config, name="my-single-deployment-compute-config")
38
36
 
39
- _CREATE_ARG_DOCSTRINGS = {
40
- "config": "The config options defining the compute config.",
41
- "name": "The name of the compute config. This should *not* include a version tag. If a name is not provided, one will be automatically generated.",
42
- }
43
-
44
-
45
- @sdk_command(
46
- _COMPUTE_CONFIG_SDK_SINGLETON_KEY,
47
- PrivateComputeConfigSDK,
48
- doc_py_example=_CREATE_EXAMPLE,
49
- arg_docstrings=_CREATE_ARG_DOCSTRINGS,
50
- )
51
- def create(
52
- config: ComputeConfig,
53
- *,
54
- name: Optional[str],
55
- _private_sdk: Optional[PrivateComputeConfigSDK] = None,
56
- ) -> str:
57
- """Create a new version of a compute config.
58
-
59
- Returns the full name of the registered compute config, including the version.
60
- """
61
- full_name, _ = _private_sdk.create_compute_config(config, name=name) # type: ignore
62
- return full_name
63
-
64
-
65
- _CREATE_MULTI_DEPLOYMENT_EXAMPLE = """
66
- import anyscale
67
- from anyscale.compute_config.models import MultiDeploymentComputeConfig, ComputeConfig, HeadNodeConfig, WorkerNodeGroupConfig
68
- config = MultiDeploymentComputeConfig(
37
+ multi_deployment_compute_config = MultiDeploymentComputeConfig(
69
38
  configs=[
70
39
  ComputeConfig(
71
40
  cloud_deployment="vm-aws-us-west-1",
@@ -95,11 +64,11 @@ config = MultiDeploymentComputeConfig(
95
64
  )
96
65
  ]
97
66
  )
98
- full_name: str = anyscale.compute_config.create_multi_deployment(config, name="my-compute-config")
67
+ full_name: str = anyscale.compute_config.create(multi_deployment_compute_config, name="my-multi-deployment-compute-config")
99
68
  """
100
69
 
101
- _CREATE_MULTI_DEPLOYMENT_ARG_DOCSTRINGS = {
102
- "config": "The config options defining the multi-deployment compute config.",
70
+ _CREATE_ARG_DOCSTRINGS = {
71
+ "config": "The config options defining the compute config.",
103
72
  "name": "The name of the compute config. This should *not* include a version tag. If a name is not provided, one will be automatically generated.",
104
73
  }
105
74
 
@@ -107,19 +76,20 @@ _CREATE_MULTI_DEPLOYMENT_ARG_DOCSTRINGS = {
107
76
  @sdk_command(
108
77
  _COMPUTE_CONFIG_SDK_SINGLETON_KEY,
109
78
  PrivateComputeConfigSDK,
110
- doc_py_example=_CREATE_MULTI_DEPLOYMENT_EXAMPLE,
111
- arg_docstrings=_CREATE_MULTI_DEPLOYMENT_ARG_DOCSTRINGS,
79
+ doc_py_example=_CREATE_EXAMPLE,
80
+ arg_docstrings=_CREATE_ARG_DOCSTRINGS,
112
81
  )
113
- def create_multi_deployment(
114
- config: MultiDeploymentComputeConfig,
82
+ def create(
83
+ config: ComputeConfigType,
115
84
  *,
116
85
  name: Optional[str],
117
86
  _private_sdk: Optional[PrivateComputeConfigSDK] = None,
118
87
  ) -> str:
119
- """EXPERIMENTAL. Create a new version of a compute config with multiple possible cloud deployments.
88
+ """Create a new version of a compute config.
89
+
120
90
  Returns the full name of the registered compute config, including the version.
121
91
  """
122
- full_name, _ = _private_sdk.create_multi_deployment_compute_config(config, name=name) # type: ignore
92
+ full_name, _ = _private_sdk.create_compute_config(config, name=name) # type: ignore
123
93
  return full_name
124
94
 
125
95
 
@@ -315,7 +315,7 @@ worker_nodes:
315
315
 
316
316
  @dataclass(frozen=True)
317
317
  class ComputeConfig(ModelBase):
318
- """Configuration for instance types and cloud resources for a cluster."""
318
+ """Compute configuration for instance types and cloud resources for a cluster with a single cloud deployment."""
319
319
 
320
320
  __doc_py_example__ = """
321
321
  from anyscale.compute_config.models import (
@@ -586,7 +586,7 @@ advanced_instance_config: # (Optional) Defaults to no advanced configurations.
586
586
  default=False,
587
587
  repr=False,
588
588
  metadata={
589
- "docstring": "Allow worker groups to be automatically configured based on workload. When false, worker groups must be explicitly configured.",
589
+ "docstring": "Allow worker groups to be automatically configured based on the workload's logical resource requests. When false, worker groups must be explicitly configured.",
590
590
  },
591
591
  )
592
592
 
@@ -608,6 +608,7 @@ from anyscale.compute_config.models import (
608
608
  MultiDeploymentComputeConfig, ComputeConfig, HeadNodeConfig, WorkerNodeGroupConfig
609
609
  )
610
610
  config = MultiDeploymentComputeConfig(
611
+ cloud="my-cloud",
611
612
  configs=[
612
613
  ComputeConfig(
613
614
  cloud_deployment="vm-aws-us-west-1",
@@ -657,7 +658,6 @@ configs:
657
658
  min_nodes: 1
658
659
  max_nodes: 10
659
660
  """
660
-
661
661
  cloud: Optional[str] = field(
662
662
  default=None,
663
663
  metadata={
@@ -698,9 +698,6 @@ configs:
698
698
  assert isinstance(config, ComputeConfig)
699
699
  config_models.append(config)
700
700
 
701
- if not config.cloud_deployment:
702
- raise ValueError("'cloud_deployment' is required for each config.")
703
-
704
701
  if config.cloud:
705
702
  unique_clouds.add(config.cloud)
706
703
 
@@ -722,6 +719,47 @@ configs:
722
719
  return config_models
723
720
 
724
721
 
722
+ ComputeConfigType = Union[ComputeConfig, MultiDeploymentComputeConfig]
723
+
724
+
725
+ def compute_config_type_from_yaml(config_file: str) -> ComputeConfigType:
726
+ """
727
+ Parse a YAML compute config file into either a ComputeConfig or MultiDeploymentComputeConfig.
728
+ """
729
+ error_message = f"Could not parse config file '{config_file}' as a ComputeConfig or MultiDeploymentComputeConfig:\n"
730
+
731
+ try:
732
+ return ComputeConfig.from_yaml(config_file)
733
+ except Exception as e: # noqa: BLE001
734
+ error_message += f"ComputeConfig: {e}\n"
735
+
736
+ try:
737
+ return MultiDeploymentComputeConfig.from_yaml(config_file)
738
+ except Exception as e: # noqa: BLE001
739
+ error_message += f"MultiDeploymentComputeConfig: {e}\n"
740
+
741
+ raise TypeError(error_message.rstrip())
742
+
743
+
744
+ def compute_config_type_from_dict(config_dict: Dict) -> ComputeConfigType:
745
+ """
746
+ Parse a compute config dict into either a ComputeConfig or MultiDeploymentComputeConfig.
747
+ """
748
+ error_message = f"Could not parse config dict '{config_dict}' as a ComputeConfig or MultiDeploymentComputeConfig:\n"
749
+
750
+ try:
751
+ return ComputeConfig.from_dict(config_dict)
752
+ except Exception as e: # noqa: BLE001
753
+ error_message += f"ComputeConfig: {e}\n"
754
+
755
+ try:
756
+ return MultiDeploymentComputeConfig.from_dict(config_dict)
757
+ except Exception as e: # noqa: BLE001
758
+ error_message += f"MultiDeploymentComputeConfig: {e}\n"
759
+
760
+ raise TypeError(error_message.rstrip())
761
+
762
+
725
763
  @dataclass(frozen=True)
726
764
  class ComputeConfigVersion(ModelBase):
727
765
  """Details of a created version of a compute config.
@@ -775,29 +813,14 @@ config:
775
813
  if not isinstance(id, str):
776
814
  raise TypeError("'id' must be a string.")
777
815
 
778
- config: Optional[ComputeConfig] = field(
816
+ config: Optional[ComputeConfigType] = field(
779
817
  default=None, metadata={"docstring": "The compute configuration."},
780
818
  )
781
819
 
782
- def _validate_config(self, config: Optional[ComputeConfig]):
783
- if config is not None and not isinstance(config, ComputeConfig):
784
- raise TypeError("'config' must be a ComputeConfig")
785
-
786
- multi_deployment_config: Optional[MultiDeploymentComputeConfig] = field(
787
- default=None,
788
- repr=False,
789
- metadata={
790
- "docstring": "Compute configuration for a cluster with multiple possible cloud deployments.",
791
- "customer_hosted_only": True,
792
- },
793
- )
794
-
795
- def _validate_multi_deployment_config(
796
- self, multi_deployment_config: Optional[MultiDeploymentComputeConfig]
797
- ):
798
- if multi_deployment_config is not None and not isinstance(
799
- multi_deployment_config, MultiDeploymentComputeConfig
820
+ def _validate_config(self, config: Optional[ComputeConfigType]):
821
+ if config is not None and not isinstance(
822
+ config, (ComputeConfig, MultiDeploymentComputeConfig)
800
823
  ):
801
824
  raise TypeError(
802
- "'multi_deployment_config' must be a MultiDeploymentComputeConfig"
825
+ "'config' must be a ComputeConfig or MultiDeploymentComputeConfig"
803
826
  )