-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.yaml
1011 lines (983 loc) · 25.1 KB
/
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
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.1
info:
title: Web Profile工具API
description: web profile工具基础API
version: 1.0.0
servers:
- url: https://localhost:5000/
- url: http://localhost:5000/
tags:
- name: user
description: User Operations
- name: task
description: Upload MGE Model & Show Results
- name: worker
description: worker信息管理
- name: admin
description: 管理员功能
paths:
/signup:
post:
tags:
- user
summary: User registration
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/User'
required: true
responses:
200:
description: 注册成功
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
x-codegen-request-body-name: body
/login:
post:
tags:
- user
summary: 登录成功
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/User'
required: true
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/LoginResponse'
/user/info:
get:
tags:
- user
security:
- bearerAuth: []
summary: Get info of current user after login
responses:
200:
description: 获取用户信息成功
content:
application/json:
schema:
$ref: '#/components/schemas/UserInfoResponse'
/task/createurl:
post:
tags:
- task
security:
- bearerAuth: []
summary: 新建项目,返回文件上传至MINIO的预签名url
requestBody:
content:
multipart/form-data:
schema:
required:
- worker
- version
- mge_name
- data_name
properties:
worker:
type: string
description: 选中worker的名字
version:
type: string
description: 选中的MgeEngine版本
mge_name:
type: string
description: 上传的MGE Model的文件名
data_name:
type: string
description: 上传的data的文件名
required: true
responses:
200:
description: 用户创建任务后,生成上传MGE模型和数据文件至MINIO的url成功
content:
application/json:
schema:
$ref: '#/components/schemas/CreateTaskResponse'
/task/savetaskinfo:
post:
tags:
- task
security:
- bearerAuth: []
summary: mge、data文件上传成功,更新数据库中任务状态
requestBody:
content:
multipart/form-data:
schema:
required:
- worker
- version
- taskId
- saveFlag
- args
properties:
worker:
type: string
description: 选中worker的名字
version:
type: string
description: 选中的MgeEngine版本
taskId:
type: string
description: 该任务ID
saveFlag:
type: string
description: 文件是否上传成功
args:
type: string
description: 运行load_and_run的额外命令行参数
required: true
responses:
200:
description: 创建任务后,文件上传成功,任务成功初始化
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
/task/getlist/{page}/{size}:
get:
tags:
- task
security:
- bearerAuth: []
summary: 获取当前用户的所有task信息
parameters:
- name: page
in: path
description: 第几页
required: true
schema:
type: string
- name: size
in: path
description: 每页显示几条
required: true
schema:
type: string
responses:
200:
description: 获取所有任务信息成功
content:
application/json:
schema:
$ref: '#/components/schemas/TaskList'
/task/getidlist:
get:
tags:
- task
security:
- bearerAuth: []
summary: 获取当前用户的所有task ID
responses:
200:
description: 获取所有任务ID成功
content:
application/json:
schema:
$ref: '#/components/schemas/TaskIDResponse'
/task/taskprofile:
post:
tags:
- task
security:
- bearerAuth: []
summary: 获得任务Profile
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/GetProfile'
required: true
responses:
200:
description: 获得任务Profile信息成功
content:
application/json:
schema:
$ref: '#/components/schemas/ProfileResponse'
/task/netvisualize/{taskId}:
get:
tags:
- task
security:
- bearerAuth: []
summary: 模型可视化
parameters:
- name: taskId
in: path
description: 任务ID
required: true
schema:
type: string
responses:
200:
description: 模型可视化时,获取log的url成功
content:
application/json:
schema:
properties:
code:
type: integer
format: int32
flag:
type: boolean
message:
type: string
data:
type: string
description: 获取MINIO上log文件的预签名url
/task/getfailinfo/{taskId}:
get:
tags:
- task
security:
- bearerAuth: []
summary: 任务失败信息
parameters:
- name: taskId
in: path
description: 任务ID
required: true
schema:
type: string
responses:
200:
description: 任务失败,获取失败结果的url成功
content:
application/json:
schema:
properties:
code:
type: integer
format: int32
flag:
type: boolean
message:
type: string
data:
type: string
description: 获取MINIO上output文件的预签名url
/task/getdownloadurl/{taskId}:
get:
tags:
- task
security:
- bearerAuth: []
summary: worker获取task文件的下载url
parameters:
- name: taskId
in: path
description: 任务ID
required: true
schema:
type: string
responses:
200:
description: worker获取文件,生成文件下载url成功
content:
application/json:
schema:
properties:
code:
type: integer
format: int32
flag:
type: boolean
message:
type: string
data:
type: object
properties:
dataUrl:
type: string
mgeUrl:
type: string
/task/updatestate:
post:
tags:
- task
security:
- bearerAuth: []
summary: worker上任务运行/完成/失败,更新数据库中任务状态
requestBody:
content:
multipart/form-data:
schema:
properties:
taskID:
type: string
state:
type: string
required: true
responses:
200:
description: 任务状态更新成功
content:
application/json:
schema:
properties:
code:
type: integer
format: int32
flag:
type: boolean
message:
type: string
output_url:
type: string
description: 返回给worker的,上传结果文件至MINIO的预签名url
/worker/add:
post:
tags:
- worker
summary: 新worker注册
requestBody:
content:
multipart/form-data:
schema:
properties:
name:
type: string
description: worker名称
ip:
type: string
description: worker ip
platform:
type: string
description: worker平台架构
mge_version:
type: array
items:
type: string
description: worker上有的MegEngine Version
auth:
type: string
description: worker是public/private
required: true
responses:
200:
description: 新worker注册成功
content:
application/json:
schema:
properties:
code:
type: integer
format: int32
flag:
type: boolean
message:
type: string
data:
type: string
description: 注册成功,新worker的ID
/worker/update:
post:
tags:
- worker
summary: worker心跳更新
requestBody:
content:
multipart/form-data:
schema:
properties:
id:
type: string
state:
type: string
required: true
responses:
200:
description: worker心跳状态更新成功
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
/getmyworkerslist:
get:
tags:
- worker
security:
- bearerAuth: []
summary: 用户获取所有可用的worker列表
responses:
200:
description: 获取当前用户的workersList成功
content:
application/json:
schema:
$ref: '#/components/schemas/WorkerList'
/getworkinfo/{chosenWorker}:
get:
tags:
- worker
security:
- bearerAuth: []
summary: worker获取task文件的下载url
parameters:
- name: chosenWorker
in: path
description: 选中worker名称
required: true
schema:
type: string
responses:
200:
description: 获取当前选中worker的信息成功
content:
application/json:
schema:
properties:
code:
type: integer
format: int32
flag:
type: boolean
message:
type: string
data:
type: object
properties:
platform:
type: string
mge_version:
type: array
items:
type: string
/admin/getworkerslist:
get:
tags:
- admin
security:
- bearerAuth: []
summary: 管理员获取所有worker的信息
responses:
200:
description: 获取所有worker信息成功
content:
application/json:
schema:
$ref: '#/components/schemas/WorkerList'
/admin/getuserslist:
get:
tags:
- admin
security:
- bearerAuth: []
summary: 管理员获取所有用户的信息
responses:
200:
description: 获取所有用户信息成功
content:
application/json:
schema:
$ref: '#/components/schemas/UsersList'
/admin/getprivateworkerslist:
get:
tags:
- admin
security:
- bearerAuth: []
summary: 管理员获取所有私有设备的信息
responses:
200:
description: 获取所有私有worker信息成功
content:
application/json:
schema:
properties:
code:
type: integer
format: int32
flag:
type: boolean
message:
type: string
data:
type: array
items :
properties:
_id:
type: string
name:
type: string
/admin/worker/{userId}:
post:
tags:
- admin
security:
- bearerAuth: []
summary: 给某用户添加某私有worker
parameters:
- name: userId
in: path
description: 用户ID
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
properties:
worker_add:
type: string
required: true
responses:
200:
description: 添加worker成功
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
delete:
tags:
- admin
security:
- bearerAuth: []
summary: 删除某用户的某私有worker使用权
parameters:
- name: userId
in: path
description: 用户ID
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
properties:
worker_del:
type: string
required: true
responses:
200:
description: 删除worker成功
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
/admin/add:
post:
tags:
- admin
security:
- bearerAuth: []
summary: 添加某用户为管理员
requestBody:
content:
application/json:
schema:
properties:
admin_add:
type: string
required: true
responses:
200:
description: 添加管理员成功
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
/admin/del:
delete:
tags:
- admin
security:
- bearerAuth: []
summary: 删除某用户管理员权限
requestBody:
content:
application/json:
schema:
properties:
admin_del:
type: string
required: true
responses:
200:
description: 删除管理员成功
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
/admin/changepwd:
post:
tags:
- admin
security:
- bearerAuth: []
summary: 管理员修改用户密码
requestBody:
content:
application/json:
schema:
properties:
email:
type: string
password:
type: string
required: true
responses:
200:
description: 修改密码成功
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
components:
schemas:
User:
type: object
properties:
email:
type: string
description: 邮箱
password:
type: string
description: 密码
ApiResponse:
type: object
properties:
code:
type: integer
format: int32
flag:
type: boolean
message:
type: string
LoginResponse:
type: object
properties:
code:
type: integer
format: int32
flag:
type: boolean
message:
type: string
token:
type: string
UserInfoResponse:
type: object
properties:
code:
type: integer
format: int32
flag:
type: boolean
message:
type: string
data:
type: object
properties:
id:
type: string
roles:
type: array
items:
type: string
email:
type: string
CreateTaskResponse:
type: object
properties:
code:
type: integer
format: int32
flag:
type: boolean
message:
type: string
data:
type: object
properties:
taskId:
type: string
dataUrl:
type: string
mgeUrl:
type: string
Task:
type: object
properties:
_id:
type: string
description: Task ID
data_name:
type: string
description: 数据文件名
mge_name:
type: string
description: MGE Model文件名
state:
type: string
description: 任务当前状态
updateTime:
type: integer
description: timestamp, 任务上次更新时间
version:
type: string
description: 所选MgeEngine版本
worker:
type: string
description: 所选worker
TaskList:
type: object
properties:
code:
type: integer
format: int32
flag:
type: boolean
message:
type: string
data:
type: object
properties:
total:
type: integer
description: 该用户所有任务条数
rows:
type: array
items:
$ref: '#/components/schemas/Task'
TaskIDResponse:
type: object
properties:
code:
type: integer
format: int32
flag:
type: boolean
message:
type: string
data:
type: array
items:
type: string
GetProfile:
type: object
properties:
taskId:
type: string
aggregate:
type: string
aggregateBy:
type: string
copyTime:
type: boolean
inputDtype:
type: string
maxTime:
type: string
minTime:
type: string
oprName:
type: string
orderBy:
type: string
showHost:
type: boolean
top:
type: string
topEndKey:
type: string
type:
type: array
items:
type: string
ProfileResponse:
type: object
properties:
code:
type: integer
format: int32
flag:
type: boolean
message:
type: string
tot_dev_time:
type: number
format: float
tot_host_time:
type: number
format: float
deviceList:
type: array
items:
$ref: '#/components/schemas/DeviceProfile'
hostList:
type: array
items:
$ref: '#/components/schemas/HostProfile'
DeviceProfile:
type: object
properties:
deviceSelfTime:
type: string
description: 算子在计算设备上(例如 GPU )的运行时间
cumulative:
type: string
description: 累加前面所有算子的时间
operatorInfo:
type: string
description: 打印算子的基本信息
computation:
type: string
description: 算子需要的浮点数操作数目
FLOPS:
type: string
description: 算子每秒执行的浮点操作数目,由 computation 除以 device self time 并转换单位得到
memory:
type: string
description: 算子使用的存储(例如 GPU 显存)大小
bandwidth:
type: string
description: 算子的带宽,由 memory 除以 device self time 并转换单位得到
in_shapes:
type: string
description: 算子输入张量的形状
out_shapes:
type: string
description: 算子输出张量的形状
HostProfile:
type: object
properties:
hostSelfTime:
type: string
description: 算子在计算设备上(例如 GPU )的运行时间
cumulative:
type: string
description: 累加前面所有算子的时间
operatorInfo:
type: string
description: 打印算子的基本信息
computation:
type: string
description: 算子需要的浮点数操作数目
FLOPS:
type: string
description: 算子每秒执行的浮点操作数目,由 computation 除以 device self time 并转换单位得到
memory:
type: string
description: 算子使用的存储(例如 GPU 显存)大小
bandwidth:
type: string
description: 算子的带宽,由 memory 除以 device self time 并转换单位得到
in_shapes:
type: string
description: 算子输入张量的形状
out_shapes:
type: string
description: 算子输出张量的形状
Worker:
type: object
properties:
_id:
type: string
description: worker ID
name:
type: string
description: worker名称
ip:
type: string
description: worker ip
platform:
type: string
description: worker平台架构
mge_version:
type: array
items:
type: string
description: worker上有的MegEngine Version
auth:
type: string
description: worker是public/private
WorkerList:
type: object
properties:
code:
type: integer
format: int32
flag:
type: boolean
message:
type: string
data:
type: array
items:
$ref: '#/components/schemas/Worker'
UserInfo:
type: object
properties:
_id:
type: string
description: 用户 ID
email:
type: string
description: 用户邮箱
roles:
type: array
items:
type: string
description: 用户权限
workers:
type: array
items:
type: string
description: 用户可用的私有worker名称列表
UsersList:
type: object
properties:
code:
type: integer
format: int32
flag:
type: boolean
message:
type: string
data:
type: array
items:
$ref: '#/components/schemas/UserInfo'
Version:
type: object
properties:
platform:
type: string
description: 运行平台,如x86、arm、cuda等
mgeVersion:
type: string
description: MegEngine版本号
VersionResponse:
type: object
properties:
code:
type: integer
format: int32
flag:
type: boolean
message:
type: string
data:
type: array