@@ -65,8 +65,8 @@ public class DeploymentDemo {
65
65
66
66
public static void main (String [] args ) {
67
67
Application deployment =
68
- Serve . deployment(). setDeploymentDef(DeploymentDemo . class. getName()). create() . bind();
69
- RayServeHandle handle = Serve . run(deployment);
68
+ Serve . deployment(). setDeploymentDef(DeploymentDemo . class. getName()). bind();
69
+ RayServeHandle handle = Serve . run(deployment). get() ;
70
70
System . out. println(handle. remote(). get());
71
71
}
72
72
}
@@ -109,13 +109,11 @@ public class Driver {
109
109
}
110
110
111
111
public static void main (String [] args ) {
112
- Application modelA =
113
- Serve . deployment(). setDeploymentDef(ModelA . class. getName()). create(). bind();
114
- Application modelB =
115
- Serve . deployment(). setDeploymentDef(ModelB . class. getName()). create(). bind();
112
+ Application modelA = Serve . deployment(). setDeploymentDef(ModelA . class. getName()). bind();
113
+ Application modelB = Serve . deployment(). setDeploymentDef(ModelB . class. getName()). bind();
116
114
117
115
Application driver =
118
- Serve . deployment(). setDeploymentDef(Driver . class. getName()). create() . bind(modelA, modelB);
116
+ Serve . deployment(). setDeploymentDef(Driver . class. getName()). bind(modelA, modelB);
119
117
Serve . run(driver);
120
118
}
121
119
}
@@ -155,13 +153,11 @@ public class Model {
155
153
Application model =
156
154
Serve . deployment()
157
155
.setDeploymentDef(Model . class. getName())
158
- .create()
159
156
.bind(2 );
160
157
Application pyPreprocess =
161
158
Serve . deployment()
162
159
.setDeploymentDef(" deployment_graph.preprocess" )
163
160
.setLanguage(DeploymentLanguage . PYTHON )
164
- .create()
165
161
.bind(inp);
166
162
Application output = model. method(" predict" ). bind(pyPreprocess);
167
163
Application serveDag = DAGDriver . bind(output);
@@ -184,8 +180,10 @@ One more thing to note is the usage of `InputNode`. In Python, `InputNode` is ve
184
180
// Demo 4
185
181
import io.ray.serve.api.Serve ;
186
182
import io.ray.serve.deployment.Application ;
183
+ import io.ray.serve.deployment.DAGDriver ;
187
184
import io.ray.serve.deployment.InputNode ;
188
185
import io.ray.serve.generated.DeploymentLanguage ;
186
+ import io.ray.serve.handle.RayServeHandle ;
189
187
190
188
public class Model {
191
189
@@ -202,8 +200,8 @@ public class Model {
202
200
}
203
201
204
202
public static void main (String [] args ) throws Exception {
205
- Application m1 = Serve . deployment(). setDeploymentDef(Model . class. getName()). create() . bind(1 );
206
- Application m2 = Serve . deployment(). setDeploymentDef(Model . class. getName()). create() . bind(2 );
203
+ Application m1 = Serve . deployment(). setDeploymentDef(Model . class. getName()). bind(1 );
204
+ Application m2 = Serve . deployment(). setDeploymentDef(Model . class. getName()). bind(2 );
207
205
208
206
try (InputNode userInput = InputNode . create()) {
209
207
Application m1Output = m1. method(" forward" ). bind(userInput. get(0 ));
@@ -212,9 +210,8 @@ public class Model {
212
210
Serve . deployment()
213
211
.setDeploymentDef(" deployment_graph.combine" )
214
212
.setLanguage(DeploymentLanguage . PYTHON )
215
- .create()
216
213
.bind(m1Output, m2Output, userInput. get(2 ));
217
-
214
+
218
215
Application graph = DAGDriver . bind(combineOutput);
219
216
RayServeHandle handle = Serve . run(graph);
220
217
}
0 commit comments