forked from datarobot/datarobot-user-models
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drum_server_api.yaml
363 lines (362 loc) · 12.9 KB
/
drum_server_api.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
openapi: 3.0.1
info:
title: DRUM prediction server.
description: DRUM prediction server.
version: "1.5.3"
paths:
/URL_PREFIX/:
$ref: "#/paths/~1URL_PREFIX~1ping~1"
/URL_PREFIX/ping/:
get:
description: Check whether server is alive.
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
message:
type: string
description: Status message.
example:
message: OK
/URL_PREFIX/health/:
get:
description: Get functional health status, e.g. whether model is loaded and functioning properly.
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
message:
type: string
description: Status message.
example:
message: OK
513:
description: 'Not healthy. Requires DRUM server has to be started with --with-error-server option'
content:
application/json:
schema:
type: object
properties:
message:
type: string
description: Status message
example:
message: "ERROR: \n\nRunning environment language: Python.\n Failed loading hooks from [/tmp/model/python3_sklearn/custom.py] : No module named 'andas'"
/URL_PREFIX/info/:
get:
description: Get information about running model (metadata, paths, predictor type, etc.).
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
codeDir:
type: string
description: Custom code (model) location.
drumServer:
type: string
description: DRUM server backend.
drumVersion:
type: string
description: DRUM version.
language:
type: string
description: Custom code (model) language.
modelMetadata:
type: object
description: Model metadata taken from model-metadata.yaml, if exists in the code dir. May have arbitrary structure.
predictor:
type: string
description: Internal predictor used to load a model.
targetType:
type: string
description: Model target type
example:
codeDir: /tmp/model/python3_sklearn
drumServer: flask
drumVersion: 1.5.3
language: python
modelMetadata:
environmentID: 5e8c889607389fe0f466c72d
inferenceModel:
targetName: Grade 2014
modelId: 5f1f15a4d6111f01cb7f91fd
name: regression model
targetType: regression
type: inference
validation:
input: ../../../tests/testdata/juniors_3_year_stats_regression.csv
predictor: scikit-learn
targetType: regression
/URL_PREFIX/stats/:
get:
description: Shows running model statistics (memory).
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
drum_info:
type: array
items:
type: object
properties:
cmdline:
type: array
items:
type: string
cpu_percent:
type: number
description: CPU persent used by DRUM or its child(in case when DRUM is running as nginx + uwsgi server).
mem:
type: number
description: Memory used by DRUM.
pid:
type: number
description: DRUM server process PID.
mem_info:
type: object
properties:
avail:
type: number
description: Total available memory on the system.
container_limit:
type: number
description: Value is not null when starting DRUM server in container, using --docker argument.
container_max_used:
type: number
description: Value is not null when starting DRUM server in container, using --docker argument.
container_used:
type: number
drum_rss:
type: number
description: Resident memory occupied by DRUM.
free:
type: number
description: Free memory in system.
nginx_rss:
type: number
description: Resident memory occupied by nginx. Meaningfull when running DRUM with --production option, which enables to use nginx as backend server.
total:
type: number
description: DRUM server process PID.
time_info:
type: object
properties:
run_predictor_total:
type: object
properties:
avg:
type: number
description: Average requeest time (s)
max:
type: number
description: Maximum request time (s)
min:
type: number
description: Minimum request time (s)
example:
drum_info: [ cmdline: [ "/tmp/drum_tests_virtual_environment/bin/python3",
"/tmp/drum_tests_virtual_environment/bin/drum",
"server",
"--code-dir",
"/tmp/model/python3_sklearn",
"--target-type",
"regression",
"--address",
"localhost:6789",
"--with-error-server",
"--show-perf" ], mem: 256.71484375, pid: 342391 ]
mem_info:
avail: 17670.828125
container_limit: null
container_max_used: null
container_used: null
drum_rss: 256.71484375
free: 312.33203125
nginx_rss: 0
total: 31442.73046875
time_info:
run_predictor_total:
avg: 0.0165
max: 0.023
min: 0.013
/URL_PREFIX/capabilities/:
get:
description: Get payload formats supported by the internal predictor in use. Predictor selection depends on the model.
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
supported_payload_formats:
type: object
description: If format is supported, property present in the object. Property's value is a package version. If version is not pinned, value is null.
properties:
arrow:
type: string
csv:
type: string
mtx:
type: string
example:
supported_payload_formats:
arrow: 2.0.0
csv: null
mtx: null
/URL_PREFIX/predict/:
post:
description: Make predictions on regression, binary or multiclassification models.
requestBody:
description: Scoring data to predict on.
content:
text/plain:
schema:
description: Scoring data.
type: string
format: text
text/csv:
schema:
description: Scoring data.
type: string
format: text
text/mtx:
schema:
description: Scoring data.
type: string
format: text
application/x-apache-arrow-stream:
schema:
description: Scoring data.
type: string
format: binary
multipart/form-data:
schema:
description: Scoring data.
type: object
properties:
X:
type: string
format: filename
responses:
200:
description: OK
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/regression"
- $ref: "#/components/schemas/binary"
- $ref: "#/components/schemas/multiclass"
422:
description: "Unprocessable entity"
content:
application/json:
schema:
type: object
properties:
message:
type: string
description: Status message
example:
message: "ERROR: Samples should be provided as: - a csv, mtx, or arrow file under `X` form-data param key. - binary data."
/URL_PREFIX/predictions/:
$ref: "#/paths/~1URL_PREFIX~1predict~1"
/URL_PREFIX/predictUnstructured/:
post:
description: Make unstructured predictions on arbitrary data.
requestBody:
description: Scoring data to predict on.
content:
text/*:
schema:
description: Any textual scoring data.
type: string
format: text
application/json:
schema:
description: Scoring data in json format.
type: string
format: text
<other>:
schema:
description: Any other mimetype provided assumes binary data is sent.
type: string
format: binary
responses:
200:
description: OK
content:
text/plain:
schema:
type: string
format: text
application/octet-stream:
schema:
type: string
format: binary
<other>:
schema:
description: Any other mimetype returned assumes user returns data in a proper format.
type: string
422:
description: "Unprocessable entity"
content:
application/json:
schema:
type: object
properties:
message:
type: string
description: Status message
/URL_PREFIX/predictionsUnstructured/:
$ref: "#/paths/~1URL_PREFIX~1predictUnstructured~1"
components:
schemas:
regression:
type: object
properties:
predictions:
type: array
description: List of regression predictions.
items:
type: number
example:
predictions: [2.4, 3.2, 6.1]
binary:
type: object
properties:
predictions:
type: array
description: List of binary classification predictions.
items:
type: object
example:
predictions: [{positiveClassLabel: 0.85, negativeClassLabel: 0.15}, {positiveClassLabel: 0.25, negativeClassLabel: 0.75}]
multiclass:
type: object
properties:
predictions:
type: array
description: List of multiclass classification predictions.
items:
type: object
example:
predictions: [{classLabel1: 0.75, classLabel2: 0.15, classLabel3: 0.1}, {classLabel1: 0.2, classLabel2: 0.5, classLabel3: 0.3}]