Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Ray Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-ray-knowledge-patch)
---
name: ray-knowledge-patch
description: Ray
version: null
license: MIT
metadata:
author: Nevaberry
---
# Ray Knowledge Patch
Load this skill for Ray API migration, tasks and actors, Data pipelines,
Serve inference, Train and RLlib, Tune scheduling, and KubeRay operations.
Use the topic references for complete behavior, configuration, and examples.
## Reference index
| Reference | Topics |
| --- | --- |
| [Core Tasks and Actors](references/core-tasks-and-actors.md) | API migration, actor typing and cancellation, placement, isolation, direct transport, authentication, runtime environments, recovery, diagnostics, platform builds |
| [Ray Data Execution](references/data-execution.md) | Data API migration, sources and catalogs, expressions, batching, shuffle, autoscaling, checkpointing, tensors, preprocessing, batch inference, metrics |
| [KubeRay Jobs and Services](references/kuberay-jobs-and-services.md) | Submission modes, retry scopes, deadlines, suspension, deletion rules, service endpoints, Kubernetes authentication and scaling |
| [Ray Serve Runtime and Recovery](references/serve-runtime-and-recovery.md) | Serve migration, handles, ingress, routing, autoscaling, batching, controller recovery, metrics, LLM engines and inference |
| [Ray Train and API Lifecycle](references/train-and-api-lifecycle.md) | Public API lifecycle, Train migration, worker placement, ingestion, checkpoints, validation, preemption, RLlib algorithms and configuration |
| [Ray Tune Scheduling](references/tune-scheduling.md) | Logging migration, function trainables, time budgets, scheduler checkpoint requirements, resource changes, search compatibility |
## Breaking changes and deprecations
### Core and dependency migration
Ray removed `ray.init(local_mode=True)` and the experimental `_owner` argument
to `ray.put()`. `DAGNode.execute()` is deprecated.
Ray requires Pydantic V2 in 2.56.0. Python 3.9 support was dropped, and wheel
metadata requires Python 3.10 or later.
Use `STORAGE_ROOT_DIR` instead of `RAY_ROOT_DIR` for the History Server.
### Data migration
Replace `read_parquet_bulk()` with `ray.data.read_parquet()`.
The deprecated `TENSOR_COLUMN_NAME`, `meta_provider`, and `locality_with_output`
were removed. `read_tfrecords()` removed the `tfx-bsl` backend.
`ConcurrencyCapBackpressurePolicy`, `DataIterator.to_torch()`, pandas UDF batches,
`DataContext.scheduling_strategy`, `actor_locality_enabled`, `exclude_resources`,
`local://` paths, `Dataset.zip()`, and `ray_remote_args_fn` are deprecated.
Replace the subcluster label key `__subcluster__` with `ray-subcluster`.
### Serve configuration migration
Removed Serve environment settings for HTTP, gRPC, and logging are listed in
the Serve reference; configure these through `http_options`, `grpc_options`,
and `LoggingConfig`. The deprecated `DeploymentMode` API was removed.
Use `proxy_location` instead of `HTTPOptions.location`.
A nonzero `HTTPOptions.num_cpus` raises an error.
Direct ingress rejects ingress deployments using a custom request router or
`serve.multiplexed`. A subclass of an `@serve.ingress` class cannot define a
synchronous `__init__` without raising an error.
### Training, tuning, and LLM migration
Train V1 removed `Predictor`. Tune removed `Logger` and `logger_creator`.
`ray.train.report(..., checkpoint=...)` accepts only in-band checkpoints.
RLlib deprecated `LearnerGroup.load_module_state()`;
`MultiRLModuleSpec.rl_module_specs` must be a dictionary keyed by module ID.
Ray LLM removed `guided_decoding`, `truncate_prompt_tokens`, and
`build_llm_processor`; Serve LLM removed its config generator.
Use `apply_chat_template_stage`, `tokenize_stage`, and `detokenize_stage`
instead of the corresponding unsuffixed helpers.
`PrepareImageStage` was removed, and the `image` row column is deprecated.
Use `AcceleratorType` instead of `GPUType`.
Ray Data LLM and Ray Serve LLM APIs are beta.
## Data execution and recovery
### Batch size, concurrency, and ordering
Pass `batch_size=None` to `map_batches()` to give the UDF all rows of a block in one call.
GPU batch transforms require an explicit integer batch size; CPU transforms
can use `batch_size="auto"`.
Function transforms choose task concurrency automatically; callable classes
default to an autoscaling actor pool. A fixed `TaskPoolStrategy(size=2)` caps
task concurrency, while `ActorPoolStrategy(size=2)` uses two actors.
Set `ray.data.DataContext.get_current().execution_options.preserve_order = True`
before creating the dataset to preserve input block order.
`Dataset.sort()` and `Dataset.groupby()` introduce a materializing shuffle.
An asynchronous callable-class transform requires `uvloop==0.21.0`.
### Reader defaults and conversion
DataSourceV2 is the default for supported readers such as `read_parquet()`
starting in 2.57.0. Set the context before dataset creation to revert to V1:
```python
import ray.data
ray.data.DataContext.get_current().use_datasource_v2 = False
```
NumPy pickle loading defaults to off. Use `allow_pickle=True` when loading a trusted
NumPy file that requires pickle deserialization.
Ray Data blocks pickled object columns in untrusted Parquet files;
unsafe WebDataset deserialization requires opt-in.
`Dataset.write_lance()` raises an error in `CREATE` mode if the destination exists.
In Ray 2.60.1, Delta Lake reads and writes reject tables with column mapping enabled.
For the previous pandas conversion behavior starting in 2.56.1, set
`ray.data.DataContext.get_current().enable_arrow_backed_pandas_conversion = False`
before conversion or disable `RAY_DATA_ENABLE_ARROW_BACKED_PANDAS_CONVERSION`.
### Progress, retries, and autoscaling
Pipeline checkpoints support resuming interrupted processing, two-phase commits,
and checkpoint loading during recovery. Ray Data can retry transient UDF
exceptions and actor initialization failures.
`max_consecutive_actor_init_deaths` controls tolerated consecutive initialization deaths.
Execution fails if no operator makes progress within the timeout.
The utilization-based cluster autoscaler became the default in 2.54.0;
execution with `PlacementGroupSchedulingStrategy` disables it in 2.58.0.
## Serve routing, scaling, and recovery
Pass a `DeploymentResponse` directly to another handle's `.remote()` and await
the final response to chain calls. An unhandled deployment exception returns
HTTP 500 with traceback information; the replica can serve later requests.
Requests over HTTP, gRPC, and `DeploymentHandle` can continue during a controller
outage. Autoscaling pauses until recovery, then resumes with fresh metrics.
Serve restores controller configuration from GCS; a node failure can drop live
connections and queued requests. Use KubeRay `RayService` for full-cluster recovery.
### Autoscaling and batching controls
Set `lookback_period_s` strictly greater than `metrics_interval_s`.
`external_scaler_enabled` lets an external autoscaler control application replicas.
`apply_autoscaling_config` applies standard delays, factors, and replica bounds
to custom policies. Class-based policies accept `policy_kwargs`.
`TaskConsumer` deployments can scale from Redis or RabbitMQ pending tasks,
with a `QueueMonitor` actor measuring queue length.
A custom `@serve.batch` size function lets `max_batch_size` represent a token budget.
Each batch contains requests for one multiplexed model ID.
### Routing and inference controls
`choose_replica()` and `dispatch()` separate selection from dispatch with
replica-side slot reservation. Round-robin routing is experimental.
Forwarding request bodies to custom ingress routers requires explicit opt-in.
`RAY_SERVE_SESSION_ID_HEADER_KEY` selects the HTTP session-ID header for sticky routing.
With `RAY_SERVE_LLM_ENABLE_DIRECT_STREAMING=1`, use 2.56.1 or later for body-aware
routers such as `PrefixCacheAffinityRouter` to obtain the routing-hang fix.
With token authentication enabled, replica `ASGIService` requests require a valid token.
## Train ingestion and checkpoints
`ScalingConfig.label_selector` places workers on matching nodes.
`DataConfig.execution_options` can map dataset names to separate options.
Train replaces dataset execution options during ingestion: set the subcluster
selector both in the construction context and in the Trainer's `dataset_config`.
A serializable `DataConfig` subclass can perform shared setup in `configure()`
on the Trainer's main actor and return a dictionary of named iterators per worker.
Pass object-store memory limits through `dataset_config` to apply them during ingestion.
`get_all_reported_checkpoints()` supports `CheckpointConsistencyMode`; `timeout_s`
bounds the metadata wait. A metrics-only report no longer blocks retrieval.
`Result.get_best_checkpoint()` can rank by a nested metric.
Asynchronous validation requires a checkpoint, accepts remote task arguments,
and resumes when the training driver is restored.
With `delete_local_checkpoint_after_upload=True`, a local checkpoint inside
the experiment directory raises an error.
`Result.from_path()` reads saved results without modifying the experiment directory.
Ray Train validates that training function return values are serializable.
## Actor cancellation and task events
Running synchronous actor methods can poll
`ray.get_runtime_context().is_canceled()` for cooperative cancellation.
For a running async actor method, `ray.cancel(ref)` requests cancellation of its
`asyncio.Task`, which can take effect when the method yields at an `await`.
Calling `is_canceled()` inside an async actor task raises `RuntimeError`.
In-order actor tasks are sequenced within each concurrency group; ordering
across groups requires explicit coordination.
Method-level `enable_task_events` overrides the actor setting. Nested tasks use
their own settings, so configure each task whose events should be suppressed.
## Tune scheduling and budgets
Function trainables can yield metrics dictionaries; reserve `tune.report()`
for function trainables. Use `num_samples=-1` with `time_budget_s` for an
open-ended trial count bounded by total tuning time.
`ResourceChangingScheduler` changes trial resources and can wrap any Tune scheduler.
`TuneConfig.max_concurrent_trials` is honored with custom searchers.
| Scheduler | Checkpointing | Search compatibility |
| --- | --- | --- |
| ASHA, Median Stopping Rule | Optional | Search algorithms supported |
| HyperBand | Required | Search algorithms supported |
| BOHB | Required | Only `TuneBOHB` |
| PBT, PB2 | Required | Default search |
## KubeRay job lifecycle
`K8sJobMode` is the default. `HTTPMode` submits from the operator;
alpha `InteractiveMode` waits for user submission.
`SidecarMode` injects the submitter into the head Pod and requires
`restartPolicy: Never`; it excludes `clusterSelector`, `submitterPodTemplate`,
and `submitterConfig`. `submitterPodTemplate` applies only in `K8sJobMode`.
`spec.backoffLimit` defaults to `0` and creates a new RayCluster per RayJob retry.
`spec.submitterConfig.backoffLimit` defaults to `2` and retries the submitter Job.
`spec.suspend: true` deletes the RayCluster and submitter created for the RayJob;
let Kueue manage this field when it schedules the job.
With the `RayJobDeletionPolicy` gate enabled, KubeRay 1.6.0 supports beta
`spec.deletionStrategy.deletionRules`. Omit `shutdownAfterJobFinishes` and
`ttlSecondsAfterFinished` when using rules, and put delays on individual rules.
RayService readiness is a `Ready` condition of `True` with reason `NonZeroServeEndpoints`.
Use `<rayservice>-serve-svc` for HTTP traffic and `<rayservice>-head-svc`
for the active cluster's Dashboard.