Skip to content

Commit

Permalink
Fix conflicts with PR: ray-project#19923. (ray-project#19463)
Browse files Browse the repository at this point in the history
  • Loading branch information
chuhan.ly committed Nov 2, 2021
2 parents f22d8cf + da68948 commit 70df0a2
Show file tree
Hide file tree
Showing 158 changed files with 3,540 additions and 1,910 deletions.
4 changes: 2 additions & 2 deletions .buildkite/windows/install/reqs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ pytest-tornasync
pytest-trio
pytest-twisted
werkzeug
git+git://github.com/ray-project/tune-sklearn@master#tune-sklearn
git+git://github.com/ray-project/xgboost_ray@master#egg=xgboost_ray
git+https://github.com/ray-project/tune-sklearn@master#tune-sklearn
git+https://github.com/ray-project/xgboost_ray@master#egg=xgboost_ray
scikit-optimize
tensorflow
gym
Expand Down
6 changes: 3 additions & 3 deletions doc/requirements-doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ starlette
tabulate
uvicorn
werkzeug
git+git://github.com/ray-project/tune-sklearn@master#tune-sklearn
git+git://github.com/ray-project/xgboost_ray@master#egg=xgboost_ray
git+git://github.com/ray-project/lightgbm_ray@main#lightgbm_ray
git+https://github.com/ray-project/tune-sklearn@master#tune-sklearn
git+https://github.com/ray-project/xgboost_ray@master#egg=xgboost_ray
git+https://github.com/ray-project/lightgbm_ray@main#lightgbm_ray
git+https://github.com/ray-project/ray_lightning#ray_lightning
scikit-optimize
sphinx-sitemap==2.2.0
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public void start() {
JobConfig.newBuilder()
.setNumJavaWorkersPerProcess(rayConfig.numWorkersPerProcess)
.addAllJvmOptions(rayConfig.jvmOptionsForJavaWorker)
.addAllCodeSearchPath(rayConfig.codeSearchPath);
.addAllCodeSearchPath(rayConfig.codeSearchPath)
.setRayNamespace(rayConfig.namespace);
RuntimeEnv.Builder runtimeEnvBuilder = RuntimeEnv.newBuilder();
if (!rayConfig.workerEnv.isEmpty()) {
// TODO(SongGuyang): Suppport complete runtime env interface for users.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public LoggerConf(String loggerName, String fileName, String pattern) {

public final int numWorkersPerProcess;

public final String namespace;

public final List<String> jvmOptionsForJavaWorker;
public final Map<String, String> workerEnv;

Expand Down Expand Up @@ -118,6 +120,9 @@ public RayConfig(Config config) {
this.jobId = JobId.NIL;
}

// Namespace of this job.
namespace = config.getString("ray.job.namespace");

// jvm options for java workers of this job.
jvmOptionsForJavaWorker = config.getStringList("ray.job.jvm-options");

Expand Down
4 changes: 4 additions & 0 deletions java/runtime/src/main/resources/ray.default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ ray {
// key1 : "value1"
// key2 : "value2"
}
/// The namespace of this job. It's used for isolation between jobs.
/// Jobs in different namespaces cannot access each other.
/// If it's not specified, a randomized value will be used instead.
namespace: ""
}

// Configurations about raylet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.common.base.Preconditions;
import java.io.Serializable;

public class BackendConfig implements Serializable {
public class DeploymentConfig implements Serializable {

private static final long serialVersionUID = 4037621960087621036L;

Expand All @@ -19,13 +19,13 @@ public class BackendConfig implements Serializable {

private boolean isCrossLanguage;

private int backendLanguage = 1;
private int deploymentLanguage = 1;

public int getNumReplicas() {
return numReplicas;
}

public BackendConfig setNumReplicas(int numReplicas) {
public DeploymentConfig setNumReplicas(int numReplicas) {
this.numReplicas = numReplicas;
return this;
}
Expand All @@ -34,7 +34,7 @@ public int getMaxConcurrentQueries() {
return maxConcurrentQueries;
}

public BackendConfig setMaxConcurrentQueries(int maxConcurrentQueries) {
public DeploymentConfig setMaxConcurrentQueries(int maxConcurrentQueries) {
Preconditions.checkArgument(maxConcurrentQueries >= 0, "max_concurrent_queries must be >= 0");
this.maxConcurrentQueries = maxConcurrentQueries;
return this;
Expand All @@ -44,7 +44,7 @@ public Object getUserConfig() {
return userConfig;
}

public BackendConfig setUserConfig(Object userConfig) {
public DeploymentConfig setUserConfig(Object userConfig) {
this.userConfig = userConfig;
return this;
}
Expand All @@ -53,7 +53,7 @@ public double getGracefulShutdownWaitLoopS() {
return gracefulShutdownWaitLoopS;
}

public BackendConfig setGracefulShutdownWaitLoopS(double gracefulShutdownWaitLoopS) {
public DeploymentConfig setGracefulShutdownWaitLoopS(double gracefulShutdownWaitLoopS) {
this.gracefulShutdownWaitLoopS = gracefulShutdownWaitLoopS;
return this;
}
Expand All @@ -62,7 +62,7 @@ public double getGracefulShutdownTimeoutS() {
return gracefulShutdownTimeoutS;
}

public BackendConfig setGracefulShutdownTimeoutS(double gracefulShutdownTimeoutS) {
public DeploymentConfig setGracefulShutdownTimeoutS(double gracefulShutdownTimeoutS) {
this.gracefulShutdownTimeoutS = gracefulShutdownTimeoutS;
return this;
}
Expand All @@ -71,17 +71,17 @@ public boolean isCrossLanguage() {
return isCrossLanguage;
}

public BackendConfig setCrossLanguage(boolean isCrossLanguage) {
public DeploymentConfig setCrossLanguage(boolean isCrossLanguage) {
this.isCrossLanguage = isCrossLanguage;
return this;
}

public int getBackendLanguage() {
return backendLanguage;
public int getDeploymentLanguage() {
return deploymentLanguage;
}

public BackendConfig setBackendLanguage(int backendLanguage) {
this.backendLanguage = backendLanguage;
public DeploymentConfig setDeploymentLanguage(int deploymentLanguage) {
this.deploymentLanguage = deploymentLanguage;
return this;
}
}
10 changes: 5 additions & 5 deletions java/serve/src/main/java/io/ray/serve/DeploymentInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class DeploymentInfo implements Serializable {

private Object[] initArgs;

private BackendConfig backendConfig;
private DeploymentConfig deploymentConfig;

private DeploymentVersion deploymentVersion;

Expand Down Expand Up @@ -46,12 +46,12 @@ public DeploymentInfo setInitArgs(Object[] initArgs) {
return this;
}

public BackendConfig getBackendConfig() {
return backendConfig;
public DeploymentConfig getDeploymentConfig() {
return deploymentConfig;
}

public DeploymentInfo setBackendConfig(BackendConfig backendConfig) {
this.backendConfig = backendConfig;
public DeploymentInfo setDeploymentConfig(DeploymentConfig deploymentConfig) {
this.deploymentConfig = deploymentConfig;
return this;
}

Expand Down
12 changes: 6 additions & 6 deletions java/serve/src/main/java/io/ray/serve/RayServeReplicaImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class RayServeReplicaImpl implements RayServeReplica {

private String replicaTag;

private BackendConfig config;
private DeploymentConfig config;

private AtomicInteger numOngoingRequests = new AtomicInteger();

Expand Down Expand Up @@ -60,13 +60,13 @@ public class RayServeReplicaImpl implements RayServeReplica {

public RayServeReplicaImpl(
Object callable,
BackendConfig backendConfig,
DeploymentConfig deploymentConfig,
DeploymentVersion version,
BaseActorHandle actorHandle) {
this.backendTag = Serve.getReplicaContext().getBackendTag();
this.replicaTag = Serve.getReplicaContext().getReplicaTag();
this.callable = callable;
this.config = backendConfig;
this.config = deploymentConfig;
this.version = version;

this.checkHealthMethod = getRunnerMethod(Constants.CHECK_HEALTH_METHOD, null, true);
Expand All @@ -75,7 +75,7 @@ public RayServeReplicaImpl(
Map<KeyType, KeyListener> keyListeners = new HashMap<>();
keyListeners.put(
new KeyType(LongPollNamespace.BACKEND_CONFIGS, backendTag),
newConfig -> updateBackendConfigs(newConfig));
newConfig -> updateDeploymentConfigs(newConfig));
this.longPollClient = new LongPollClient(actorHandle, keyListeners);
this.longPollClient.start();
registerMetrics();
Expand Down Expand Up @@ -348,8 +348,8 @@ public DeploymentVersion reconfigure(Object userConfig) {
*
* @param newConfig the new configuration of backend
*/
private void updateBackendConfigs(Object newConfig) {
config = (BackendConfig) newConfig;
private void updateDeploymentConfigs(Object newConfig) {
config = (DeploymentConfig) newConfig;
}

public DeploymentVersion getVersion() {
Expand Down
23 changes: 12 additions & 11 deletions java/serve/src/main/java/io/ray/serve/RayServeWrappedReplica.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ public RayServeWrappedReplica(
String replicaTag,
String backendDef,
byte[] initArgsbytes,
byte[] backendConfigBytes,
byte[] deploymentConfigBytes,
byte[] deploymentVersionBytes,
String controllerName) {

// Parse BackendConfig.
BackendConfig backendConfig = ServeProtoUtil.parseBackendConfig(backendConfigBytes);
// Parse DeploymentConfig.
DeploymentConfig deploymentConfig = ServeProtoUtil.parseDeploymentConfig(deploymentConfigBytes);

// Parse init args.
Object[] initArgs = null;
try {
initArgs = parseInitArgs(initArgsbytes, backendConfig);
initArgs = parseInitArgs(initArgsbytes, deploymentConfig);
} catch (IOException e) {
String errMsg =
LogUtil.format(
Expand All @@ -51,10 +51,11 @@ public RayServeWrappedReplica(
throw new RayServeException(errMsg, e);
}

// Init replica.
init(
new DeploymentInfo()
.setName(backendTag)
.setBackendConfig(backendConfig)
.setDeploymentConfig(deploymentConfig)
.setDeploymentVersion(ServeProtoUtil.parseDeploymentVersion(deploymentVersionBytes))
.setBackendDef(backendDef)
.setInitArgs(initArgs),
Expand Down Expand Up @@ -103,7 +104,7 @@ private void init(
this.backend =
new RayServeReplicaImpl(
callable,
deploymentInfo.getBackendConfig(),
deploymentInfo.getDeploymentConfig(),
deploymentInfo.getDeploymentVersion(),
optional.get());
this.deploymentInfo = deploymentInfo;
Expand Down Expand Up @@ -131,14 +132,14 @@ private void enableMetrics(Map<String, String> config) {
});
}

private Object[] parseInitArgs(byte[] initArgsbytes, BackendConfig backendConfig)
private Object[] parseInitArgs(byte[] initArgsbytes, DeploymentConfig deploymentConfig)
throws IOException {

if (initArgsbytes == null || initArgsbytes.length == 0) {
return new Object[0];
}

if (backendConfig.isCrossLanguage()) {
if (deploymentConfig.isCrossLanguage()) {
// For other language like Python API, not support Array type.
return new Object[] {MessagePackSerializer.decode(initArgsbytes, Object.class)};
} else {
Expand Down Expand Up @@ -199,10 +200,10 @@ public boolean prepareForShutdown() {
public Object reconfigure(Object userConfig) {
DeploymentVersion deploymentVersion =
backend.reconfigure(
deploymentInfo.getBackendConfig().isCrossLanguage() && userConfig != null
deploymentInfo.getDeploymentConfig().isCrossLanguage() && userConfig != null
? MessagePackSerializer.decode((byte[]) userConfig, Object.class)
: userConfig);
return deploymentInfo.getBackendConfig().isCrossLanguage()
return deploymentInfo.getDeploymentConfig().isCrossLanguage()
? ServeProtoUtil.toProtobuf(deploymentVersion).toByteArray()
: deploymentVersion;
}
Expand All @@ -215,7 +216,7 @@ public Object reconfigure(Object userConfig) {
*/
public Object getVersion() {
DeploymentVersion deploymentVersion = backend.getVersion();
return deploymentInfo.getBackendConfig().isCrossLanguage()
return deploymentInfo.getDeploymentConfig().isCrossLanguage()
? ServeProtoUtil.toProtobuf(deploymentVersion).toByteArray()
: deploymentVersion;
}
Expand Down
6 changes: 3 additions & 3 deletions java/serve/src/main/java/io/ray/serve/ReplicaSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import io.ray.runtime.metric.Metrics;
import io.ray.runtime.metric.TagKey;
import io.ray.serve.generated.ActorSet;
import io.ray.serve.generated.BackendConfig;
import io.ray.serve.generated.DeploymentConfig;
import io.ray.serve.util.CollectionUtil;
import java.util.ArrayList;
import java.util.HashSet;
Expand Down Expand Up @@ -48,8 +48,8 @@ public ReplicaSet(String backendTag) {
.register());
}

public void setMaxConcurrentQueries(Object backendConfig) {
int newValue = ((BackendConfig) backendConfig).getMaxConcurrentQueries();
public void setMaxConcurrentQueries(Object deploymentConfig) {
int newValue = ((DeploymentConfig) deploymentConfig).getMaxConcurrentQueries();
if (newValue != this.maxConcurrentQueries) {
this.maxConcurrentQueries = newValue;
LOGGER.info("ReplicaSet: changing max_concurrent_queries to {}", newValue);
Expand Down
2 changes: 1 addition & 1 deletion java/serve/src/main/java/io/ray/serve/Router.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public Router(BaseActorHandle controllerHandle, String backendTag) {
Map<KeyType, KeyListener> keyListeners = new HashMap<>();
keyListeners.put(
new KeyType(LongPollNamespace.BACKEND_CONFIGS, backendTag),
backendConfig -> replicaSet.setMaxConcurrentQueries(backendConfig)); // cross language
deploymentConfig -> replicaSet.setMaxConcurrentQueries(deploymentConfig)); // cross language
keyListeners.put(
new KeyType(LongPollNamespace.REPLICA_HANDLES, backendTag),
workerReplicas -> replicaSet.updateWorkerReplicas(workerReplicas)); // cross language
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class LongPollClient {

static {
DESERIALIZERS.put(
LongPollNamespace.BACKEND_CONFIGS, body -> ServeProtoUtil.parseBackendConfig(body));
LongPollNamespace.BACKEND_CONFIGS, body -> ServeProtoUtil.parseDeploymentConfig(body));
DESERIALIZERS.put(
LongPollNamespace.REPLICA_HANDLES, body -> ServeProtoUtil.parseEndpointSet(body));
DESERIALIZERS.put(
Expand Down
Loading

0 comments on commit 70df0a2

Please sign in to comment.