Rename max_reconstructions to max_restarts and use -1 for infinite (#8274)

Co-authored-by: Edward Oakes <ed.nmi.oakes@gmail.com>
This commit is contained in:
Max Fitton
2020-05-14 08:30:29 -07:00
committed by GitHub
parent 5f4c196fed
commit 00325eb2b2
71 changed files with 403 additions and 393 deletions
@@ -18,9 +18,9 @@ public interface BaseActor {
* Kill the actor immediately. This will cause any outstanding tasks submitted to the actor to
* fail and the actor to exit in the same way as if it crashed.
*
* @param noReconstruction If set to true, the killed actor will not be reconstructed anymore.
* @param noRestart If set to true, the killed actor will not be restarted anymore.
*/
default void kill(boolean noReconstruction) {
Ray.internal().killActor(this, noReconstruction);
default void kill(boolean noRestart) {
Ray.internal().killActor(this, noRestart);
}
}
@@ -73,7 +73,7 @@ public interface Checkpointable {
/**
* Load actor's previous checkpoint, and restore actor's state.
*
* This method will be called when an actor is reconstructed, after actor's constructor. If the
* This method will be called when an actor is restarted, after the actor's constructor. If the
* actor needs to restore from previous checkpoint, this function should restore actor's state and
* return the checkpoint ID. Otherwise, it should do nothing and return null.
*
@@ -4,7 +4,7 @@ import io.ray.api.id.ObjectId;
/**
* Indicates that an object is lost (either evicted or explicitly deleted) and cannot be
* reconstructed.
* restarted.
*
* Note, this exception only happens for actor objects. If actor's current state is after object's
* creating task, the actor cannot re-run the task to reconstruct the object.
@@ -7,20 +7,16 @@ import java.util.Map;
* The options for creating actor.
*/
public class ActorCreationOptions extends BaseTaskOptions {
public static final int NO_RECONSTRUCTION = 0;
public static final int INFINITE_RECONSTRUCTION = (int) Math.pow(2, 30);
public final int maxReconstructions;
public final int maxRestarts;
public final String jvmOptions;
public final int maxConcurrency;
private ActorCreationOptions(Map<String, Double> resources, int maxReconstructions,
private ActorCreationOptions(Map<String, Double> resources, int maxRestarts,
String jvmOptions, int maxConcurrency) {
super(resources);
this.maxReconstructions = maxReconstructions;
this.maxRestarts = maxRestarts;
this.jvmOptions = jvmOptions;
this.maxConcurrency = maxConcurrency;
}
@@ -31,7 +27,7 @@ public class ActorCreationOptions extends BaseTaskOptions {
public static class Builder {
private Map<String, Double> resources = new HashMap<>();
private int maxReconstructions = NO_RECONSTRUCTION;
private int maxRestarts = 0;
private String jvmOptions = null;
private int maxConcurrency = 1;
@@ -40,8 +36,8 @@ public class ActorCreationOptions extends BaseTaskOptions {
return this;
}
public Builder setMaxReconstructions(int maxReconstructions) {
this.maxReconstructions = maxReconstructions;
public Builder setMaxRestarts(int maxRestarts) {
this.maxRestarts = maxRestarts;
return this;
}
@@ -65,7 +61,7 @@ public class ActorCreationOptions extends BaseTaskOptions {
public ActorCreationOptions createActorCreationOptions() {
return new ActorCreationOptions(
resources, maxReconstructions, jvmOptions, maxConcurrency);
resources, maxRestarts, jvmOptions, maxConcurrency);
}
}
@@ -86,9 +86,9 @@ public interface RayRuntime {
* Kill the actor immediately.
*
* @param actor The actor to be killed.
* @param noReconstruction If set to true, the killed actor will not be reconstructed anymore.
* @param noRestart If set to true, the killed actor will not be restarted anymore.
*/
void killActor(BaseActor actor, boolean noReconstruction);
void killActor(BaseActor actor, boolean noRestart);
/**
* Invoke a remote function.
@@ -22,11 +22,11 @@ public interface RuntimeContext {
ActorId getCurrentActorId();
/**
* Returns true if the current actor was reconstructed, false if it's created for the first time.
* Returns true if the current actor was restarted, false if it's created for the first time.
*
* Note, this method should only be called from an actor creation task.
*/
boolean wasCurrentActorReconstructed();
boolean wasCurrentActorRestarted();
/**
* Get the raylet socket name.