Implementation:Ray project Ray LocalModeTaskSubmitter
| Knowledge Sources | |
|---|---|
| Domains | Distributed_Computing, Java_Runtime |
| Last Updated | 2026-02-13 16:00 GMT |
Overview
Full task submission implementation for local mode that simulates Ray cluster task scheduling, actor lifecycle, and concurrency groups entirely within a single JVM process.
Description
LocalModeTaskSubmitter implements the TaskSubmitter interface to provide an in-process simulation of Ray's distributed task scheduling. It builds protobuf TaskSpec messages from function descriptors and arguments, tracks dependency readiness via a waiting-tasks map, and dispatches tasks to thread pools. The class manages per-actor concurrency groups with dedicated ExecutorService instances, supports named actors via a ConcurrentHashMap, and simulates placement groups as in-memory objects.
Usage
Use LocalModeTaskSubmitter when running Ray in local mode for testing and development. It is automatically selected by the runtime when RunMode.LOCAL is configured, allowing developers to test Ray applications without a cluster by faithfully simulating task scheduling, actor concurrency, and dependency resolution in-process.
Code Reference
Source Location
- Repository: Ray
- File:
java/runtime/src/main/java/io/ray/runtime/task/LocalModeTaskSubmitter.java
Signature
public class LocalModeTaskSubmitter implements TaskSubmitter {
private final Map<ObjectId, Set<TaskSpec>> waitingTasks;
private final Object taskAndObjectLock;
private final AbstractRayRuntime runtime;
private final TaskExecutor taskExecutor;
private final LocalModeObjectStore objectStore;
private final Map<ActorId, Integer> actorMaxConcurrency;
private final ExecutorService normalTaskExecutorService;
private final Map<ActorId, LocalModeActorHandle> actorHandles;
private final Map<String, ActorHandle> namedActors;
private final Map<ActorId, TaskExecutor.ActorContext> actorContexts;
private final Map<PlacementGroupId, PlacementGroup> placementGroups;
private final ActorConcurrencyGroupManager actorConcurrencyGroupManager;
public LocalModeTaskSubmitter(
AbstractRayRuntime runtime,
TaskExecutor taskExecutor,
LocalModeObjectStore objectStore) { ... }
public void onObjectPut(ObjectId id) { ... }
}
Import
import io.ray.runtime.task.LocalModeTaskSubmitter;
I/O Contract
Input
| Parameter | Type | Description |
|---|---|---|
runtime |
AbstractRayRuntime |
The Ray runtime instance providing worker context and function management |
taskExecutor |
TaskExecutor |
Executor responsible for running task logic (function resolution, invocation) |
objectStore |
LocalModeObjectStore |
In-memory object store for local mode object put/get operations |
Output
| Method | Return Type | Description |
|---|---|---|
onObjectPut |
void |
Triggers execution of any tasks waiting on the given object ID dependency |
submitTask |
List<ObjectId> |
Submits a normal task and returns output object IDs |
createActor |
BaseActorHandle |
Creates an actor and returns its handle |
createPlacementGroup |
PlacementGroup |
Creates a simulated placement group |
Usage Examples
// LocalModeTaskSubmitter is typically instantiated internally by the runtime
LocalModeTaskSubmitter submitter = new LocalModeTaskSubmitter(
runtime, taskExecutor, objectStore);
// When an object is put into the store, notify the submitter
// so that any tasks waiting on this dependency can proceed
submitter.onObjectPut(objectId);