Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Ray project Ray TaskCaller

From Leeroopedia
Revision as of 13:48, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Ray_project_Ray_TaskCaller.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Distributed_Computing, Java_API
Last Updated 2026-02-13 16:00 GMT

Overview

Fluent builder for invoking a Java remote function that returns a value provided by the Ray Java API.

Description

TaskCaller<R> extends BaseTaskCaller<TaskCaller<R>> to inherit common task options (name, resources, placement group, runtime environment). It holds a RayFuncR<R> function reference and Object[] arguments. The remote() method calls Ray.internal().call(func, args, buildOptions()) and returns an ObjectRef<R> representing the future result stored in the object store.

Usage

Use this class as the primary builder for Java remote function calls with return values. It is the builder returned by Ray.task(SomeClass::someMethod, args) and enables the fluent Ray.task(...).setResource(...).remote() pattern for configuring and dispatching remote tasks.

Code Reference

Source Location

  • Repository: Ray
  • File: java/api/src/main/java/io/ray/api/call/TaskCaller.java

Signature

public class TaskCaller<R> extends BaseTaskCaller<TaskCaller<R>> {
    public TaskCaller(RayFuncR<R> func, Object[] args);
    public ObjectRef<R> remote();
}

Import

import io.ray.api.call.TaskCaller;

I/O Contract

Inputs

Name Type Required Description
func RayFuncR<R> Yes A function reference to the remote Java method
args Object[] Yes Arguments to pass to the remote function

Outputs

Name Type Description
result ObjectRef<R> Reference to the future result in the object store

Usage Examples

// Invoke a remote function with configuration
ObjectRef<String> result = Ray.task(MyClass::processData, inputData)
    .setName("process-data-task")
    .setResource("CPU", 2.0)
    .setPlacementGroup(myGroup)
    .remote();

// Get the result
String output = result.get();

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment