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
@@ -11,11 +11,19 @@ from anyscale import scripts
11
11
  from anyscale._private.docgen.generator import MarkdownGenerator, Module
12
12
  from anyscale.aggregated_instance_usage.models import DownloadCSVFilters
13
13
  from anyscale.cloud.models import (
14
+ AWSConfig,
14
15
  Cloud,
16
+ CloudDeployment,
15
17
  CloudPermissionLevel,
16
18
  CloudProvider,
17
19
  ComputeStack,
18
20
  CreateCloudCollaborator,
21
+ FileStorage,
22
+ GCPConfig,
23
+ KubernetesConfig,
24
+ NetworkingMode,
25
+ NFSMountTarget,
26
+ ObjectStorage,
19
27
  )
20
28
  from anyscale.commands import (
21
29
  aggregated_instance_usage_commands,
@@ -39,9 +47,8 @@ from anyscale.commands import (
39
47
  workspace_commands,
40
48
  workspace_commands_v2,
41
49
  )
42
- from anyscale.commands.llm import dataset_commands, models_commands
43
50
  from anyscale.compute_config.models import (
44
- CloudDeployment,
51
+ CloudDeployment as CloudDeploymentSelector,
45
52
  ComputeConfig,
46
53
  ComputeConfigVersion,
47
54
  HeadNodeConfig,
@@ -61,12 +68,6 @@ from anyscale.job.models import (
61
68
  JobState,
62
69
  JobStatus,
63
70
  )
64
- from anyscale.llm.dataset._private.models import Dataset
65
- from anyscale.llm.model.models import (
66
- DeletedFineTunedModel,
67
- FineTunedModel,
68
- FineTuningType,
69
- )
70
71
  from anyscale.organization_invitation.models import OrganizationInvitation
71
72
  from anyscale.project.models import CreateProjectCollaborator, ProjectPermissionLevel
72
73
  from anyscale.resource_quota.models import CreateResourceQuota, Quota, ResourceQuota
@@ -315,10 +316,11 @@ ALL_MODULES = [
315
316
  ],
316
317
  models=[
317
318
  ComputeConfig,
319
+ MultiDeploymentComputeConfig,
318
320
  HeadNodeConfig,
319
321
  WorkerNodeGroupConfig,
320
322
  MarketType,
321
- CloudDeployment,
323
+ CloudDeploymentSelector,
322
324
  MultiDeploymentComputeConfig,
323
325
  ComputeConfigVersion,
324
326
  ],
@@ -433,7 +435,10 @@ ALL_MODULES = [
433
435
  cloud_commands.cloud_delete,
434
436
  cloud_commands.cloud_verify,
435
437
  cloud_commands.list_cloud,
436
- cloud_commands.cloud_add_deployment,
438
+ cloud_commands.cloud_deployment_create,
439
+ cloud_commands.cloud_deployment_get,
440
+ cloud_commands.cloud_deployment_update,
441
+ cloud_commands.cloud_deployment_delete,
437
442
  cloud_commands.cloud_config_update,
438
443
  cloud_commands.cloud_set_default,
439
444
  cloud_commands.add_collaborators,
@@ -449,13 +454,27 @@ ALL_MODULES = [
449
454
  anyscale.cloud.terminate_system_cluster,
450
455
  ],
451
456
  models=[
457
+ Cloud,
452
458
  CloudPermissionLevel,
453
459
  CreateCloudCollaborator,
454
- Cloud,
460
+ CloudDeployment,
455
461
  ComputeStack,
456
462
  CloudProvider,
457
- ],
458
- cli_command_group_prefix={cloud_commands.cloud_config_update: "config"},
463
+ NetworkingMode,
464
+ ObjectStorage,
465
+ FileStorage,
466
+ NFSMountTarget,
467
+ AWSConfig,
468
+ GCPConfig,
469
+ KubernetesConfig,
470
+ ],
471
+ cli_command_group_prefix={
472
+ cloud_commands.cloud_deployment_create: "deployment",
473
+ cloud_commands.cloud_deployment_get: "deployment",
474
+ cloud_commands.cloud_deployment_update: "deployment",
475
+ cloud_commands.cloud_deployment_delete: "deployment",
476
+ cloud_commands.cloud_config_update: "config",
477
+ },
459
478
  legacy_sdk_commands={
460
479
  # limited support, no replacement yet
461
480
  "get_cloud": None,
@@ -582,40 +601,6 @@ ALL_MODULES = [
582
601
  "UpdateCluster",
583
602
  ],
584
603
  ),
585
- Module(
586
- title="LLM Model",
587
- filename="llm_models.md",
588
- cli_prefix="anyscale llm model",
589
- cli_commands=[
590
- models_commands.get_model,
591
- models_commands.list_models,
592
- models_commands.delete_model,
593
- ],
594
- sdk_prefix="anyscale.llm.model",
595
- sdk_commands=[
596
- anyscale.llm.model.get,
597
- anyscale.llm.model.list,
598
- anyscale.llm.model.delete,
599
- ],
600
- models=[FineTunedModel, FineTuningType, DeletedFineTunedModel],
601
- ),
602
- Module(
603
- title="LLM Dataset",
604
- filename="llm_dataset.md",
605
- cli_prefix="anyscale llm dataset",
606
- cli_commands=[
607
- dataset_commands.get_dataset,
608
- dataset_commands.upload_dataset,
609
- dataset_commands.download_dataset,
610
- ],
611
- sdk_prefix="anyscale.llm.dataset",
612
- sdk_commands=[
613
- anyscale.llm.dataset.get,
614
- anyscale.llm.dataset.upload,
615
- anyscale.llm.dataset.download,
616
- ],
617
- models=[Dataset],
618
- ),
619
604
  Module(
620
605
  title="Resource quotas",
621
606
  filename="resource-quotas.md",
@@ -46,6 +46,20 @@ CUSTOMER_HOSTED_QUALIFIER = (
46
46
  )
47
47
 
48
48
 
49
+ def _escape_mdx_content(text: str) -> str:
50
+ """Escape content for MDX compatibility.
51
+
52
+ This function escapes angle brackets that could be interpreted as HTML tags
53
+ by MDX, converting them to escaped versions.
54
+ """
55
+ import re
56
+
57
+ # Escape angle brackets that look like HTML tags but are meant as literal text
58
+ # This pattern matches <word> or <word-with-hyphens> but not actual markdown/HTML
59
+ text = re.sub(r"<([a-zA-Z][a-zA-Z0-9\-]*?)>", r"\\<\1\\>", text)
60
+ return text
61
+
62
+
49
63
  @dataclass
50
64
  class Module:
51
65
  title: str
@@ -276,12 +290,13 @@ class MarkdownGenerator:
276
290
  - __doc_py_example__ (required in sdks)
277
291
  - __doc_cli_example__ (required for models and cli commands)
278
292
  """
293
+ skip_py_example: bool = getattr(t, "__skip_py_example__", False)
279
294
  yaml_example: Optional[str] = getattr(t, "__doc_yaml_example__", None)
280
295
  py_example: Optional[str] = getattr(t, "__doc_py_example__", None)
281
296
  cli_example: Optional[str] = getattr(t, "__doc_cli_example__", None)
282
297
 
283
298
  if isinstance(t, ModelBaseType):
284
- if not py_example:
299
+ if not skip_py_example and not py_example:
285
300
  raise ValueError(
286
301
  f"Model '{t.__name__}' is missing a '__doc_py_example__'."
287
302
  )
@@ -370,24 +385,25 @@ class MarkdownGenerator:
370
385
  f"Model '{t.__name__}' is missing a docstring for field '{field.name}'"
371
386
  )
372
387
 
373
- md += f"- **`{field.name}` ({self._model_type_to_string(field.type)})**: {docstring}\n"
388
+ md += f"- **`{field.name}` ({self._model_type_to_string(field.type)})**: {_escape_mdx_content(docstring)}\n"
374
389
 
375
390
  customer_hosted_only = field.metadata.get("customer_hosted_only", False)
376
391
  if customer_hosted_only:
377
392
  md += f" - {CUSTOMER_HOSTED_QUALIFIER}\n"
378
393
  md += "\n\n"
379
394
 
380
- md += "#### Python Methods\n\n"
381
- md += "```python\n"
382
- if t.__name__.endswith("Config"):
383
- # Only include constructor docs for config models.
384
- md += f"def __init__(self, **fields) -> {t.__name__}\n"
385
- md += ' """Construct a model with the provided field values set."""\n\n'
386
- md += f"def options(self, **fields) -> {t.__name__}\n"
387
- md += ' """Return a copy of the model with the provided field values overwritten."""\n\n'
388
- md += "def to_dict(self) -> Dict[str, Any]\n"
389
- md += ' """Return a dictionary representation of the model."""\n'
390
- md += "```\n"
395
+ if not getattr(t, "__skip_py_example__", False):
396
+ md += "#### Python Methods\n\n"
397
+ md += "```python\n"
398
+ if t.__name__.endswith("Config"):
399
+ # Only include constructor docs for config models.
400
+ md += f"def __init__(self, **fields) -> {t.__name__}\n"
401
+ md += ' """Construct a model with the provided field values set."""\n\n'
402
+ md += f"def options(self, **fields) -> {t.__name__}\n"
403
+ md += ' """Return a copy of the model with the provided field values overwritten."""\n\n'
404
+ md += "def to_dict(self) -> Dict[str, Any]\n"
405
+ md += ' """Return a dictionary representation of the model."""\n'
406
+ md += "```\n"
391
407
 
392
408
  md += self._gen_example_tabs(t)
393
409
  elif isinstance(t, ModelEnumType):
@@ -545,7 +561,7 @@ class MarkdownGenerator:
545
561
  md += ":::warning[Limited support]\n"
546
562
  md += "This command is not actively maintained. Use with caution.\n"
547
563
  md += ":::\n"
548
- md += legacy_sdk.docstring + "\n"
564
+ md += _escape_mdx_content(legacy_sdk.docstring) + "\n"
549
565
 
550
566
  return md
551
567
 
@@ -555,7 +571,7 @@ class MarkdownGenerator:
555
571
  The sections will be:
556
572
  - All fields and their types
557
573
  """
558
- md = f"### `{legacy_model.name}` <span class='label-h3 label-legacy'>Legacy</span>\n"
559
- md += legacy_model.docstring + "\n"
574
+ md = f"### `{legacy_model.name}` <span class='label-h3 label-legacy'>Legacy</span> {{#{legacy_model.name.lower()}-legacy}}\n"
575
+ md += _escape_mdx_content(legacy_model.docstring) + "\n"
560
576
 
561
577
  return md
@@ -1,5 +1,5 @@
1
1
  import re
2
- from typing import List, Tuple
2
+ from typing import Dict, List, Tuple
3
3
 
4
4
 
5
5
  ANYSCALE_SDK_INTRO = """\
@@ -18,6 +18,57 @@ sdk = AnyscaleSDK()
18
18
  """
19
19
 
20
20
 
21
+ def _build_model_to_module_mapping() -> Dict[str, str]:
22
+ """Build mapping from model name (lowercase) to module filename.
23
+
24
+ This dynamically discovers the mapping from ALL_MODULES configuration,
25
+ eliminating the need for hardcoded constants.
26
+ """
27
+ # Import here to avoid circular imports
28
+ from anyscale._private.docgen.__main__ import ALL_MODULES
29
+
30
+ model_name_to_file = {}
31
+
32
+ for module in ALL_MODULES:
33
+ # Current models (Python types)
34
+ for model_type in module.models:
35
+ model_name_to_file[model_type.__name__.lower()] = module.filename
36
+
37
+ # Legacy models (strings)
38
+ if module.legacy_sdk_models:
39
+ for model_name in module.legacy_sdk_models:
40
+ model_name_to_file[model_name.lower()] = module.filename
41
+
42
+ return model_name_to_file
43
+
44
+
45
+ def _transform_legacy_links(text: str) -> str:
46
+ """Transform legacy model links to include proper cross-module references."""
47
+ # Build the mapping dynamically
48
+ model_mapping = _build_model_to_module_mapping()
49
+
50
+ def replace_link(match):
51
+ model_name = match.group(1)
52
+ if model_name in model_mapping:
53
+ module_file = model_mapping[model_name]
54
+ return f"({module_file}#{model_name}-legacy)"
55
+ else:
56
+ # Fallback for unmapped models (stay in same file)
57
+ return f"(#{model_name}-legacy)"
58
+
59
+ # Transform links from (#modelname) to proper cross-module references
60
+ text = re.sub(r"\(#([a-z]+)\)", replace_link, text)
61
+
62
+ # Transform workspace command references to point to workspaces.md
63
+ text = re.sub(
64
+ r"\(#anyscale-workspace_v2-([a-z]+)\)",
65
+ r"(workspaces.md#anyscale-workspace_v2-\1)",
66
+ text,
67
+ )
68
+
69
+ return text
70
+
71
+
21
72
  class LegacySDK:
22
73
  def __init__(self, name: str, docstring: str):
23
74
  self.name = name
@@ -35,9 +86,10 @@ class LegacySDK:
35
86
  if line.startswith("### "):
36
87
  name = line[4:]
37
88
  else:
38
- docstring += (
39
- re.sub("\\(./models.md#([a-z]+)\\)", "(#\\1-legacy)", line) + "\n"
40
- )
89
+ # First transform ./models.md links, then transform local links
90
+ line = re.sub(r"\(./models\.md#([a-z]+)\)", r"(#\1-legacy)", line)
91
+ line = _transform_legacy_links(line)
92
+ docstring += line + "\n"
41
93
 
42
94
  return cls(name=name, docstring=docstring.strip())
43
95
 
@@ -50,7 +102,7 @@ class LegacyModel:
50
102
  @classmethod
51
103
  def from_md(cls, md: str) -> "LegacyModel":
52
104
  """
53
- Convert a blob of markdown into a LegacySDK object.
105
+ Convert a blob of markdown into a LegacyModel object.
54
106
  """
55
107
  name = ""
56
108
  docstring = ""
@@ -59,7 +111,7 @@ class LegacyModel:
59
111
  if line.startswith("## "):
60
112
  name = line[3:]
61
113
  else:
62
- docstring += re.sub("\\(#([a-z]+)\\)", "(#\\1-legacy)", line) + "\n"
114
+ docstring += _transform_legacy_links(line) + "\n"
63
115
 
64
116
  return cls(name=name, docstring=docstring.strip())
65
117