Options check for Ray actors. Args: options: Options for Ray actors. in_options: If True, we are checking the options under the context of ".options()".
(options: Dict[str, Any], in_options: bool)
| 349 | |
| 350 | |
| 351 | def validate_actor_options(options: Dict[str, Any], in_options: bool): |
| 352 | """Options check for Ray actors. |
| 353 | |
| 354 | Args: |
| 355 | options: Options for Ray actors. |
| 356 | in_options: If True, we are checking the options under the context of |
| 357 | ".options()". |
| 358 | """ |
| 359 | for k, v in options.items(): |
| 360 | if k not in actor_options: |
| 361 | raise ValueError( |
| 362 | f"Invalid option keyword {k} for actors. " |
| 363 | f"Valid ones are {list(actor_options)}." |
| 364 | ) |
| 365 | actor_options[k].validate(k, v) |
| 366 | |
| 367 | if in_options and "concurrency_groups" in options: |
| 368 | raise ValueError( |
| 369 | "Setting 'concurrency_groups' is not supported in '.options()'." |
| 370 | ) |
| 371 | |
| 372 | if options.get("get_if_exists") and not options.get("name"): |
| 373 | raise ValueError("The actor name must be specified to use `get_if_exists`.") |
| 374 | |
| 375 | if "object_store_memory" in options: |
| 376 | warnings.warn( |
| 377 | "Setting 'object_store_memory'" |
| 378 | " for actors is deprecated since it doesn't actually" |
| 379 | " reserve the required object store memory." |
| 380 | f" Use object spilling that's enabled by default (https://docs.ray.io/en/{get_ray_doc_version()}/ray-core/objects/object-spilling.html) " # noqa: E501 |
| 381 | "instead to bypass the object store memory size limitation.", |
| 382 | DeprecationWarning, |
| 383 | stacklevel=1, |
| 384 | ) |
| 385 | |
| 386 | _check_deprecate_placement_group(options) |
| 387 | |
| 388 | |
| 389 | def validate_num_returns(is_generator_callable: bool, num_returns: Any) -> None: |
searching dependent graphs…