Skip to content

Commit

Permalink
[Java] Replace binary rewrite with Remote Lambda Cache (SerdeLambda) (r…
Browse files Browse the repository at this point in the history
…ay-project#2245)

* <feature> : serde lambda

* <feature>:fixed CR

with issue ray-project#2245

* <feature>: fixed CR
  • Loading branch information
mylinyuzhi authored and pcmoritz committed Jun 13, 2018
1 parent 62de86f commit fa0ade2
Show file tree
Hide file tree
Showing 89 changed files with 2,623 additions and 7,658 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,8 @@ build

# Vscode
.vscode/

*.iml
java/**/target
java/run
java/test/lib
7 changes: 0 additions & 7 deletions java/api/src/main/java/org/ray/api/Ray.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,6 @@ static RayApi internal() {
return impl;
}

/**
* whether to use remote lambda.
*/
public static boolean isRemoteLambda() {
return impl.isRemoteLambda();
}

/**
* for ray's app's log.
*/
Expand Down
4 changes: 2 additions & 2 deletions java/api/src/main/java/org/ray/api/RayActor.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Ray actor abstraction.
*/
public class RayActor<T> extends RayObject<T> implements Externalizable {

public static final RayActor<?> nil = new RayActor<>(UniqueID.nil, UniqueID.nil);
private static final long serialVersionUID = 1877485807405645036L;

private int taskCounter = 0;
Expand Down Expand Up @@ -84,4 +84,4 @@ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundExcept
this.actorHandleId = (UniqueID) in.readObject();
this.taskCursor = (UniqueID) in.readObject();
}
}
}
30 changes: 11 additions & 19 deletions java/api/src/main/java/org/ray/api/RayApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import org.ray.api.internal.Callable;
import org.ray.api.internal.RayFunc;
import org.ray.util.exception.TaskExecutionException;

/**
Expand Down Expand Up @@ -54,14 +54,13 @@ public interface RayApi {
* submit a new task by invoking a remote function.
*
* @param taskId nil
* @param funcRun the target running function with @RayRemote
* @param funcCls the target running function's class
* @param lambda the target running function
* @param returnCount the number of to-be-returned objects from funcRun
* @param args arguments to this funcRun, can be its original form or RayObject
* @return a set of ray objects with their return ids
*/
RayObjects call(UniqueID taskId, Callable funcRun, int returnCount, Object... args);

RayObjects call(UniqueID taskId, Class<?> funcCls, Serializable lambda, int returnCount,
RayObjects call(UniqueID taskId, Class<?> funcCls, RayFunc lambda, int returnCount,
Object... args);

/**
Expand All @@ -71,34 +70,27 @@ RayObjects call(UniqueID taskId, Class<?> funcCls, Serializable lambda, int retu
* outputs with a set of labels (usually with Integer or String).
*
* @param taskId nil
* @param funcRun the target running function with @RayRemote
* @param returnIds a set of labels to be used by the returned objects
* @param funcCls the target running function's class
* @param lambda the target running function
* @param returnids a set of labels to be used by the returned objects
* @param args arguments to this funcRun, can be its original form or
* RayObject<original-type>
* @return a set of ray objects with their labels and return ids
*/
<R, RIDT> RayMap<RIDT, R> callWithReturnLabels(UniqueID taskId, Callable funcRun,
Collection<RIDT> returnIds, Object... args);

<R, RIDT> RayMap<RIDT, R> callWithReturnLabels(UniqueID taskId, Class<?> funcCls,
Serializable lambda, Collection<RIDT> returnids,
Object... args);
RayFunc lambda, Collection<RIDT> returnids, Object... args);

/**
* a special case for the above RID-based labeling as <0...returnCount - 1>.
*
* @param taskId nil
* @param funcRun the target running function with @RayRemote
* @param funcCls the target running function's class
* @param lambda the target running function
* @param returnCount the number of to-be-returned objects from funcRun
* @param args arguments to this funcRun, can be its original form or
* RayObject<original-type>
* @return an array of returned objects with their Unique ids
*/
<R> RayList<R> callWithReturnIndices(UniqueID taskId, Callable funcRun, Integer returnCount,
Object... args);

<R> RayList<R> callWithReturnIndices(UniqueID taskId, Class<?> funcCls, Serializable lambda,
<R> RayList<R> callWithReturnIndices(UniqueID taskId, Class<?> funcCls, RayFunc lambda,
Integer returnCount, Object... args);

boolean isRemoteLambda();
}
Loading

0 comments on commit fa0ade2

Please sign in to comment.