1
1
package com .github .tadayosi .torchserve .client .impl ;
2
2
3
3
import java .util .List ;
4
+ import java .util .Map ;
4
5
5
6
import com .github .tadayosi .torchserve .client .Management ;
6
7
import com .github .tadayosi .torchserve .client .management .api .DefaultApi ;
7
8
import com .github .tadayosi .torchserve .client .management .invoker .ApiClient ;
9
+ import com .github .tadayosi .torchserve .client .model .API ;
10
+ import com .github .tadayosi .torchserve .client .model .Model ;
11
+ import com .github .tadayosi .torchserve .client .model .ModelDetail ;
12
+ import com .github .tadayosi .torchserve .client .model .ModelList ;
8
13
import com .github .tadayosi .torchserve .client .model .RegisterModelOptions ;
14
+ import com .github .tadayosi .torchserve .client .model .Response ;
9
15
import com .github .tadayosi .torchserve .client .model .SetAutoScaleOptions ;
10
16
import com .github .tadayosi .torchserve .client .model .UnregisterModelOptions ;
11
17
@@ -23,8 +29,8 @@ public DefaultManagement(int port) {
23
29
}
24
30
25
31
@ Override
26
- public Object registerModel (String url , RegisterModelOptions options ) throws Exception {
27
- return api .registerModel (url , null ,
32
+ public Response registerModel (String url , RegisterModelOptions options ) throws Exception {
33
+ return Response . from ( api .registerModel (url , null ,
28
34
options .getModelName (),
29
35
options .getHandler (),
30
36
options .getRuntime (),
@@ -33,66 +39,67 @@ public Object registerModel(String url, RegisterModelOptions options) throws Exc
33
39
options .getResponseTimeout (),
34
40
options .getInitialWorkers (),
35
41
options .getSynchronous (),
36
- options .getS3SseKms ());
42
+ options .getS3SseKms ())) ;
37
43
}
38
44
39
45
@ Override
40
- public Object setAutoScale (String modelName , SetAutoScaleOptions options ) throws Exception {
41
- return api .setAutoScale (modelName ,
46
+ public Response setAutoScale (String modelName , SetAutoScaleOptions options ) throws Exception {
47
+ return Response . from ( api .setAutoScale (modelName ,
42
48
options .getMinWorker (),
43
49
options .getMaxWorker (),
44
50
options .getNumberGpu (),
45
51
options .getSynchronous (),
46
- options .getTimeout ());
52
+ options .getTimeout ())) ;
47
53
}
48
54
49
55
@ Override
50
- public Object setAutoScale (String modelName , String modelVersion , SetAutoScaleOptions options ) throws Exception {
51
- return api .versionSetAutoScale (modelName , modelVersion ,
56
+ public Response setAutoScale (String modelName , String modelVersion , SetAutoScaleOptions options ) throws Exception {
57
+ return Response . from ( api .versionSetAutoScale (modelName , modelVersion ,
52
58
options .getMinWorker (),
53
59
options .getMaxWorker (),
54
60
options .getNumberGpu (),
55
61
options .getSynchronous (),
56
- options .getTimeout ());
62
+ options .getTimeout ())) ;
57
63
}
58
64
59
65
@ Override
60
- public List <Object > describeModel (String modelName ) throws Exception {
61
- return List . copyOf (api .describeModel (modelName ));
66
+ public List <ModelDetail > describeModel (String modelName ) throws Exception {
67
+ return ModelDetail . from (api .describeModel (modelName ));
62
68
}
63
69
64
70
@ Override
65
- public List <Object > describeModel (String modelName , String modelVersion ) throws Exception {
66
- return List . copyOf (api .versionDescribeModel (modelName , modelVersion ));
71
+ public List <ModelDetail > describeModel (String modelName , String modelVersion ) throws Exception {
72
+ return ModelDetail . from (api .versionDescribeModel (modelName , modelVersion ));
67
73
}
68
74
69
75
@ Override
70
- public Object unregisterModel (String modelName , UnregisterModelOptions options ) throws Exception {
71
- return api .unregisterModel (modelName ,
76
+ public Response unregisterModel (String modelName , UnregisterModelOptions options ) throws Exception {
77
+ return Response . from ( api .unregisterModel (modelName ,
72
78
options .getSynchronous (),
73
- options .getTimeout ());
79
+ options .getTimeout ())) ;
74
80
}
75
81
76
82
@ Override
77
- public Object unregisterModel (String modelName , String modelVersion , UnregisterModelOptions options ) throws Exception {
78
- return api .versionUnregisterModel (modelName , modelVersion ,
83
+ public Response unregisterModel (String modelName , String modelVersion , UnregisterModelOptions options )
84
+ throws Exception {
85
+ return Response .from (api .versionUnregisterModel (modelName , modelVersion ,
79
86
options .getSynchronous (),
80
- options .getTimeout ());
87
+ options .getTimeout ())) ;
81
88
}
82
89
83
90
@ Override
84
- public Object listModels (Integer limit , String nextPageToken ) throws Exception {
85
- return api .listModels (limit , nextPageToken );
91
+ public ModelList listModels (Integer limit , String nextPageToken ) throws Exception {
92
+ return ModelList . from ( api .listModels (limit , nextPageToken ) );
86
93
}
87
94
88
95
@ Override
89
- public Object setDefault (String modelName , String modelVersion ) throws Exception {
90
- return api .setDefault (modelName , modelVersion );
96
+ public Response setDefault (String modelName , String modelVersion ) throws Exception {
97
+ return Response . from ( api .setDefault (modelName , modelVersion ) );
91
98
}
92
99
93
100
@ Override
94
- public Object apiDescription () throws Exception {
95
- return api .apiDescription ();
101
+ public API apiDescription () throws Exception {
102
+ return API . from ( api .apiDescription () );
96
103
}
97
104
98
105
@ Override
0 commit comments