18
18
import com .github .tjake .jlama .net .Coordinator ;
19
19
import picocli .CommandLine ;
20
20
21
- @ CommandLine .Command (
22
- name = "cluster-coordinator" ,
23
- description = "Starts a distributed rest api for a model using cluster workers" )
21
+ @ CommandLine .Command (name = "cluster-coordinator" , description = "Starts a distributed rest api for a model using cluster workers" )
24
22
public class ClusterCoordinatorCommand extends BaseCommand {
25
23
26
- @ CommandLine .Option (
27
- names = {"-w" , "--worker-count" },
28
- description = "signifies this instance is a coordinator" ,
29
- required = true )
24
+ @ CommandLine .Option (names = { "-w" , "--worker-count" }, description = "signifies this instance is a coordinator" , required = true )
30
25
int workerCount = 1 ;
31
26
32
- @ CommandLine .Option (
33
- names = {"-g" , "--grpc-port" },
34
- description = "grpc port to listen on (default: ${DEFAULT-VALUE})" ,
35
- defaultValue = "9777" )
27
+ @ CommandLine .Option (names = { "-g" ,
28
+ "--grpc-port" }, description = "grpc port to listen on (default: ${DEFAULT-VALUE})" , defaultValue = "9777" )
36
29
int grpcPort = 9777 ;
37
30
38
- @ CommandLine .Option (
39
- names = {"-p" , "--port" },
40
- description = "http port to listen on (default: ${DEFAULT-VALUE})" ,
41
- defaultValue = "8080" )
31
+ @ CommandLine .Option (names = { "-p" ,
32
+ "--port" }, description = "http port to listen on (default: ${DEFAULT-VALUE})" , defaultValue = "8080" )
42
33
int port = 8080 ;
43
34
44
35
@ Override
@@ -47,13 +38,12 @@ public void run() {
47
38
Coordinator c = new Coordinator (model , workingDirectory , grpcPort , workerCount );
48
39
49
40
new Thread (() -> {
50
- try {
51
- c .start ();
52
- } catch (Exception e ) {
53
- e .printStackTrace ();
54
- }
55
- })
56
- .start ();
41
+ try {
42
+ c .start ();
43
+ } catch (Exception e ) {
44
+ e .printStackTrace ();
45
+ }
46
+ }).start ();
57
47
58
48
/*UndertowJaxrsServer ut = new UndertowJaxrsServer();
59
49
ut.deploy(new JlamaRestApi(c), APPLICATION_PATH);
@@ -62,7 +52,7 @@ public void run() {
62
52
resource(new ClassPathResourceManager(ServeCommand.class.getClassLoader()))
63
53
.setDirectoryListingEnabled(true)
64
54
.addWelcomeFiles("index.html"));
65
-
55
+
66
56
System.out.println("Chat UI: http://localhost:" + port + "/ui/index.html");
67
57
ut.start(Undertow.builder().addHttpListener(port, "0.0.0.0"));*/
68
58
0 commit comments