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
@@ -0,0 +1,204 @@
1
+ """
2
+ Cloud File Storage Utilities
3
+
4
+ Common functions for verifying AWS EFS and GCP Filestore resources
5
+ across different cloud verification contexts.
6
+ """
7
+
8
+ from typing import Dict, Optional
9
+
10
+ import boto3
11
+
12
+ from anyscale.cli_logger import BlockLogger
13
+ from anyscale.client.openapi_client.models.cloud_deployment import CloudDeployment
14
+ from anyscale.client.openapi_client.models.cloud_providers import CloudProviders
15
+ from anyscale.client.openapi_client.models.file_storage import FileStorage
16
+ from anyscale.util import _get_aws_efs_mount_target_ip
17
+
18
+
19
+ class GCPFilestoreInfo:
20
+ """Container for GCP Filestore information"""
21
+
22
+ def __init__(
23
+ self,
24
+ filestore_id: str,
25
+ exists: bool,
26
+ mount_target_ip: Optional[str] = None,
27
+ root_dir: Optional[str] = None,
28
+ details: Optional[Dict] = None,
29
+ ):
30
+ self.filestore_id = filestore_id
31
+ self.exists = exists
32
+ self.mount_target_ip = mount_target_ip
33
+ self.root_dir = root_dir
34
+ self.details = details or {}
35
+
36
+
37
+ def _get_gcp_client_factory(logger, cloud_deployment: CloudDeployment):
38
+ """Helper function to get GCP client factory."""
39
+ from anyscale.cli_logger import CloudSetupLogger
40
+ from anyscale.utils.gcp_utils import get_google_cloud_client_factory
41
+
42
+ gcp_config = cloud_deployment.gcp_config or {}
43
+ project_id = gcp_config.get("project_id")
44
+
45
+ if not project_id:
46
+ raise ValueError("No GCP project_id found in cloud deployment config")
47
+
48
+ # Create GCP client factory - need to handle logger type mismatch
49
+ if isinstance(logger, CloudSetupLogger):
50
+ return get_google_cloud_client_factory(logger, project_id), project_id
51
+ else:
52
+ # Create a CloudSetupLogger wrapper for compatibility
53
+ cloud_setup_logger = CloudSetupLogger()
54
+ return (
55
+ get_google_cloud_client_factory(cloud_setup_logger, project_id),
56
+ project_id,
57
+ )
58
+
59
+
60
+ def _get_detailed_filestore_config(
61
+ factory, vpc_name: Optional[str], filestore_id: str, logger: BlockLogger
62
+ ):
63
+ """Helper function to get detailed filestore configuration."""
64
+ if not vpc_name:
65
+ return None, None
66
+
67
+ try:
68
+ from anyscale.cli_logger import CloudSetupLogger
69
+ from anyscale.utils import gcp_utils
70
+
71
+ cloud_setup_logger = CloudSetupLogger()
72
+ filestore_config = gcp_utils.get_gcp_filestore_config_from_full_name(
73
+ factory, vpc_name, filestore_id, cloud_setup_logger
74
+ )
75
+ if filestore_config:
76
+ return filestore_config.mount_target_ip, filestore_config.root_dir
77
+ except (ImportError, AttributeError, KeyError) as e:
78
+ logger.warning(f"Could not retrieve detailed filestore config: {e}")
79
+
80
+ return None, None
81
+
82
+
83
+ def get_gcp_filestore_info(
84
+ filestore_id: str,
85
+ cloud_deployment: CloudDeployment,
86
+ logger: Optional[BlockLogger] = None,
87
+ ) -> GCPFilestoreInfo:
88
+ """
89
+ Common function to fetch GCP Filestore information.
90
+
91
+ Args:
92
+ filestore_id: The GCP Filestore instance ID
93
+ cloud_deployment: CloudDeployment object containing GCP config
94
+ logger: Optional logger for output
95
+
96
+ Returns:
97
+ GCPFilestoreInfo object containing Filestore details and existence status
98
+ """
99
+ if logger is None:
100
+ logger = BlockLogger()
101
+
102
+ try:
103
+ from anyscale.cli_logger import CloudSetupLogger
104
+ from anyscale.gcp_verification import GCPLogger, verify_filestore
105
+
106
+ # Get GCP config and client factory
107
+ factory, project_id = _get_gcp_client_factory(logger, cloud_deployment)
108
+
109
+ gcp_config = cloud_deployment.gcp_config or {}
110
+ vpc_name = gcp_config.get("vpc_name")
111
+
112
+ if not vpc_name:
113
+ logger.warning("No VPC name found - may affect connectivity checks")
114
+
115
+ # Create GCP logger for filestore verification
116
+ gcp_logger = GCPLogger(CloudSetupLogger(), project_id, None, True)
117
+
118
+ # Use existing filestore verification logic
119
+ region = cloud_deployment.region or ""
120
+ verification_result = verify_filestore(
121
+ factory=factory,
122
+ file_store_instance_name=filestore_id,
123
+ vpc_name=vpc_name,
124
+ cloud_region=region,
125
+ logger=gcp_logger,
126
+ strict=False,
127
+ )
128
+
129
+ # Try to get detailed filestore config if available
130
+ mount_target_ip, root_dir = _get_detailed_filestore_config(
131
+ factory, vpc_name, filestore_id, logger
132
+ )
133
+
134
+ if verification_result:
135
+ logger.info(f"GCP Filestore {filestore_id} exists and is accessible")
136
+ return GCPFilestoreInfo(
137
+ filestore_id=filestore_id,
138
+ exists=True,
139
+ mount_target_ip=mount_target_ip,
140
+ root_dir=root_dir,
141
+ )
142
+ else:
143
+ logger.error(f"GCP Filestore {filestore_id} verification failed")
144
+ return GCPFilestoreInfo(filestore_id=filestore_id, exists=False)
145
+
146
+ except ImportError as e:
147
+ logger.warning(f"GCP verification dependencies not available: {e}")
148
+ # Don't fail verification if GCP deps are missing
149
+ return GCPFilestoreInfo(filestore_id=filestore_id, exists=True)
150
+ except (ValueError, AttributeError, KeyError) as e:
151
+ logger.error(f"Configuration error checking GCP Filestore {filestore_id}: {e}")
152
+ return GCPFilestoreInfo(filestore_id=filestore_id, exists=False)
153
+
154
+
155
+ def verify_file_storage_exists(
156
+ file_storage: FileStorage,
157
+ cloud_deployment: CloudDeployment,
158
+ logger: Optional[BlockLogger] = None,
159
+ ) -> bool:
160
+ """
161
+ Generic function to verify file storage exists based on cloud provider.
162
+
163
+ Args:
164
+ file_storage: File storage configuration object
165
+ cloud_deployment: CloudDeployment object
166
+ logger: Optional logger for output
167
+
168
+ Returns:
169
+ bool: True if file storage exists, False otherwise
170
+ """
171
+ if logger is None:
172
+ logger = BlockLogger()
173
+
174
+ file_storage_id = getattr(file_storage, "file_storage_id", None)
175
+ if not file_storage_id:
176
+ logger.warning("No file_storage_id provided - skipping existence check")
177
+ return True
178
+
179
+ provider_value = (
180
+ getattr(cloud_deployment.provider, "value", str(cloud_deployment.provider))
181
+ if cloud_deployment.provider
182
+ else None
183
+ )
184
+
185
+ if provider_value == CloudProviders.AWS:
186
+ region = cloud_deployment.region
187
+ if not region:
188
+ logger.error("No region found for AWS EFS verification")
189
+ return False
190
+
191
+ boto3_session = boto3.Session(region_name=region)
192
+ return _get_aws_efs_mount_target_ip(boto3_session, file_storage_id) is not None
193
+
194
+ elif provider_value == CloudProviders.GCP:
195
+ filestore_info = get_gcp_filestore_info(
196
+ file_storage_id, cloud_deployment, logger
197
+ )
198
+ return filestore_info.exists
199
+
200
+ else:
201
+ logger.warning(
202
+ f"File storage existence check not supported for provider: {provider_value}"
203
+ )
204
+ return True