forked from JointCloud/pcm-coordinator
Compare commits
598 Commits
Author | SHA1 | Date |
---|---|---|
|
7fac75cdf6 | |
|
a1f8e46fec | |
|
dcfcd63f67 | |
|
594dec4538 | |
|
c98ab4a888 | |
|
855d02da5c | |
|
80f07495d5 | |
|
3185981438 | |
|
b574a80516 | |
|
a7f90f139a | |
|
d672a1e0b8 | |
|
e702c27355 | |
|
db6179e9ef | |
|
c65d0059e4 | |
|
493cd14404 | |
|
91247cf0c6 | |
|
1ec0a6709a | |
|
640eebe868 | |
|
3d18fb3fe4 | |
|
c6c11f7a70 | |
|
ec91218790 | |
|
17936bfc4d | |
|
27d6edd3a7 | |
|
574c41e7f8 | |
|
320cd4d954 | |
|
4485b483a2 | |
|
abb6619943 | |
|
fd7b5db529 | |
|
c955378918 | |
|
25d06ff738 | |
|
9fb0890d06 | |
|
409f0a58f4 | |
|
ad00f92e9a | |
|
2ee6300784 | |
|
3fae1ca6dc | |
|
70ad16de20 | |
|
9b0a2d69b7 | |
|
b434fdb5e4 | |
|
27d98fa7e2 | |
|
c0db947974 | |
|
1d1915bed2 | |
|
cb7325393f | |
|
5152c9162e | |
|
b82a4a5943 | |
|
7619307a4f | |
|
6a1655e478 | |
|
78261394ea | |
|
3b1b62e7b7 | |
|
5882083278 | |
|
609be047f3 | |
|
b96aa06f2a | |
|
e718d0c015 | |
|
5c53626ef7 | |
|
3f35a27a6c | |
|
0c8467e66d | |
|
828a69eed7 | |
|
5da8689f59 | |
|
dc2b04c39f | |
|
87cf8383f0 | |
|
46d08fb5af | |
|
f145880c9e | |
|
720d919967 | |
|
f21aeb7c4e | |
|
94a8c8a394 | |
|
d07133062e | |
|
4cb7633870 | |
|
b1fe50a249 | |
|
aca7fe5b5e | |
|
cfdf67cbbe | |
|
82fb53c13e | |
|
1a8ae89abd | |
|
937e9abc69 | |
|
4498264c4e | |
|
0f5302764f | |
|
3e9d9efcd7 | |
|
76c43d54bb | |
|
a32cd79157 | |
|
fcfcebe527 | |
|
61f8e0c4bf | |
|
11a3bed106 | |
|
d4e847bc17 | |
|
bff596c14a | |
|
73e5cb1a6f | |
|
5ad1b2e0fd | |
|
15cc8e807a | |
|
141d4b4aeb | |
|
01525bf9c8 | |
|
d0a8a5e968 | |
|
fa13f14503 | |
|
36b515c070 | |
|
9ba139bd46 | |
|
3dab13028c | |
|
e2965cad1e | |
|
f0543d177f | |
|
c9b00b3f82 | |
|
92dc1d294f | |
|
4529c5686d | |
|
5bef68e391 | |
|
49aefbe89d | |
|
3d6bb2aeee | |
|
9aa8172925 | |
|
4526f5c82a | |
|
ae1232cfdd | |
|
df82e4b59d | |
|
583e07bc08 | |
|
b61842d80b | |
|
a5eda62487 | |
|
0e1df3b20f | |
|
0ef517fc42 | |
|
869b5068ee | |
|
9ab1d007e4 | |
|
07b32df66f | |
|
0186285cbf | |
|
c806fc4e3c | |
|
9689b94964 | |
|
dac230908e | |
|
9e2a8d3f9c | |
|
cbfa00c5d4 | |
|
5d483fcfcf | |
|
c0c11e7d01 | |
|
fe8d858cb3 | |
|
150f3a8cb3 | |
|
19b0291d2c | |
|
d637d3e75b | |
|
7f703c383e | |
|
4e59d689e9 | |
|
55e25b2241 | |
|
a357b6f631 | |
|
37a2e01ab0 | |
|
3c0d54a104 | |
|
daff6afc1b | |
|
db00179bde | |
|
61421727a3 | |
|
db9385e6f9 | |
|
5883bd408b | |
|
17a1363e77 | |
|
76f8f43ed8 | |
|
c3b12e876e | |
|
82aabde7cf | |
|
526b3f21ad | |
|
ad7ffd401f | |
|
af2be1c69d | |
|
6ad5619965 | |
|
f2cc26264d | |
|
8954bc43af | |
|
dbd60b1e9e | |
|
0c2ae0a53a | |
|
0491591356 | |
|
7e338bb2b1 | |
|
ce102c300a | |
|
004c1dc7b9 | |
|
5cddc441ed | |
|
83efaba600 | |
|
c9507b4e60 | |
|
249e50da67 | |
|
7babb44c0b | |
|
bb6cc2c7f8 | |
|
2c22db7f94 | |
|
c85a67a3e6 | |
|
81fc410614 | |
|
359032dbdb | |
|
ec75df2330 | |
|
a3a7a2786a | |
|
947971d380 | |
|
442e4f0798 | |
|
c0b5cb6607 | |
|
f9db2d24ba | |
|
20c7d03f6c | |
|
8561e22467 | |
|
16f3179860 | |
|
e02d8f2b7d | |
|
26563d041b | |
|
d927298012 | |
|
42e936f5fc | |
|
14c32306f1 | |
|
cbc4a679bc | |
|
c94c0a00c2 | |
|
4cddfafb77 | |
|
5d1ed45fd2 | |
|
a7d72f6be7 | |
|
afca41be1d | |
|
b6301e7070 | |
|
2e02d93fcc | |
|
6aeb2455f7 | |
|
8814e573c9 | |
|
e7b061bd95 | |
|
361aa538d8 | |
|
d3b4abf82e | |
|
ebda9d7643 | |
|
712fa9da24 | |
|
c5d1cf0455 | |
|
924b88ad4a | |
|
426121cbff | |
|
87dce38462 | |
|
4db73cb3c9 | |
|
9afda659a3 | |
|
7571b341e8 | |
|
99d2594b02 | |
|
2c10ac6766 | |
|
25cc13de17 | |
|
38caa66cae | |
|
a6355d14b3 | |
|
0fb98f87e2 | |
|
8a048b25c5 | |
|
3e8ece035a | |
|
6f89b7f0c9 | |
|
c2c2113f5d | |
|
888833d5bd | |
|
8dd14a6421 | |
|
1000e9e563 | |
|
28c30cc60c | |
|
331249a223 | |
|
6934c792a6 | |
|
31e6a26cf6 | |
|
c6afdf783f | |
|
e08af3984a | |
|
0392ad0b61 | |
|
a988a0aa52 | |
|
ffbcd77ffb | |
|
d2d00184e6 | |
|
c7941604f6 | |
|
ee2c724d99 | |
|
adad357f89 | |
|
9f160d45b5 | |
|
cbaa61c977 | |
|
0a8e47a317 | |
|
300d5f0815 | |
|
e172479ddd | |
|
79cf6968f8 | |
|
7ed4e56ecd | |
|
087f426b30 | |
|
1969076fb6 | |
|
56147efa7e | |
|
4fe189e4fa | |
|
cfdaebc9fb | |
|
81b79ff940 | |
|
a261fa36a4 | |
|
89ae54df38 | |
|
18cd493668 | |
|
a5b5f5928e | |
|
d7dee070d7 | |
|
8f719c4f26 | |
|
d6ea74fb36 | |
|
b81389ad31 | |
|
4dc279f4af | |
|
7bccb4e6fc | |
|
1eaa81bdd2 | |
|
99fc0fe72f | |
|
68ef77f53e | |
|
de4a36179a | |
|
e0347f91ef | |
|
e3cc0074b4 | |
|
19fa6e4e77 | |
|
32bba534b7 | |
|
21dfdbc726 | |
|
d6662688ad | |
|
1fbb93a97c | |
|
4e1f872ef8 | |
|
ff370e5001 | |
|
e93bdcb0f7 | |
|
112b3409c1 | |
|
7acfb8df7b | |
|
e814c13501 | |
|
cba74a19be | |
|
644a7df225 | |
|
919f8054b2 | |
|
7462d5f867 | |
|
d087fac9a3 | |
|
2dd83fb8f2 | |
|
56afa62bf9 | |
|
202657b2ca | |
|
73a71fb9dd | |
|
b77ee7e149 | |
|
d1368ea5d8 | |
|
5f6df0f485 | |
|
9c5613bda9 | |
|
9e078572a7 | |
|
618c33d6e6 | |
|
f27d8a1c6d | |
|
b98fcc2e0f | |
|
481c4d27de | |
|
390d3b6de7 | |
|
08fc74bbaa | |
|
77d342ecb8 | |
|
10181809b7 | |
|
017e7ce0f3 | |
|
5356627973 | |
|
cc273cb5ec | |
|
75343be0cb | |
|
0618a99e48 | |
|
6b46b4be2e | |
|
c9d63de8d5 | |
|
aa29c1b917 | |
|
313ccbf749 | |
|
3a6c4ae17c | |
|
1682755098 | |
|
aefb1513f1 | |
|
ad288b6c63 | |
|
bb7b0dcd16 | |
|
482645eae3 | |
|
ff46ec2dba | |
|
2c4a912a60 | |
|
22873670af | |
|
6a249ff23e | |
|
48d5ca855b | |
|
cb254563cb | |
|
7440da141f | |
|
d5c58bb477 | |
|
5073ab3752 | |
|
84540521b6 | |
|
cc166fb745 | |
|
7e6a21622f | |
|
1ec680a49a | |
|
2fd33dba38 | |
|
49d14c867c | |
|
a99fc4c9bd | |
|
1be24bae11 | |
|
2a18a74a97 | |
|
deeffbd48f | |
|
759a8209b3 | |
|
aa7d50a9e8 | |
|
2718992bb3 | |
|
cdff8aeb0c | |
|
7f8023759a | |
|
a45f6cf4ed | |
|
3eb2ab199b | |
|
7e0205ccaf | |
|
a8bd2234f1 | |
|
223fe4e118 | |
|
dd2141de25 | |
|
609576c7bb | |
|
31a4bf0558 | |
|
38504b6926 | |
|
442afca0c3 | |
|
915155fe8f | |
|
30f77b4ee1 | |
|
33031c1a91 | |
|
821382fc80 | |
|
f1d42b94f1 | |
|
866a2522f4 | |
|
b928418500 | |
|
a5767b2de0 | |
|
44e1bcf808 | |
|
87f3668dfe | |
|
b09f92a2b4 | |
|
d38bbfd63d | |
|
7428edb8c0 | |
|
f3cc32a199 | |
|
d91082b4cc | |
|
55a97edf2d | |
|
ff90c0aad5 | |
|
34f0cdb669 | |
|
40cc2eb687 | |
|
1a38f543dc | |
|
3027150cea | |
|
f66cc00f88 | |
|
77ac425440 | |
|
165f5d8e54 | |
|
ecaa003010 | |
|
46c2b95f29 | |
|
69e40e8c3d | |
|
25d32c1a20 | |
|
e3d2815499 | |
|
7d68ab7b05 | |
|
c4963f2a41 | |
|
fffa8f1d7e | |
|
35bd0dd9bf | |
|
b202722970 | |
|
df03f35a67 | |
|
cdf8f986b6 | |
|
a8506d0dd7 | |
|
af8372a9f0 | |
|
e72b155f22 | |
|
a229b9ff7f | |
|
4aa95f8c69 | |
|
eadc12e36f | |
|
101936c01a | |
|
dfdbc869fd | |
|
6a4a787c73 | |
|
0bc023ce84 | |
|
f332205879 | |
|
af6dd88b65 | |
|
4c48020344 | |
|
f26ce2f383 | |
|
0abdf06f2f | |
|
b3fa7b879a | |
|
db9d21bfa1 | |
|
68166a2ac3 | |
|
ac3133deb2 | |
|
3d3b279f3b | |
|
1c7090ccb4 | |
|
dea9e77de5 | |
|
b9e883513c | |
|
d663fec04d | |
|
95e675a9b6 | |
|
1319d8fa01 | |
|
8693a0af0e | |
|
4d52089d0c | |
|
f4de311e65 | |
|
0dce83d028 | |
|
e12815dea8 | |
|
188f28fd44 | |
|
5ba37bcb04 | |
|
680d972389 | |
|
d53fe14db1 | |
|
18e1766eb5 | |
|
816dfc0738 | |
|
d6457d7562 | |
|
22412ba7b4 | |
|
7cf80af152 | |
|
6e4a40d4d6 | |
|
62cc090568 | |
|
fc160e48ea | |
|
ae8ad38a7e | |
|
e35626ac11 | |
|
360fb9c9d8 | |
|
e265ccfb8e | |
|
9c68e810c4 | |
|
9b9d392d99 | |
|
de59175d0d | |
|
7af131f90d | |
|
75df1f9938 | |
|
c782b98c33 | |
|
7b7f2bcbfa | |
|
9bc0bce2eb | |
|
e8be04bd10 | |
|
6000644d67 | |
|
2c953b4b31 | |
|
d9f3fc8d37 | |
|
fc757458a1 | |
|
1cea85636a | |
|
c1d7bfbbc4 | |
|
88046ae05b | |
|
c988a7a608 | |
|
ec297664b4 | |
|
c76fa0492e | |
|
c0d8724035 | |
|
0f6f62ff08 | |
|
b01d7e552e | |
|
6e14f47471 | |
|
f2d30d63fb | |
|
c552f5d536 | |
|
15bf137eca | |
|
91a27291d5 | |
|
74e8912a7c | |
|
db654de359 | |
|
8eb39081bf | |
|
944ed76afa | |
|
9d004a2430 | |
|
30089922c8 | |
|
51615227aa | |
|
18e3aeb6ee | |
|
0822bb9216 | |
|
b7e230aa59 | |
|
8a494957b3 | |
|
d937c49013 | |
|
12b6f662f8 | |
|
c2b8ada454 | |
|
d3b28100a3 | |
|
6e95c7bf73 | |
|
a7fbb9450e | |
|
d21b27301e | |
|
09fe4b469d | |
|
cc816c9a18 | |
|
ac116cba04 | |
|
a70535d8a5 | |
|
10a82a7344 | |
|
d6dffcb165 | |
|
d50b27ca26 | |
|
bd403f5213 | |
|
c6170d19b4 | |
|
d8cca0896f | |
|
ee94bea986 | |
|
1beff0dcf4 | |
|
63d0c53506 | |
|
6b6dd65d5e | |
|
1fcdfd29f5 | |
|
752c30a7dd | |
|
488f4408cd | |
|
939f261acb | |
|
6afb8c7b37 | |
|
f914eb22e9 | |
|
81a25707db | |
|
852976b37b | |
|
640078bcf4 | |
|
a7a52bff5f | |
|
a458c85231 | |
|
c45814974d | |
|
11ade9f6fd | |
|
16758c05c0 | |
|
03eca58eb8 | |
|
a077ac1ca0 | |
|
3d4b0914c3 | |
|
66e9966c10 | |
|
fa98a31520 | |
|
cd7abd352b | |
|
f25cd1a5c8 | |
|
3cf1521eca | |
|
82bc8681c0 | |
|
3dc460b034 | |
|
da714069f9 | |
|
ff35ffef90 | |
|
7cfbe76b47 | |
|
3108757f22 | |
|
0e656f11f4 | |
|
8f4bec0db1 | |
|
f035318b88 | |
|
cb616ac4d0 | |
|
46bdccc91a | |
|
25aba4d03e | |
|
a0a8c48bca | |
|
94c275b5e1 | |
|
5449e2b4ef | |
|
967196632e | |
|
8cfccde058 | |
|
7d33ee2c72 | |
|
20b1fdbbba | |
|
7d2d42bf24 | |
|
74dc25884a | |
|
995add5c5e | |
|
2d82c1d401 | |
|
b6edcb5cb6 | |
|
99e0fbe082 | |
|
9e87ad1652 | |
|
e079e40a26 | |
|
777790e4a9 | |
|
94d11d6d68 | |
|
f42c37357c | |
|
d7b03ce173 | |
|
39e30bbd01 | |
|
14eb1b0ac7 | |
|
b6a939f977 | |
|
587de3d235 | |
|
f2fbd54600 | |
|
12f0a9dbe8 | |
|
cc95ec409c | |
|
85d9e0fdf6 | |
|
73223af5b8 | |
|
a5a854017b | |
|
c00aadeff3 | |
|
f8236e085c | |
|
398501999a | |
|
97f4a34462 | |
|
5a592bdec1 | |
|
b27c3c628e | |
|
400e947405 | |
|
abef2aec34 | |
|
d760a5a5ed | |
|
826f1c69dc | |
|
04a2871fc8 | |
|
d952cfe6c6 | |
|
da16c57b0b | |
|
2796853fcb | |
|
829c535dee | |
|
bcd6acfe76 | |
|
5754895d92 | |
|
28c3397a94 | |
|
acf99f0019 | |
|
07404698fd | |
|
46ba08b814 | |
|
efca0f338b | |
|
9b6677bb1d | |
|
2e3cf8d46a | |
|
df6fe8e66c | |
|
c9967c6600 | |
|
945b09a7e0 | |
|
f63cbcd6c8 | |
|
cdf060883a | |
|
acb3f7c33a | |
|
dd46e199e5 | |
|
14f4fa1b60 | |
|
819b691c4d | |
|
d885094f1e | |
|
0fc6084c42 | |
|
c66d7b2fcd | |
|
b350f9546f | |
|
d494e37d69 | |
|
252dc03240 | |
|
ee25ebf2bf | |
|
ce83ca0471 | |
|
3517c4a0e7 | |
|
0a48628bf7 | |
|
ca7b833da0 | |
|
6fa3412ba5 | |
|
b39e821aec | |
|
a2ae89e103 | |
|
73a3e84745 | |
|
a6267288be | |
|
6bc8969b36 | |
|
5fd6b7e585 | |
|
4417de15da | |
|
afb67be82f | |
|
30757569d6 | |
|
938e063cf3 | |
|
99d2e8dfcb | |
|
53718cea4d | |
|
89f195c5c2 | |
|
1a59690f2e |
|
@ -3,6 +3,9 @@ name: aly
|
|||
description: 发布环境:https://comnet.jointcloud.net
|
||||
global:
|
||||
concurrent: 1
|
||||
cache:
|
||||
- GOCACHE
|
||||
- GOMODCACHE
|
||||
workflow:
|
||||
- ref: start
|
||||
name: 开始
|
||||
|
@ -24,6 +27,9 @@ workflow:
|
|||
- start
|
||||
- ref: docker_image_build_0
|
||||
name: docker镜像构建
|
||||
cache:
|
||||
GOCACHE: /root/.cache/go-build
|
||||
GOMODCACHE: /go/pkg/mod
|
||||
task: docker_image_build@1.6.0
|
||||
input:
|
||||
docker_username: ((aly.docker_user))
|
||||
|
|
|
@ -1,30 +1,15 @@
|
|||
version: 2
|
||||
name: 阿里云
|
||||
description: ""
|
||||
name: tencent-develop
|
||||
description: 腾讯云开发环境
|
||||
global:
|
||||
concurrent: 1
|
||||
param:
|
||||
- ref: ssh_host
|
||||
name: ""
|
||||
value: '"47.92.39.128"'
|
||||
required: false
|
||||
type: STRING
|
||||
hidden: true
|
||||
- ref: ssh_user
|
||||
name: ""
|
||||
value: '"root"'
|
||||
required: false
|
||||
type: STRING
|
||||
hidden: true
|
||||
cache:
|
||||
- GOCACHE
|
||||
- GOMODCACHE
|
||||
workflow:
|
||||
- ref: start
|
||||
name: 开始
|
||||
task: start
|
||||
- ref: end
|
||||
name: 结束
|
||||
task: end
|
||||
needs:
|
||||
- ssh_cmd_0
|
||||
- ref: git_clone_0
|
||||
name: git clone
|
||||
task: git_clone@1.2.9
|
||||
|
@ -37,16 +22,20 @@ workflow:
|
|||
- start
|
||||
- ref: docker_image_build_0
|
||||
name: docker镜像构建
|
||||
cache:
|
||||
GOCACHE: /root/.cache/go-build
|
||||
GOMODCACHE: /go/pkg/mod
|
||||
task: docker_image_build@1.6.0
|
||||
input:
|
||||
docker_username: ((aly.docker_user))
|
||||
docker_password: ((aly.docker_password))
|
||||
image_name: '"registry.cn-hangzhou.aliyuncs.com/jcce/pcm-core-api"'
|
||||
image_tag: '"latest"'
|
||||
image_tag: '"dev-latest"'
|
||||
registry_address: '"registry.cn-hangzhou.aliyuncs.com"'
|
||||
docker_file: '"Dockerfile"'
|
||||
docker_build_path: git_clone_0.git_path
|
||||
docker_build_path: '"."'
|
||||
workspace: git_clone_0.git_path
|
||||
image_clean: true
|
||||
image_push: true
|
||||
build_args: '""'
|
||||
needs:
|
||||
|
@ -56,10 +45,15 @@ workflow:
|
|||
task: ssh_cmd@1.1.1
|
||||
input:
|
||||
ssh_private_key: ((aly.ssh_private_key))
|
||||
ssh_ip: global.ssh_host
|
||||
ssh_ip: '"119.45.255.234"'
|
||||
ssh_port: '"22"'
|
||||
ssh_user: global.ssh_user
|
||||
ssh_cmd: '"kubectl rollout restart deployment pcm-core-api -n ns-admin"'
|
||||
ssh_user: '"root"'
|
||||
ssh_cmd: '"kubectl rollout restart deployment -n jcce-system pcm-core-api"'
|
||||
needs:
|
||||
- docker_image_build_0
|
||||
- ref: end
|
||||
name: 结束
|
||||
task: end
|
||||
needs:
|
||||
- ssh_cmd_0
|
||||
|
|
@ -24,5 +24,6 @@ buf.lock
|
|||
configs/tenanter.yaml
|
||||
|
||||
log/
|
||||
logs/
|
||||
/cache/
|
||||
/vendor/
|
||||
|
|
21
Dockerfile
21
Dockerfile
|
@ -1,20 +1,29 @@
|
|||
FROM --platform=$BUILDPLATFORM golang:alpine AS builder
|
||||
FROM docker-0.unsee.tech/golang:alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
ENV GO111MODULE=on
|
||||
ENV GOPROXY=https://goproxy.cn \
|
||||
GO111MODULE=on \
|
||||
CGO_ENABLED=0 \
|
||||
GOCACHE=/root/.cache/go-build \
|
||||
GOMODCACHE=/go/pkg/mod
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
# 使用 GOOS 和 GOARCH 环境变量来构建不同架构的二进制文件
|
||||
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="-w -s" -o pcm-core-api
|
||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||
--mount=type=cache,target=/root/.cache/go-build \
|
||||
GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="-w -s" -o pcm-core-api
|
||||
|
||||
FROM --platform=$TARGETPLATFORM alpine:latest
|
||||
FROM --platform=$TARGETPLATFORM docker-0.unsee.tech/alpine:latest
|
||||
WORKDIR /app
|
||||
|
||||
#修改alpine源为上海交通大学
|
||||
RUN apk add --no-cache ca-certificates && update-ca-certificates && \
|
||||
apk add --update tzdata && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
|
|
@ -200,3 +200,24 @@ type Card struct {
|
|||
CardHours float64 `json:"cardHours"`
|
||||
CardNum int32 `json:"cardNum"`
|
||||
}
|
||||
|
||||
type AdapterCreateReq struct {
|
||||
Id string `json:"id,optional" db:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
ResourceType string `json:"resourceType"`
|
||||
Nickname string `json:"nickname"`
|
||||
Version string `json:"version"`
|
||||
Server string `json:"server"`
|
||||
}
|
||||
type AdapterCreateResp struct {
|
||||
Id string `json:"id,omitempty" db:"id"`
|
||||
Name string `json:"name,omitempty" db:"name"`
|
||||
Type string `json:"type,omitempty" db:"type"`
|
||||
ResourceType string `json:"resourceType,omitempty" db:"resource_type"`
|
||||
Nickname string `json:"nickname,omitempty" db:"nickname"`
|
||||
Version string `json:"version,omitempty" db:"version"`
|
||||
Server string `json:"server,omitempty" db:"server"`
|
||||
CreateTime string `json:"createTime,omitempty" db:"create_time" gorm:"autoCreateTime"`
|
||||
InfoName string `json:"info_name,omitempty"`
|
||||
}
|
||||
|
|
|
@ -59,9 +59,9 @@ type (
|
|||
Type int64 `json:"type"` // 租户所属(0数算,1超算,2智算)
|
||||
DeletedFlag int64 `json:"deletedFlag"` // 是否删除
|
||||
CreatedBy int64 `json:"createdBy"` // 创建人
|
||||
CreateTime string `json:"createdTime"` // 创建时间
|
||||
CreateTime string `json:"createdTime"` // 创建时间
|
||||
UpdatedBy int64 `json:"updatedBy"` // 更新人
|
||||
UpdateTime string `json:"updated_time"` // 更新时间
|
||||
UpdateTime string `json:"updated_time"` // 更新时间
|
||||
}
|
||||
|
||||
UpdateTenantReq {
|
||||
|
@ -103,6 +103,7 @@ type DataSet {
|
|||
type cloudListResp {
|
||||
Clouds []Cloud `json:"clouds"`
|
||||
}
|
||||
|
||||
type Cloud {
|
||||
Id int64 `json:"id"` // id
|
||||
TaskId int64 `json:"taskId"` // 任务id
|
||||
|
@ -115,6 +116,12 @@ type Cloud {
|
|||
StartTime string `json:"startTime"` // 开始时间
|
||||
RunningTime int64 `json:"runningTime"` // 运行时长
|
||||
CreatedBy int64 `json:"createdBy"` // 创建人
|
||||
CreateTime string `json:"createdTime"` // 创建时间
|
||||
CreateTime string `json:"createdTime"` // 创建时间
|
||||
Result string `json:"result"`
|
||||
}
|
||||
|
||||
type PodsListReq {
|
||||
}
|
||||
type PodsListResp {
|
||||
Data []interface{} `json:"data"`
|
||||
}
|
|
@ -102,7 +102,7 @@ type remoteResp {
|
|||
|
||||
type (
|
||||
clustersLoadReq {
|
||||
ClusterName string `form:"clusterName"`
|
||||
|
||||
}
|
||||
clustersLoadResp {
|
||||
Data interface{} `json:"data"`
|
||||
|
@ -128,6 +128,7 @@ type (
|
|||
PodsUtilisation float64 `json:"podsUtilisation,optional"`
|
||||
PodsCount int64 `json:"podsCount,optional"`
|
||||
PodsTotal int64 `json:"podsTotal,optional"`
|
||||
NodeCount float64 `json:"nodeCount,optional"`
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -157,6 +158,8 @@ type (
|
|||
|
||||
type (
|
||||
GeneralTaskReq {
|
||||
Token string `json:"token,optional"`
|
||||
UserId int64 `json:"userId,optional"`
|
||||
Name string `json:"name"`
|
||||
AdapterIds []string `json:"adapterIds"`
|
||||
ClusterIds []string `json:"clusterIds"`
|
||||
|
@ -164,6 +167,11 @@ type (
|
|||
StaticWeightMap map[string]int32 `json:"staticWeightMap,optional"`
|
||||
ReqBody []string `json:"reqBody"`
|
||||
Replicas int64 `json:"replicas,string"`
|
||||
UserIp string `json:"userIp,optional"`
|
||||
}
|
||||
|
||||
GeneralTaskResp {
|
||||
TaskId int64 `json:"taskId"`
|
||||
}
|
||||
|
||||
PodLogsReq {
|
||||
|
@ -317,8 +325,8 @@ type (
|
|||
}
|
||||
)
|
||||
|
||||
type(
|
||||
asynCommitAiTaskReq{
|
||||
type (
|
||||
asynCommitAiTaskReq {
|
||||
Name string `json:"name,optional"`
|
||||
AdapterIds []string `json:"adapterIds,optional"`
|
||||
ClusterIds []string `json:"clusterIds,optional"`
|
||||
|
@ -329,15 +337,14 @@ type(
|
|||
Command string `json:"command,optional"`
|
||||
FlavorId string `json:"flavorId,optional"`
|
||||
Status string `json:"status,optional"`
|
||||
ClusterId int64 `json:"clusterId,optional"`
|
||||
AdapterId string `json:"adapterId,optional"`
|
||||
|
||||
ClusterId int64 `json:"clusterId,optional"`
|
||||
AdapterId string `json:"adapterId,optional"`
|
||||
}
|
||||
|
||||
asynCommitAiTaskResp{
|
||||
Code int32 `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
TaskId int64 `json:"taskId"`
|
||||
asynCommitAiTaskResp {
|
||||
Code int32 `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
TaskId int64 `json:"taskId"`
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -404,7 +411,10 @@ type (
|
|||
}
|
||||
|
||||
pageTaskReq {
|
||||
UserId int64 `form:"userId,optional"`
|
||||
Name string `form:"name,optional"`
|
||||
Type string `form:"type,optional"`
|
||||
UserName string `form:"userName,optional"`
|
||||
PageInfo
|
||||
}
|
||||
|
||||
|
@ -428,6 +438,7 @@ type (
|
|||
UpdatedTime string `json:"updatedTime,omitempty" db:"updated_time"`
|
||||
AdapterTypeDict string `json:"adapterTypeDict" db:"adapter_type_dict" gorm:"adapter_type_dict"` //适配器类型(对应字典表的值
|
||||
TaskTypeDict string `json:"taskTypeDict" db:"task_type_dict" gorm:"task_type_dict"` //任务类型(对应字典表的值
|
||||
UserId int64 `json:"userId,omitempty" db:"user_id"`
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -873,6 +884,7 @@ type (
|
|||
ProducerDict string `form:"producerDict,optional"`
|
||||
RegionDict string `form:"regionDict,optional"`
|
||||
ResourceType string `form:"resourceType,optional"`
|
||||
StorageSchedule string `form:"storageSchedule,optional"`
|
||||
PageInfo
|
||||
}
|
||||
|
||||
|
@ -899,6 +911,8 @@ type (
|
|||
RegionDict string `json:"regionDict,optional"`
|
||||
RegionName string `json:"regionName,optional"`
|
||||
Environment map[string]string `json:"environment,optional"`
|
||||
CostType string `json:"costType,optional"`
|
||||
Price int `json:"price,optional"`
|
||||
}
|
||||
ClusterInfo {
|
||||
Id string `json:"id,omitempty" db:"id"`
|
||||
|
@ -913,6 +927,8 @@ type (
|
|||
Token string `json:"token,omitempty" db:"token"`
|
||||
Ak string `json:"ak,omitempty" db:"ak"`
|
||||
Sk string `json:"sk,omitempty" db:"sk"`
|
||||
PrivateKey string `json:"privateKey,omitempty" db:"private_key"`
|
||||
Passphrase string `json:"passphrase,omitempty" db:"passphrase"`
|
||||
Region string `json:"region,omitempty" db:"region"`
|
||||
ProjectId string `json:"projectId,omitempty" db:"project_id"`
|
||||
Version string `json:"version,omitempty" db:"version"`
|
||||
|
@ -926,7 +942,20 @@ type (
|
|||
EnvPath string `json:"envPath,omitempty" db:"env_path"`
|
||||
EnvLdPath string `json:"envLdPath,omitempty" db:"env_ld_path"`
|
||||
WorkDir string `json:"workDir,omitempty" db:"work_dir"`
|
||||
Address string `json:"address,omitempty" db:"address"`
|
||||
ProxyAddress string `json:"proxyAddress,omitempty" db:"proxy_address"`
|
||||
ProxyEnable string `json:"proxyEnable,omitempty" db:"proxy_enable"`
|
||||
Driver string `json:"driver,omitempty" db:"driver"`
|
||||
}
|
||||
|
||||
ClusterBaseInfo {
|
||||
Id string `json:"id,omitempty" db:"id"`
|
||||
AdapterId int64 `json:"adapterId,omitempty,string" db:"adapter_id"`
|
||||
Name string `json:"name,omitempty" db:"name"`
|
||||
Nickname string `json:"nickname,omitempty" db:"nickname"`
|
||||
Description string `json:"description,omitempty" db:"description"`
|
||||
Server string `json:"server,omitempty" db:"server"`
|
||||
Driver string `json:"driver,omitempty" db:"driver"`
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -991,7 +1020,7 @@ type adapterInfoNameReqResp {
|
|||
Code int32 `json:"code,omitempty"`
|
||||
Msg string `json:"msg,omitempty"`
|
||||
ErrorMsg string `json:"errorMsg,omitempty"`
|
||||
InfoList InfoList `json:"infoList,omitempty"`
|
||||
InfoList InfoList `json:"infoList,omitempty"`
|
||||
}
|
||||
|
||||
type InfoList {
|
||||
|
@ -1279,7 +1308,7 @@ type (
|
|||
TaskName string `json:"taskName"`
|
||||
Incident string `json:"incident"`
|
||||
}
|
||||
ListNoticeReq{
|
||||
ListNoticeReq {
|
||||
}
|
||||
|
||||
ListNoticeResp {
|
||||
|
@ -1352,6 +1381,7 @@ type (
|
|||
Remark string `json:"remark" db:"remark"`
|
||||
InferUrl string `json:"inferUrl"`
|
||||
WorkDir string `json:"workDir"`
|
||||
AppName string `json:"appName"`
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -1360,5 +1390,110 @@ type (
|
|||
Code int `json:"code,omitempty"`
|
||||
Msg string `json:"msg,omitempty"`
|
||||
Data interface{} `json:"data,omitempty"`
|
||||
TraceId string `json:"traceId,omitempty"`
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
type ResourceCost {
|
||||
ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
|
||||
ResourceID int64 `json:"resourceId" gorm:"column:resource_id"`
|
||||
Price int `json:"price" gorm:"column:price"`
|
||||
CostType string `json:"costType" gorm:"column:cost_type"`
|
||||
ResourceType string `json:"resourceType" gorm:"column:resource_type"`
|
||||
}
|
||||
|
||||
type ResourceCostRecord {
|
||||
ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
|
||||
ResourcePriceID int64 `json:"resourcePriceId" gorm:"column:resource_price_id"`
|
||||
UserId int64 `json:"userId" gorm:"column:user_id"`
|
||||
Amount int `json:"amount" gorm:"column:amount"`
|
||||
StartTime string `json:"startTime" gorm:"column:start_time"`
|
||||
EndTime string `json:"endTime" gorm:"column:end_time"`
|
||||
Status int `json:"status" gorm:"column:status"`
|
||||
UsageHours string `json:"usageHours" gorm:"column:usage_hours"`
|
||||
}
|
||||
|
||||
type ResourceSpecReq {
|
||||
ClusterId string `form:"clusterId,optional"`
|
||||
Type string `form:"type,optional"`
|
||||
Name string `form:"name,optional"`
|
||||
Status string `form:"status,optional"`
|
||||
changeType string `form:"changeType,optional"`
|
||||
Tag string `form:"tag,optional"` // 标签(Train: 训练,Inference:推理)
|
||||
PageInfo
|
||||
}
|
||||
|
||||
type FetchResourceSpecReq {
|
||||
ClusterId string `form:"clusterId,optional"`
|
||||
Tag string `form:"tag,optional"`
|
||||
UserId int64 `form:"userId,optional"`
|
||||
}
|
||||
|
||||
type IdReq {
|
||||
Id string `form:"id,optional" json:"id,optional"`
|
||||
}
|
||||
|
||||
type DeletePathId {
|
||||
Id string `path:"id"`
|
||||
}
|
||||
|
||||
type ResourceSpecResp {
|
||||
Data []ResourceSpec `json:"resourceSpec"`
|
||||
PageInfo
|
||||
}
|
||||
|
||||
type ResourceSpec {
|
||||
Id int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
|
||||
Type string `json:"type" gorm:"column:type"`
|
||||
Name string `json:"name" gorm:"column:name"`
|
||||
TotalCount int64 `json:"totalCount" gorm:"column:total_count"`
|
||||
AvailableCount int64 `json:"availableCount" gorm:"column:available_count"`
|
||||
ChangeType int32 `json:"changeType" gorm:"column:change_type"`
|
||||
Status int32 `json:"status" gorm:"column:status"`
|
||||
Region string `json:"region" gorm:"column:region"`
|
||||
ClusterId string `json:"clusterId" gorm:"column:cluster_id"`
|
||||
CostPerUnit float64 `json:"costPerUnit" gorm:"column:cost_per_unit"`
|
||||
CostType string `json:"costType" gorm:"column:cost_type"` //计费类型(hourly, daily, monthly,perUse)
|
||||
Tag string `json:"tag" gorm:"tag"` // 标签(0: 训练,1:推理,-1:通用)
|
||||
UserId string `json:"userId" gorm:"column:user_id"`
|
||||
CreateTime string `json:"createTime" gorm:"column:create_time"`
|
||||
UpdateTime string `json:"updateTime" gorm:"column:update_time"`
|
||||
|
||||
BaseResourceSpecs []BaseResourceSpec `json:"baseResourceSpec" gorm:"foreignKey:ResourceSpecId"`
|
||||
}
|
||||
|
||||
type BaseResourceSpec {
|
||||
Id int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
|
||||
ResourceSpecId int64 `json:"resourceSpecId" gorm:"column:resource_spec_id"`
|
||||
Type string `json:"type" gorm:"column:type"`
|
||||
Name string `json:"name" gorm:"column:name"`
|
||||
TotalValue float64 `json:"totalValue" gorm:"column:total_value"`
|
||||
TotalUnit string `json:"totalUnit" gorm:"column:total_unit"`
|
||||
AvailableValue float64 `json:"availableValue" gorm:"column:available_value"`
|
||||
AvailableUnit string `json:"availableUnit" gorm:"column:available_unit"`
|
||||
UserId string `json:"userId" gorm:"column:user_id"`
|
||||
CreateTime string `json:"createTime" gorm:"column:create_time"`
|
||||
UpdateTime string `json:"updateTime" gorm:"column:update_time"`
|
||||
}
|
||||
|
||||
type EditResourceReq {
|
||||
Id int64 `json:"id,string" gorm:"column:id;primaryKey;autoIncrement"`
|
||||
status string `json:"status" gorm:"column:status"`
|
||||
CostPerUnit string `json:"costPerUnit" gorm:"column:cost_per_unit"`
|
||||
CostType string `json:"costType" gorm:"column:cost_type"` //计费类型(hourly, daily, monthly,perUse)
|
||||
Type string `json:"type,optional" gorm:"column:type"`
|
||||
|
||||
// 基础资源规格
|
||||
StorageValue string `json:"storageValue,optional"`
|
||||
StorageUnit string `json:"storageUnit,optional"`
|
||||
CpuValue string `json:"cpuValue,optional"`
|
||||
CpuUnit string `json:"cpuUnit,optional"`
|
||||
MemoryValue string `json:"memoryValue,optional"`
|
||||
MemoryUnit string `json:"memoryUnit,optional"`
|
||||
UserId int64 `json:"userId,optional"`
|
||||
}
|
||||
|
||||
type SyncResourceReq {
|
||||
Id string `json:"id"`
|
||||
UserId int64 `json:"userId,optional"`
|
||||
}
|
|
@ -10,34 +10,34 @@ info(
|
|||
|
||||
type (
|
||||
commitHpcTaskReq {
|
||||
ClusterId string `json:"clusterId,optional"`
|
||||
Name string `json:"name"`
|
||||
Account string `json:"account,optional"`
|
||||
Backend string `json:"backend"`
|
||||
ClusterId string `json:"clusterId"`
|
||||
App string `json:"app"`
|
||||
Description string `json:"description,optional"`
|
||||
TenantId int64 `json:"tenantId,optional"`
|
||||
TaskId int64 `json:"taskId,optional"`
|
||||
AdapterIds []string `json:"adapterIds,optional"`
|
||||
MatchLabels map[string]string `json:"matchLabels,optional"`
|
||||
CardCount int64 `json:"cardCount,optional"`
|
||||
WorkDir string `json:"workDir,optional"` //paratera:workingDir
|
||||
WallTime string `json:"wallTime,optional"`
|
||||
CmdScript string `json:"cmdScript,optional"` // paratera:bootScript
|
||||
AppType string `json:"appType,optional"`
|
||||
AppName string `json:"appName,optional"` // paratera:jobGroupName ac:appname
|
||||
Queue string `json:"queue,optional"`
|
||||
NNode string `json:"nNode,optional"`
|
||||
SubmitType string `json:"submitType,optional"`
|
||||
StdInput string `json:"stdInput,optional"`
|
||||
ClusterType string `json:"clusterType,optional"`
|
||||
Partition string `json:"partition"`
|
||||
}
|
||||
|
||||
commitHpcTaskResp {
|
||||
ClusterId int64 `json:"clusterId"`
|
||||
JobId string `json:"jobId"`
|
||||
OperateType string `json:"operateType,optional"`
|
||||
Parameters map[string]string `json:"parameters"`
|
||||
CustomParams map[string]string `json:"customParams"`
|
||||
ScriptContent string `json:"scriptContent,optional"`
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
type (
|
||||
commitHpcTaskResp {
|
||||
Code int `json:"code"`
|
||||
Data Data `json:"data"`
|
||||
Msg string `json:"msg"`
|
||||
TraceId string `json:"trace_id"`
|
||||
}
|
||||
Data {
|
||||
Backend string `json:"backend"`
|
||||
JobInfo map[string]string `json:"jobInfo"`
|
||||
}
|
||||
|
||||
)
|
||||
|
||||
|
||||
type (
|
||||
hpcOverViewReq {
|
||||
}
|
||||
|
@ -111,8 +111,9 @@ type (
|
|||
)
|
||||
|
||||
type cancelJobReq {
|
||||
ClusterId int64 `form:"clusterId"`
|
||||
JobId string `form:"jobId"`
|
||||
ClusterId int64 `form:"clusterId,optional"`
|
||||
JobId string `form:"jobId,optional"`
|
||||
taskId string `form:"taskId"`
|
||||
}
|
||||
|
||||
type jobInfoReq {
|
||||
|
@ -149,4 +150,72 @@ type QueueAsset {
|
|||
QueMaxDcuPN string `json:"queMaxDcuPN,omitempty"` //队列单作业最大DCU卡数
|
||||
QueFreeNcpus string `json:"queFreeNcpus"` //队列空闲cpu数
|
||||
QueNcpus string `json:"queNcpus"` //队列cpu数
|
||||
}
|
||||
|
||||
type (
|
||||
/******************instance center*************************/
|
||||
HpcInstanceCenterReq {
|
||||
PageInfo
|
||||
InstanceType int32 `form:"instanceType,optional"`
|
||||
InstanceClass string `form:"instanceClass,optional"`
|
||||
InstanceName string `form:"instanceName,optional"`
|
||||
}
|
||||
HpcInstanceCenterResp {
|
||||
InstanceCenterList []HpcInstanceCenterList `json:"instanceCenterList" copier:"InstanceCenterList"`
|
||||
TotalCount int `json:"totalCount"`
|
||||
}
|
||||
HpcInstanceCenterList {
|
||||
LogoPath string `json:"logo_path"`
|
||||
InstanceName string `json:"instance_name"`
|
||||
InstanceType int32 `json:"instance_type"`
|
||||
InstanceClass string `json:"instance_class"`
|
||||
InstanceClassChinese string `json:"instance_class_chinese"`
|
||||
Description string `json:"description"`
|
||||
Version string `json:"version"`
|
||||
}
|
||||
|
||||
/******************instance center*************************/
|
||||
)
|
||||
|
||||
type(
|
||||
HpcTaskLogResp{
|
||||
Code int32 `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
)
|
||||
|
||||
type(
|
||||
HpcTaskLogReq{
|
||||
TaskId string `path:"taskId"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
|
||||
HpcAppTemplateInfo {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
App string `json:"app"`
|
||||
AppType string `json:"app_type"`
|
||||
ClusterId int64 `json:"cluster_id"`
|
||||
Content string `json:"content"`
|
||||
Description string `json:"description"`
|
||||
Status int32 `json:"status"`
|
||||
CreateTime string `json:"create_time"`
|
||||
UpdateTime string `json:"update_time"`
|
||||
}
|
||||
|
||||
SubmitHpcTaskReq {
|
||||
App string `json:"app"`
|
||||
ClusterId string `json:"clusterId"`
|
||||
JobName string `json:"jobName"`
|
||||
ScriptContent string `json:"scriptContent"`
|
||||
Parameters map[string]string `json:"parameters"`
|
||||
Backend string `json:"backend"`
|
||||
}
|
||||
)
|
||||
|
||||
type HpcAppClusterReq {
|
||||
App string `form:"app"`
|
||||
}
|
|
@ -1,5 +1,9 @@
|
|||
syntax = "v1"
|
||||
|
||||
import (
|
||||
"../schedule/pcm-schedule.api"
|
||||
)
|
||||
|
||||
type (
|
||||
/******************image inference*************************/
|
||||
DeployInstance {
|
||||
|
@ -123,8 +127,22 @@ type (
|
|||
}
|
||||
|
||||
/******************Deploy instance*************************/
|
||||
GetDeployInstanceReq{
|
||||
AdapterId string `form:"adapterId"`
|
||||
ClusterId string `form:"clusterId"`
|
||||
Id string `form:"id"`
|
||||
InstanceId string `form:"instanceId"`
|
||||
}
|
||||
|
||||
GetDeployInstanceResp {
|
||||
Instance interface{} `json:"instance"`
|
||||
}
|
||||
|
||||
|
||||
DeployInstanceListReq{
|
||||
PageInfo
|
||||
UserId int64 `form:"userId,optional"`
|
||||
UserName string `form:"userName,optional"`
|
||||
}
|
||||
|
||||
DeployInstanceListResp {
|
||||
|
@ -231,5 +249,19 @@ type (
|
|||
ClusterName string `json:"clusterName"`
|
||||
}
|
||||
|
||||
// 推理任务
|
||||
CreateInferenceTaskReq {
|
||||
Name string `json:"name"`
|
||||
UserId int64 `json:"userId,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
Token string `json:"token,optional"`
|
||||
UserIp string `json:"userIp,optional"`
|
||||
JobResources JobResources `json:"jobResources"`
|
||||
DataDistributes DataDistribute `json:"dataDistributes"`
|
||||
}
|
||||
|
||||
CreateInferenceTaskResp {
|
||||
TaskId string `json:"taskId"`
|
||||
TaskName string `json:"taskName"`
|
||||
}
|
||||
)
|
||||
|
|
143
desc/pcm.api
143
desc/pcm.api
|
@ -13,18 +13,18 @@ import (
|
|||
"inference/inference.api"
|
||||
)
|
||||
|
||||
info(
|
||||
title: "pcm api service"
|
||||
desc: "type desc here"
|
||||
author: "type author here"
|
||||
email: "type email here"
|
||||
info (
|
||||
title: "pcm api service"
|
||||
desc: "type desc here"
|
||||
author: "type author here"
|
||||
email: "type email here"
|
||||
version: "type version here"
|
||||
)
|
||||
|
||||
//core端接口
|
||||
@server(
|
||||
@server (
|
||||
prefix: pcm/v1
|
||||
group: core
|
||||
group: core
|
||||
)
|
||||
service pcm {
|
||||
@doc "查询P端服务列表"
|
||||
|
@ -135,6 +135,10 @@ service pcm {
|
|||
@handler pageListTaskHandler
|
||||
get /core/task/list (pageTaskReq) returns (PageResult)
|
||||
|
||||
@doc "paging queries the task list"
|
||||
@handler ScreenPageTaskHandler
|
||||
get /core/task/screen (pageTaskReq) returns (PageResult)
|
||||
|
||||
@doc "Statistical task status"
|
||||
@handler countTaskStatus
|
||||
get /core/task/countTaskStatus returns (TaskStatusResp)
|
||||
|
@ -174,12 +178,46 @@ service pcm {
|
|||
@doc "根据集群id获取集群信息"
|
||||
@handler getClusterByIdHandler
|
||||
get /core/getClusterById (getClusterByIdReq) returns (getClusterByIdResp)
|
||||
|
||||
//集群资源规格----- 开始
|
||||
@doc "与Api接口对比集群资源规格"
|
||||
@handler compareResourceSpecHandler
|
||||
get /core/ai/resourceSpec/compare (FetchResourceSpecReq) returns (PageResult)
|
||||
|
||||
@doc "同步指定资源规格"
|
||||
@handler syncResourceSpecHandler
|
||||
put /core/ai/resourceSpec/sync (SyncResourceReq) returns (ListResult)
|
||||
|
||||
@doc "获取指定资源规格详情"
|
||||
@handler detailResourceSpecHandler
|
||||
get /core/ai/resourceSpec/detail (IdReq) returns (ResourceSpec)
|
||||
|
||||
@doc "取消资源规格告警"
|
||||
@handler cancelResourceSpecAlarmHandler
|
||||
put /core/ai/resourceSpec/cancelAlarm (IdReq) returns (CommonResp)
|
||||
|
||||
@doc "编辑资源规格"
|
||||
@handler editResourceSpecHandler
|
||||
put /core/ai/resourceSpec/edit (EditResourceReq) returns (CommonResp)
|
||||
|
||||
@doc "删除资源规格"
|
||||
@handler deleteResourceSpecHandler
|
||||
delete /core/ai/resourceSpec/delete/:id (DeletePathId) returns (CommonResp)
|
||||
|
||||
@doc "获取资源规格列表"
|
||||
@handler pageResourceRange
|
||||
get /core/ai/resourceSpec/page (ResourceSpecReq) returns (PageResult)
|
||||
|
||||
@doc "获取资源规格范围"
|
||||
@handler resourceRange
|
||||
get /core/ai/resourceSpec/range (ResourceSpecReq) returns (ListResult)
|
||||
//集群资源规格----- 结束
|
||||
}
|
||||
|
||||
//hpc二级接口
|
||||
@server(
|
||||
@server (
|
||||
prefix: pcm/v1
|
||||
group: hpc
|
||||
group: hpc
|
||||
)
|
||||
service pcm {
|
||||
@doc "提交超算任务"
|
||||
|
@ -213,12 +251,24 @@ service pcm {
|
|||
@doc "查看job状态"
|
||||
@handler jobInfoHandler
|
||||
get /hpc/jobInfo (jobInfoReq) returns (jobInfoResp)
|
||||
|
||||
@doc "查询超算应用中心列表"
|
||||
@handler ListInstanceCenter
|
||||
get /hpc/ListInstanceCenter (HpcInstanceCenterReq) returns (PageResult)
|
||||
|
||||
@doc "超算任务日志"
|
||||
@handler getHpcTaskLogHandler
|
||||
get /hpc/jobLogs/:taskId (HpcTaskLogReq) returns (HpcTaskLogResp)
|
||||
|
||||
@doc "查询超算应用支持的集群"
|
||||
@handler getHpcAppClusterHandler
|
||||
get /hpc/getHpcAppCluster (HpcAppClusterReq) returns (CommonResp)
|
||||
}
|
||||
|
||||
//cloud二级接口
|
||||
@server(
|
||||
@server (
|
||||
prefix: pcm/v1
|
||||
group: cloud
|
||||
group: cloud
|
||||
)
|
||||
service pcm {
|
||||
@doc "云算任务列表"
|
||||
|
@ -247,16 +297,19 @@ service pcm {
|
|||
|
||||
@doc "Create cloud computing common tasks"
|
||||
@handler commitGeneralTask
|
||||
post /cloud/task/create (GeneralTaskReq)
|
||||
post /cloud/task/create (GeneralTaskReq) returns (GeneralTaskResp)
|
||||
|
||||
@handler podLogs
|
||||
post /cloud/pod/logs (PodLogsReq) returns (string)
|
||||
|
||||
@handler podsList
|
||||
get /cloud/pods/list (PodsListReq) returns (PodsListResp)
|
||||
}
|
||||
|
||||
//智算二级接口
|
||||
@server(
|
||||
@server (
|
||||
prefix: pcm/v1
|
||||
group: ai
|
||||
group: ai
|
||||
)
|
||||
service pcm {
|
||||
@doc "训练任务统计"
|
||||
|
@ -285,7 +338,7 @@ service pcm {
|
|||
|
||||
@doc "创建数据集"
|
||||
@handler CreateDataSetHandler
|
||||
post /ai/createDataSet/:projectId (CreateDataSetReq) returns (CreateDataSetResp)
|
||||
post /ai/createDataSet (CreateDataSetReq) returns (CreateDataSetResp)
|
||||
|
||||
@doc "删除数据集"
|
||||
@handler DeleteDataSetHandler
|
||||
|
@ -309,7 +362,7 @@ service pcm {
|
|||
|
||||
@doc "创建算法"
|
||||
@handler CreateAlgorithmHandler
|
||||
post /ai/CreateAlgorithm/:projectId (CreateAlgorithmReq) returns (CreateAlgorithmResp)
|
||||
post /ai/createAlgorithm (CreateAlgorithmReq) returns (CreateAlgorithmResp)
|
||||
|
||||
@doc "查询创建算法列表"
|
||||
@handler ListAlgorithms
|
||||
|
@ -403,13 +456,13 @@ service pcm {
|
|||
@doc "文本识别"
|
||||
@handler ChatHandler
|
||||
post /ai/chat (ChatReq) returns (ChatResult)
|
||||
/******chat end***********/
|
||||
/******chat end***********/
|
||||
}
|
||||
|
||||
//screen接口
|
||||
@server(
|
||||
@server (
|
||||
prefix: pcm/v1
|
||||
group: storage
|
||||
group: storage
|
||||
)
|
||||
service pcm {
|
||||
@doc "日常算力查询"
|
||||
|
@ -422,9 +475,9 @@ service pcm {
|
|||
}
|
||||
|
||||
//openstack 接口
|
||||
@server(
|
||||
@server (
|
||||
prefix: pcm/v1
|
||||
group: vm
|
||||
group: vm
|
||||
)
|
||||
service pcm {
|
||||
@doc "openstack计算中心概览"
|
||||
|
@ -821,9 +874,9 @@ service pcm {
|
|||
}
|
||||
|
||||
//存算联动 接口
|
||||
@server(
|
||||
@server (
|
||||
prefix: pcm/v1
|
||||
group: storelink
|
||||
group: storelink
|
||||
)
|
||||
service pcm {
|
||||
@handler UploadLinkImageHandler
|
||||
|
@ -852,9 +905,9 @@ service pcm {
|
|||
}
|
||||
|
||||
// 接口
|
||||
@server(
|
||||
@server (
|
||||
prefix: pcm/v1
|
||||
group: adapters
|
||||
group: adapters
|
||||
)
|
||||
service pcm {
|
||||
@handler AdaptersListHandler
|
||||
|
@ -895,11 +948,14 @@ service pcm {
|
|||
|
||||
@handler GetAdapterInfoHandler
|
||||
get /adapter/getAdapterInfo (adapterInfoNameReq) returns (adapterInfoNameReqResp)
|
||||
|
||||
@handler GetClusterBaseInfoHandler
|
||||
get /adapter/cluster/getClusterBaseInfo (ClusterReq) returns (PageResult)
|
||||
}
|
||||
|
||||
@server(
|
||||
@server (
|
||||
prefix: pcm/v1
|
||||
group: schedule
|
||||
group: schedule
|
||||
)
|
||||
service pcm {
|
||||
@handler ScheduleGetAiResourceTypesHandler
|
||||
|
@ -937,13 +993,31 @@ service pcm {
|
|||
|
||||
@handler GetClusterBalanceByIdHandler
|
||||
get /schedule/getClusterBalanceById/:adapterId/:clusterId (GetClusterBalanceByIdReq) returns (GetClusterBalanceByIdResp)
|
||||
|
||||
@handler QueryResourcesHandler
|
||||
post /schedule/queryResources (QueryResourcesReq) returns (QueryResourcesResp)
|
||||
|
||||
@handler ScheduleCreateTaskHandler
|
||||
post /schedule/createTask (CreateTaskReq) returns (CreateTaskResp)
|
||||
|
||||
@handler ScheduleRunTaskHandler
|
||||
post /schedule/runTask (RunTaskReq) returns (RunTaskResp)
|
||||
|
||||
@handler ScheduleCancelTaskHandler
|
||||
post /schedule/cancelTask (CancelTaskReq) returns (CancelTaskResp)
|
||||
}
|
||||
|
||||
@server(
|
||||
@server (
|
||||
prefix: pcm/v1
|
||||
group: inference
|
||||
group: inference
|
||||
)
|
||||
service pcm {
|
||||
@handler GetDeployInstanceHandler
|
||||
get /inference/getDeployInstance (GetDeployInstanceReq) returns (GetDeployInstanceResp)
|
||||
|
||||
@handler CreateInferenceTaskHandler
|
||||
post /inference/createTask (CreateInferenceTaskReq) returns (CreateInferenceTaskResp)
|
||||
|
||||
@handler TextToTextInferenceHandler
|
||||
post /inference/text (TextToTextInferenceReq) returns (TextToTextInferenceResp)
|
||||
|
||||
|
@ -996,9 +1070,9 @@ service pcm {
|
|||
get /inference/getAdaptersByModel (GetAdaptersByModelReq) returns (GetAdaptersByModelResp)
|
||||
}
|
||||
|
||||
@server(
|
||||
@server (
|
||||
prefix: pcm/v1
|
||||
group: dictionary
|
||||
group: dictionary
|
||||
)
|
||||
service pcm {
|
||||
@handler GetDict
|
||||
|
@ -1035,9 +1109,9 @@ service pcm {
|
|||
get /dictItem/code/:dictCode (DictCodeReq) returns (PageResult)
|
||||
}
|
||||
|
||||
@server(
|
||||
@server (
|
||||
prefix: pcm/v1
|
||||
group: monitoring
|
||||
group: monitoring
|
||||
)
|
||||
service pcm {
|
||||
@handler CreateAlertRuleHandler
|
||||
|
@ -1074,4 +1148,5 @@ service pcm {
|
|||
|
||||
@handler scheduleSituationHandler
|
||||
get /monitoring/schedule/situation returns (scheduleSituationResp)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ info(
|
|||
|
||||
type (
|
||||
ScheduleReq {
|
||||
Token string `json:"token,optional"`
|
||||
AiOption *AiOption `json:"aiOption,optional"`
|
||||
}
|
||||
|
||||
|
@ -150,4 +151,124 @@ type (
|
|||
GetClusterBalanceByIdResp{
|
||||
Balance float64 `json:"balance"`
|
||||
}
|
||||
|
||||
// 调度资源信息:/queryResources
|
||||
QueryResourcesReq{
|
||||
Type string `json:"type"`
|
||||
ClusterIDs []string `json:"clusterIDs,optional"`
|
||||
}
|
||||
|
||||
QueryResourcesResp{
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
// 创建任务(下发资源):/createTask
|
||||
CreateTaskReq{
|
||||
Name string `json:"name"`
|
||||
UserId int64 `json:"userId,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
Token string `json:"token,optional"`
|
||||
UserIp string `json:"userIp,optional"`
|
||||
JobResources JobResources `json:"jobResources"`
|
||||
DataDistributes DataDistribute `json:"dataDistributes"`
|
||||
}
|
||||
|
||||
JobResources{
|
||||
ScheduleStrategy string `json:"scheduleStrategy"`
|
||||
Clusters []*JobClusterInfo `json:"clusters"`
|
||||
}
|
||||
|
||||
JobClusterInfo{
|
||||
ClusterID string `json:"clusterID"`
|
||||
Resources []map[string]interface{} `json:"resources,optional"`
|
||||
Runtime JobRuntimeInfo `json:"runtime,optional"`
|
||||
}
|
||||
|
||||
JobRuntimeInfo{
|
||||
Command string `json:"command,optional"`
|
||||
Envs map[string]interface{} `json:"envs,optional"`
|
||||
Params map[string]interface{} `json:"params,optional"`
|
||||
}
|
||||
|
||||
DataDistribute {
|
||||
Dataset []*DatasetDistribute `json:"dataset,optional"`
|
||||
Code []*CodeDistribute `json:"code"`
|
||||
Image []*ImageDistribute `json:"image"`
|
||||
Model []*ModelDistribute `json:"model,optional"`
|
||||
}
|
||||
|
||||
DatasetDistribute {
|
||||
DataName string `json:"dataName,optional"`
|
||||
PackageID int64 `json:"packageID"`
|
||||
Clusters []*ClusterScheduled `json:"clusters"`
|
||||
}
|
||||
|
||||
CodeDistribute {
|
||||
DataName string `json:"dataName,optional"`
|
||||
PackageID int64 `json:"packageID"`
|
||||
Output string `json:"output"`
|
||||
Clusters []*ClusterScheduled `json:"clusters"`
|
||||
}
|
||||
|
||||
ImageDistribute {
|
||||
DataName string `json:"dataName,optional"`
|
||||
PackageID int64 `json:"packageID"`
|
||||
Clusters []*ClusterScheduled `json:"clusters"`
|
||||
}
|
||||
|
||||
ModelDistribute {
|
||||
DataName string `json:"dataName,optional"`
|
||||
PackageID int64 `json:"packageID"`
|
||||
Clusters []*ClusterScheduled `json:"clusters"`
|
||||
}
|
||||
|
||||
ClusterScheduled {
|
||||
ClusterID string `json:"clusterID"`
|
||||
JsonData string `json:"jsonData"`
|
||||
}
|
||||
|
||||
CreateTaskResp {
|
||||
TaskID int64 `json:"taskID"`
|
||||
TaskName string `json:"taskName"`
|
||||
ScheduleDatas []*ScheduleData `json:"scheduleDatas"`
|
||||
}
|
||||
|
||||
ScheduleData {
|
||||
DataType string `json:"dataType"` // 数据类型:数据集、镜像..
|
||||
PackageID int64 `json:"packageID"`
|
||||
StorageType string `json:"storageType"` // 目的地类型:如代码仓、JCS
|
||||
ClusterIDs []string `json:"clusterIDs"`
|
||||
}
|
||||
|
||||
// 启动任务(资源已就绪):/runTask
|
||||
RunTaskReq {
|
||||
TaskID int64 `json:"taskID"`
|
||||
ScheduledDatas []*DataScheduleResults `json:"scheduledDatas,optional"`
|
||||
}
|
||||
|
||||
DataScheduleResults {
|
||||
DataType string `json:"dataType"`
|
||||
Results []*DataScheduleResult `json:"results"`
|
||||
}
|
||||
|
||||
DataScheduleResult {
|
||||
Clusters []*ClusterScheduled `json:"clusters"`
|
||||
PackageID int64 `json:"packageID"`
|
||||
PackageFullPath string `json:"packageFullPath"`
|
||||
Status bool `json:"status"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
RunTaskResp {
|
||||
|
||||
}
|
||||
|
||||
CancelTaskReq {
|
||||
TaskId int64 `json:"taskID"`
|
||||
}
|
||||
|
||||
CancelTaskResp {
|
||||
|
||||
}
|
||||
|
||||
)
|
25
etc/pcm.yaml
25
etc/pcm.yaml
|
@ -2,11 +2,17 @@ Name: pcm.core.api
|
|||
Host: 0.0.0.0
|
||||
Port: 8999
|
||||
MaxBytes: 524288000
|
||||
Log:
|
||||
Mode: file
|
||||
Level: debug
|
||||
Path: ./logs
|
||||
Rotation: daily
|
||||
ServiceName: "pcm.core.api"
|
||||
|
||||
Timeout: 500000
|
||||
|
||||
DB:
|
||||
DataSource: root:uJpLd6u-J?HC1@(10.206.0.12:3306)/pcm?parseTime=true&loc=Local
|
||||
DataSource: root:uJpLd6u-J?HC1@(119.45.255.234:3306)/pcm?parseTime=true&loc=Local
|
||||
Redis:
|
||||
Host: 10.206.0.12:6379
|
||||
Pass: redisPW123
|
||||
|
@ -73,4 +79,19 @@ MinioConf:
|
|||
Endpoint: http://121.89.220.60:9000
|
||||
|
||||
SnowflakeConf:
|
||||
MachineId: 1
|
||||
MachineId: 1
|
||||
|
||||
BlockChain:
|
||||
url: https://rsfhrlsaybqm.test.jointcloud.net/contract/invoke
|
||||
# url: http://localhost:2006/contract/invoke
|
||||
ContractAddress: 0x22ac23bf2d2cf1b4d8fec9cb4d279c7da6718e35
|
||||
FunctionName: "storeEvidence"
|
||||
MemberName: "pcm"
|
||||
Type: "2"
|
||||
|
||||
JcsMiddleware:
|
||||
JobStatusReportUrl: http://101.201.215.196:7891/jobSet/jobStatusReport
|
||||
|
||||
Participant:
|
||||
AdapterId: "1777144940456666666"
|
||||
CloudAdapterId: "1770658294298316800"
|
125
go.mod
125
go.mod
|
@ -8,30 +8,37 @@ require (
|
|||
github.com/bwmarrin/snowflake v0.3.0
|
||||
github.com/ghodss/yaml v1.0.0
|
||||
github.com/go-redis/redis/v8 v8.11.5
|
||||
github.com/go-resty/resty/v2 v2.15.3
|
||||
github.com/go-resty/resty/v2 v2.16.2
|
||||
github.com/golang-jwt/jwt/v5 v5.2.2
|
||||
github.com/jinzhu/copier v0.4.0
|
||||
github.com/json-iterator/go v1.1.12
|
||||
github.com/mitchellh/mapstructure v1.5.0
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.71.2
|
||||
github.com/prometheus/alertmanager v0.27.0
|
||||
github.com/prometheus/client_golang v1.20.5
|
||||
github.com/prometheus/common v0.60.1
|
||||
github.com/prometheus/common v0.61.0
|
||||
github.com/robfig/cron/v3 v3.0.1
|
||||
github.com/zeromicro/go-zero v1.7.3
|
||||
gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20240920093406-601f283f0185
|
||||
gitlink.org.cn/JointCloud/pcm-hpc v0.0.0-20241111114240-940b4f37ffb5
|
||||
gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20240918011543-482dcd609877
|
||||
gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20240817071412-44397870b110
|
||||
github.com/rs/zerolog v1.28.0
|
||||
github.com/zeromicro/go-zero v1.7.4
|
||||
gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20250107025835-8fc888b1d170
|
||||
gitlink.org.cn/JointCloud/pcm-hpc v0.0.0-20241125115811-72f3568255a4
|
||||
gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20250313064001-91fb558cfdb6
|
||||
gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20250624091120-dee975c73c57
|
||||
gitlink.org.cn/JointCloud/pcm-openi v0.0.0-20250320103718-7bd6650118ee
|
||||
gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203
|
||||
gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5
|
||||
go.opentelemetry.io/otel/trace v1.31.0
|
||||
go.opentelemetry.io/otel/trace v1.32.0
|
||||
gonum.org/v1/gonum v0.11.0
|
||||
google.golang.org/grpc v1.67.1
|
||||
google.golang.org/grpc v1.68.1
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
gorm.io/datatypes v1.2.0
|
||||
gorm.io/driver/mysql v1.5.7
|
||||
gorm.io/gorm v1.25.12
|
||||
k8s.io/apimachinery v0.31.2
|
||||
k8s.io/client-go v0.31.2
|
||||
k8s.io/api v0.31.4
|
||||
k8s.io/apimachinery v0.31.4
|
||||
k8s.io/client-go v0.31.4
|
||||
sigs.k8s.io/yaml v1.4.0
|
||||
)
|
||||
|
||||
|
@ -44,12 +51,11 @@ require (
|
|||
github.com/aws/aws-sdk-go v1.50.8 // indirect
|
||||
github.com/benbjohnson/clock v1.3.5 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bytedance/sonic v1.11.6 // indirect
|
||||
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
||||
github.com/bytedance/sonic v1.13.1 // indirect
|
||||
github.com/bytedance/sonic/loader v0.2.4 // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/cloudwego/base64x v0.1.4 // indirect
|
||||
github.com/cloudwego/iasm v0.2.0 // indirect
|
||||
github.com/cloudwego/base64x v0.1.5 // indirect
|
||||
github.com/coreos/go-semver v0.3.1 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
|
@ -58,8 +64,8 @@ require (
|
|||
github.com/fatih/color v1.18.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
|
||||
github.com/gin-contrib/sse v1.0.0 // indirect
|
||||
github.com/gin-gonic/gin v1.10.0 // indirect
|
||||
github.com/go-kit/log v0.2.1 // indirect
|
||||
github.com/go-logfmt/logfmt v0.6.0 // indirect
|
||||
|
@ -77,20 +83,20 @@ require (
|
|||
github.com/go-openapi/validate v0.23.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.20.0 // indirect
|
||||
github.com/go-playground/validator/v10 v10.25.0 // indirect
|
||||
github.com/go-sql-driver/mysql v1.8.1 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/goccy/go-json v0.10.5 // indirect
|
||||
github.com/gofrs/uuid v4.4.0+incompatible // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
|
||||
github.com/golang/mock v1.6.0 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/google/btree v1.0.1 // indirect
|
||||
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
|
||||
github.com/google/gnostic-models v0.6.9 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
|
||||
github.com/hashicorp/go-msgpack v0.5.3 // indirect
|
||||
|
@ -98,6 +104,7 @@ require (
|
|||
github.com/hashicorp/go-sockaddr v1.0.6 // indirect
|
||||
github.com/hashicorp/golang-lru v0.6.0 // indirect
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hashicorp/memberlist v0.5.0 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
|
@ -105,16 +112,16 @@ require (
|
|||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/jpillora/backoff v1.0.0 // indirect
|
||||
github.com/klauspost/compress v1.17.11 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
|
||||
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
|
||||
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||
github.com/miekg/dns v1.1.58 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
|
@ -129,54 +136,60 @@ require (
|
|||
github.com/prometheus/exporter-toolkit v0.11.0 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
github.com/redis/go-redis/v9 v9.7.0 // indirect
|
||||
github.com/sagikazarmark/locafero v0.4.0 // indirect
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
|
||||
github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c // indirect
|
||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/spf13/afero v1.11.0 // indirect
|
||||
github.com/spf13/cast v1.6.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/viper v1.19.0 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
|
||||
github.com/xlab/treeprint v1.2.0 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.16 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.16 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.5.16 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.17 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.17 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.5.17 // indirect
|
||||
go.mongodb.org/mongo-driver v1.17.1 // indirect
|
||||
go.opentelemetry.io/otel v1.31.0 // indirect
|
||||
go.opentelemetry.io/otel v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/zipkin v1.31.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.31.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.31.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/zipkin v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.32.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.4.0 // indirect
|
||||
go.uber.org/automaxprocs v1.6.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.27.0 // indirect
|
||||
golang.org/x/arch v0.8.0 // indirect
|
||||
golang.org/x/crypto v0.28.0 // indirect
|
||||
golang.org/x/arch v0.15.0 // indirect
|
||||
golang.org/x/crypto v0.36.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect
|
||||
golang.org/x/mod v0.21.0 // indirect
|
||||
golang.org/x/net v0.30.0 // indirect
|
||||
golang.org/x/oauth2 v0.23.0 // indirect
|
||||
golang.org/x/sync v0.8.0 // indirect
|
||||
golang.org/x/sys v0.26.0 // indirect
|
||||
golang.org/x/term v0.25.0 // indirect
|
||||
golang.org/x/text v0.19.0 // indirect
|
||||
golang.org/x/time v0.7.0 // indirect
|
||||
golang.org/x/tools v0.25.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect
|
||||
google.golang.org/protobuf v1.35.1 // indirect
|
||||
golang.org/x/mod v0.22.0 // indirect
|
||||
golang.org/x/net v0.37.0 // indirect
|
||||
golang.org/x/oauth2 v0.24.0 // indirect
|
||||
golang.org/x/sync v0.12.0 // indirect
|
||||
golang.org/x/sys v0.31.0 // indirect
|
||||
golang.org/x/term v0.30.0 // indirect
|
||||
golang.org/x/text v0.23.0 // indirect
|
||||
golang.org/x/time v0.8.0 // indirect
|
||||
golang.org/x/tools v0.28.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect
|
||||
google.golang.org/protobuf v1.36.5 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/api v0.31.2 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
k8s.io/klog/v2 v2.130.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20241009091222-67ed5848f094 // indirect
|
||||
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20241127205056-99599406b04f // indirect
|
||||
k8s.io/utils v0.0.0-20241210054802-24370beab758 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.3 // indirect
|
||||
)
|
||||
|
|
250
go.sum
250
go.sum
|
@ -75,10 +75,11 @@ github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
|||
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
|
||||
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
|
||||
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
|
||||
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
||||
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
||||
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
||||
github.com/bytedance/sonic v1.13.1 h1:Jyd5CIvdFnkOWuKXr+wm4Nyk2h0yAFsr8ucJgEasO3g=
|
||||
github.com/bytedance/sonic v1.13.1/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=
|
||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||
github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY=
|
||||
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
|
||||
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
|
@ -91,13 +92,13 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn
|
|||
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
|
||||
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
|
||||
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
||||
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=
|
||||
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
|
||||
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
|
||||
github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
|
||||
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
|
@ -114,16 +115,18 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
|
|||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
|
||||
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
|
||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
||||
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
|
||||
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
|
||||
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
|
||||
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
||||
github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
|
||||
github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
|
||||
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E=
|
||||
github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0=
|
||||
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
||||
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
|
@ -170,12 +173,12 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
|
|||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
|
||||
github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||
github.com/go-playground/validator/v10 v10.25.0 h1:5Dh7cjvzR7BRZadnsVOzPhWsrwUr0nmsZJxEAnFLNO8=
|
||||
github.com/go-playground/validator/v10 v10.25.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus=
|
||||
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
|
||||
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
|
||||
github.com/go-resty/resty/v2 v2.15.3 h1:bqff+hcqAflpiF591hhJzNdkRsFhlB96CYfBwSFvql8=
|
||||
github.com/go-resty/resty/v2 v2.15.3/go.mod h1:0fHAoK7JoBy/Ch36N8VFeMsK7xQOHhvWaC3iOktwmIU=
|
||||
github.com/go-resty/resty/v2 v2.16.2 h1:CpRqTjIzq/rweXUt9+GxzzQdlkqMdt8Lm/fuK/CAbAg=
|
||||
github.com/go-resty/resty/v2 v2.16.2/go.mod h1:0fHAoK7JoBy/Ch36N8VFeMsK7xQOHhvWaC3iOktwmIU=
|
||||
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
|
||||
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
||||
|
@ -183,16 +186,18 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me
|
|||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
||||
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA=
|
||||
github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||
github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo=
|
||||
github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA=
|
||||
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||
github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A=
|
||||
|
@ -230,8 +235,8 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z
|
|||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4=
|
||||
github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA=
|
||||
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 h1:0VpGH+cDhbDtdcweoyCVsF3fhN8kejK6rFe/2FFX2nU=
|
||||
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49/go.mod h1:BkkQ4L1KS1xMt2aWSPStnn55ChGC0DPOn2FQYj+f25M=
|
||||
github.com/google/gnostic-models v0.6.9 h1:MU/8wDLif2qCXZmzncUQ/BOfxWfthHi63KqpoNbWqVw=
|
||||
github.com/google/gnostic-models v0.6.9/go.mod h1:CiWsm0s6BSQd1hRn8/QmxqB6BesYcbSZxsz9b0KuDBw=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
|
@ -263,8 +268,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
|||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 h1:TmHmbvxPmaegwhDubVz0lICL0J5Ka2vwTzhoePEXsGE=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0/go.mod h1:qztMSjm835F2bXf+5HKAPIS5qsmQDqZna/PgVt4rWtI=
|
||||
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
|
||||
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
|
@ -292,6 +297,8 @@ github.com/hashicorp/golang-lru v0.6.0 h1:uL2shRDx7RTrOrTCUZEGP/wJUFiUI8QT6E7z5o
|
|||
github.com/hashicorp/golang-lru v0.6.0/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR/prTM=
|
||||
github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
|
@ -332,8 +339,8 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
|
|||
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
||||
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
||||
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
|
@ -353,10 +360,14 @@ github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhR
|
|||
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
|
||||
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
|
||||
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
|
@ -436,8 +447,8 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b
|
|||
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
|
||||
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
|
||||
github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
|
||||
github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc=
|
||||
github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw=
|
||||
github.com/prometheus/common v0.61.0 h1:3gv/GThfX0cV2lpO7gkTUwZru38mxevy90Bj8YFSRQQ=
|
||||
github.com/prometheus/common v0.61.0/go.mod h1:zr29OCN/2BsJRaFwG8QOBr41D6kkchKbpeNH7pAjb/s=
|
||||
github.com/prometheus/common/sigv4 v0.1.0 h1:qoVebwtwwEhS85Czm2dSROY5fTo2PAPEVdDeppTwGX4=
|
||||
github.com/prometheus/common/sigv4 v0.1.0/go.mod h1:2Jkxxk9yYvCkE5G1sQT7GuEXm57JrvHu9k5YwTjsNtI=
|
||||
github.com/prometheus/exporter-toolkit v0.11.0 h1:yNTsuZ0aNCNFQ3aFTD2uhPOvr4iD7fdBvKPAEGkNf+g=
|
||||
|
@ -456,6 +467,13 @@ github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzG
|
|||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
|
||||
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
|
||||
github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||
github.com/rs/zerolog v1.28.0 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY=
|
||||
github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0=
|
||||
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
|
||||
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
|
||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I=
|
||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||
github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c h1:aqg5Vm5dwtvL+YgDpBcK1ITf3o96N/K7/wsRXQnUTEs=
|
||||
|
@ -465,10 +483,18 @@ github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJV
|
|||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
||||
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
|
||||
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
|
||||
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
||||
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
|
||||
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
|
||||
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
|
||||
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
|
||||
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
|
@ -482,8 +508,11 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
|||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
|
||||
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
|
@ -502,26 +531,28 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
|
|||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M=
|
||||
github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
|
||||
github.com/zeromicro/go-zero v1.7.3 h1:yDUQF2DXDhUHc77/NZF6mzsoRPMBfldjPmG2O/ZSzss=
|
||||
github.com/zeromicro/go-zero v1.7.3/go.mod h1:9JIW3gHBGuc9LzvjZnNwINIq9QdiKu3AigajLtkJamQ=
|
||||
gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20240920093406-601f283f0185 h1:B+YBB5xHlIAS6ILuaCGQwbOpr/L6LOHAlj9PeFUCetM=
|
||||
gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20240920093406-601f283f0185/go.mod h1:3eECiw9O2bIFkkePlloKyLNXiqBAhOxNrDoGaaGseGY=
|
||||
gitlink.org.cn/JointCloud/pcm-hpc v0.0.0-20241111114240-940b4f37ffb5 h1:VSmSXELLuk0nBJ/1eDkNV+gZDu0ccIZi3YjzdTCoph0=
|
||||
gitlink.org.cn/JointCloud/pcm-hpc v0.0.0-20241111114240-940b4f37ffb5/go.mod h1:ei9EaEAtEdOHyTRZ1CR6Z9P+H0WqeLzx8Fant2t1ViE=
|
||||
gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20240918011543-482dcd609877 h1:a+1FpxqLPRojlAkJlAeRhKRbxajymXYgrM+s9bfQx0E=
|
||||
gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20240918011543-482dcd609877/go.mod h1:/eOmBFZKWGoabG3sRVkVvIbLwsd2631k4jkUBR6x1AA=
|
||||
gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20240817071412-44397870b110 h1:GaXwr5sgDh0raHjUf9IewTvnRvajYea7zbLsaerYyXo=
|
||||
gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20240817071412-44397870b110/go.mod h1:QOD5+/l2D+AYBjF2h5T0mdJyfGAmF78QmeKdbBXbjLQ=
|
||||
github.com/zeromicro/go-zero v1.7.4 h1:lyIUsqbpVRzM4NmXu5pRM3XrdRdUuWOkQmHiNmJF0VU=
|
||||
github.com/zeromicro/go-zero v1.7.4/go.mod h1:jmv4hTdUBkDn6kxgI+WrKQw0q6LKxDElGPMfCLOeeEY=
|
||||
gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20250107025835-8fc888b1d170 h1:/n3pl6WuHk6hmkIs0LF5um9WreggL2QuDIOch10ELEI=
|
||||
gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20250107025835-8fc888b1d170/go.mod h1:3eECiw9O2bIFkkePlloKyLNXiqBAhOxNrDoGaaGseGY=
|
||||
gitlink.org.cn/JointCloud/pcm-hpc v0.0.0-20241125115811-72f3568255a4 h1:WIs/189lRLNMXF2ui/Wm1+Y55eJ53BVGx+4+gdn9cls=
|
||||
gitlink.org.cn/JointCloud/pcm-hpc v0.0.0-20241125115811-72f3568255a4/go.mod h1:YbuoRgF9sEVvNJPQtGRjdocX7Du6NBOTLn+GVwqRVjo=
|
||||
gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20250313064001-91fb558cfdb6 h1:9o0ONbSiQHTzODptzgtVZjRYFBLncZ6dpHp9YF+v73I=
|
||||
gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20250313064001-91fb558cfdb6/go.mod h1:MxtnJJcU8S4zfGKZVcg2MOXGtwucKy7MMDwA0IemBd0=
|
||||
gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20250624091120-dee975c73c57 h1:+T/ZPk1hjNBQy5pKqLsd27s4PVJbee4CzB0OWV27mg4=
|
||||
gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20250624091120-dee975c73c57/go.mod h1:iQtyaoeMP4mNY0xutDBDD/305QwnPjj0zNtiQjXix50=
|
||||
gitlink.org.cn/JointCloud/pcm-openi v0.0.0-20250320103718-7bd6650118ee h1:+YYzcWPX0Up98nOb5ngkCaqiWHpSH7XJQRTUSvYclWU=
|
||||
gitlink.org.cn/JointCloud/pcm-openi v0.0.0-20250320103718-7bd6650118ee/go.mod h1:0VMTWXsRx7Z5z+kxBid2zf7kq5YtFlxubXEwPHiicyM=
|
||||
gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203 h1:s6PsZ1+bev294IWdZRlV7mnOwI1+UzFcldVW/BqhQzI=
|
||||
gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203/go.mod h1:i2rrbMQ+Fve345BY9Heh4MUqVTAimZQElQhzzRee5B8=
|
||||
gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5 h1:+/5vnzkJBfMRnya1NrhOzlroUtRa5ePiYbPKlHLoLV0=
|
||||
gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5/go.mod h1:97AlUXN13g9UN3+9/DzCHpeoU5sbdyv0IQuTEHNexzQ=
|
||||
go.etcd.io/etcd/api/v3 v3.5.16 h1:WvmyJVbjWqK4R1E+B12RRHz3bRGy9XVfh++MgbN+6n0=
|
||||
go.etcd.io/etcd/api/v3 v3.5.16/go.mod h1:1P4SlIP/VwkDmGo3OlOD7faPeP8KDIFhqvciH5EfN28=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.16 h1:ZgY48uH6UvB+/7R9Yf4x574uCO3jIx0TRDyetSfId3Q=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.16/go.mod h1:V8acl8pcEK0Y2g19YlOV9m9ssUe6MgiDSobSoaBAM0E=
|
||||
go.etcd.io/etcd/client/v3 v3.5.16 h1:sSmVYOAHeC9doqi0gv7v86oY/BTld0SEFGaxsU9eRhE=
|
||||
go.etcd.io/etcd/client/v3 v3.5.16/go.mod h1:X+rExSGkyqxvu276cr2OwPLBaeqFu1cIl4vmRjAD/50=
|
||||
go.etcd.io/etcd/api/v3 v3.5.17 h1:cQB8eb8bxwuxOilBpMJAEo8fAONyrdXTHUNcMd8yT1w=
|
||||
go.etcd.io/etcd/api/v3 v3.5.17/go.mod h1:d1hvkRuXkts6PmaYk2Vrgqbv7H4ADfAKhyJqHNLJCB4=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.17 h1:XxnDXAWq2pnxqx76ljWwiQ9jylbpC4rvkAeRVOUKKVw=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.17/go.mod h1:4DqK1TKacp/86nJk4FLQqo6Mn2vvQFBmruW3pP14H/w=
|
||||
go.etcd.io/etcd/client/v3 v3.5.17 h1:o48sINNeWz5+pjy/Z0+HKpj/xSnBkuVhVvXkjEXbqZY=
|
||||
go.etcd.io/etcd/client/v3 v3.5.17/go.mod h1:j2d4eXTHWkT2ClBgnnEPm/Wuu7jsqku41v9DZ3OtjQo=
|
||||
go.mongodb.org/mongo-driver v1.17.1 h1:Wic5cJIwJgSpBhe3lx3+/RybR5PiYRMpVFgO7cOHyIM=
|
||||
go.mongodb.org/mongo-driver v1.17.1/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
|
@ -529,28 +560,28 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
|||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY=
|
||||
go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE=
|
||||
go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U=
|
||||
go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg=
|
||||
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 h1:D7UpUy2Xc2wsi1Ras6V40q806WM07rqoCWzXu7Sqy+4=
|
||||
go.opentelemetry.io/otel/exporters/jaeger v1.17.0/go.mod h1:nPCqOnEH9rNLKqH/+rrUjiMzHJdV1BlpKcTwRTyKkKI=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 h1:K0XaT3DwHAcV4nKLzcQvwAgSyisUghWoY20I7huthMk=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0/go.mod h1:B5Ki776z/MBnVha1Nzwp5arlzBbE3+1jk+pGmaP5HME=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 h1:FFeLy03iVTXP6ffeN2iXrxfGsZGCjVx0/4KlizjyBwU=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0/go.mod h1:TMu73/k1CP8nBUpDLc71Wj/Kf7ZS9FK5b53VapRsP9o=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 h1:lUsI2TYsQw2r1IASwoROaCnjdj2cvC2+Jbxvk6nHnWU=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0/go.mod h1:2HpZxxQurfGxJlJDblybejHB6RX6pmExPNe517hREw4=
|
||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 h1:UGZ1QwZWY67Z6BmckTU+9Rxn04m2bD3gD6Mk0OIOCPk=
|
||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0/go.mod h1:fcwWuDuaObkkChiDlhEpSq9+X1C0omv+s5mBtToAQ64=
|
||||
go.opentelemetry.io/otel/exporters/zipkin v1.31.0 h1:CgucL0tj3717DJnni7HVVB2wExzi8c2zJNEA2BhLMvI=
|
||||
go.opentelemetry.io/otel/exporters/zipkin v1.31.0/go.mod h1:rfzOVNiSwIcWtEC2J8epwG26fiaXlYvLySJ7bwsrtAE=
|
||||
go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE=
|
||||
go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY=
|
||||
go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk=
|
||||
go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0=
|
||||
go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys=
|
||||
go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A=
|
||||
go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0=
|
||||
go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.32.0 h1:IJFEoHiytixx8cMiVAO+GmHR6Frwu+u5Ur8njpFO6Ac=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.32.0/go.mod h1:3rHrKNtLIoS0oZwkY2vxi+oJcwFRWdtUyRII+so45p8=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.32.0 h1:9kV11HXBHZAvuPUZxmMWrH8hZn/6UnHX4K0mu36vNsU=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.32.0/go.mod h1:JyA0FHXe22E1NeNiHmVp7kFHglnexDQ7uRWDiiJ1hKQ=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.32.0 h1:cMyu9O88joYEaI47CnQkxO1XZdpoTF9fEnW2duIddhw=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.32.0/go.mod h1:6Am3rn7P9TVVeXYG+wtcGE7IE1tsQ+bP3AuWcKt/gOI=
|
||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.32.0 h1:cC2yDI3IQd0Udsux7Qmq8ToKAx1XCilTQECZ0KDZyTw=
|
||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.32.0/go.mod h1:2PD5Ex6z8CFzDbTdOlwyNIUywRr1DN0ospafJM1wJ+s=
|
||||
go.opentelemetry.io/otel/exporters/zipkin v1.32.0 h1:6O8HgLHPXtXE9QEKEWkBImL9mEKCGEl+m+OncVO53go=
|
||||
go.opentelemetry.io/otel/exporters/zipkin v1.32.0/go.mod h1:+MFvorlowjy0iWnsKaNxC1kzczSxe71mw85h4p8yEvg=
|
||||
go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M=
|
||||
go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8=
|
||||
go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4=
|
||||
go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU=
|
||||
go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM=
|
||||
go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8=
|
||||
go.opentelemetry.io/proto/otlp v1.4.0 h1:TA9WRvW6zMwP+Ssb6fLoUIuirti1gGbP28GcKG1jgeg=
|
||||
go.opentelemetry.io/proto/otlp v1.4.0/go.mod h1:PPBWZIP98o2ElSqI35IHfu7hIhSwvc5N38Jw8pXuGFY=
|
||||
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
|
||||
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
|
||||
go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs=
|
||||
|
@ -561,9 +592,8 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
|||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
|
||||
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||
golang.org/x/arch v0.15.0 h1:QtOrQd0bTUnhNVNndMpLHNWrDmYzZ2KDqSrEymqInZw=
|
||||
golang.org/x/arch v0.15.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
|
@ -571,8 +601,8 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U
|
|||
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
|
||||
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
|
||||
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
|
||||
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
|
@ -606,8 +636,8 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB
|
|||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
|
||||
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
||||
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
|
||||
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
|
@ -641,16 +671,16 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
|
|||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
|
||||
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
|
||||
golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
|
||||
golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
|
||||
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||
golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE=
|
||||
golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
|
@ -662,8 +692,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
|
|||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
|
||||
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
@ -704,28 +734,29 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
|
||||
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
||||
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
|
||||
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
|
||||
golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y=
|
||||
golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
|
||||
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
|
||||
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ=
|
||||
golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg=
|
||||
golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
|
@ -770,8 +801,8 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc
|
|||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE=
|
||||
golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg=
|
||||
golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8=
|
||||
golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
@ -829,10 +860,10 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc
|
|||
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38 h1:2oV8dfuIkM1Ti7DwXc0BJfnwr9csz4TDXI9EmiI+Rbw=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38/go.mod h1:vuAjtvlwkDKF6L1GQ0SokiRLCGFfeBUXWr/aFFkHACc=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 h1:zciRKQ4kBpFgpfC5QQCVtnnNAcLIqweL7plyZRQHVpI=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 h1:CkkIfIt50+lT6NHAVoRYEyAvQGFM7xEwXUUywFvEb3Q=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576/go.mod h1:1R3kvZ1dtP3+4p4d3G8uJ8rFk/fWlScl38vanWACI08=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 h1:8ZmaLZE4XWrtU3MyClkYqqtl6Oegr3235h7jxsDyqCY=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
|
@ -845,8 +876,8 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa
|
|||
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
|
||||
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
|
||||
google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0=
|
||||
google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
|
@ -858,8 +889,8 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD
|
|||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
|
||||
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
|
||||
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
@ -871,6 +902,8 @@ gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY=
|
|||
gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0=
|
||||
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
|
||||
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
|
@ -904,26 +937,25 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
|||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/api v0.31.2 h1:3wLBbL5Uom/8Zy98GRPXpJ254nEFpl+hwndmk9RwmL0=
|
||||
k8s.io/api v0.31.2/go.mod h1:bWmGvrGPssSK1ljmLzd3pwCQ9MgoTsRCuK35u6SygUk=
|
||||
k8s.io/apimachinery v0.31.2 h1:i4vUt2hPK56W6mlT7Ry+AO8eEsyxMD1U44NR22CLTYw=
|
||||
k8s.io/apimachinery v0.31.2/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo=
|
||||
k8s.io/client-go v0.31.2 h1:Y2F4dxU5d3AQj+ybwSMqQnpZH9F30//1ObxOKlTI9yc=
|
||||
k8s.io/client-go v0.31.2/go.mod h1:NPa74jSVR/+eez2dFsEIHNa+3o09vtNaWwWwb1qSxSs=
|
||||
k8s.io/api v0.31.4 h1:I2QNzitPVsPeLQvexMEsj945QumYraqv9m74isPDKhM=
|
||||
k8s.io/api v0.31.4/go.mod h1:d+7vgXLvmcdT1BCo79VEgJxHHryww3V5np2OYTr6jdw=
|
||||
k8s.io/apimachinery v0.31.4 h1:8xjE2C4CzhYVm9DGf60yohpNUh5AEBnPxCryPBECmlM=
|
||||
k8s.io/apimachinery v0.31.4/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo=
|
||||
k8s.io/client-go v0.31.4 h1:t4QEXt4jgHIkKKlx06+W3+1JOwAFU/2OPiOo7H92eRQ=
|
||||
k8s.io/client-go v0.31.4/go.mod h1:kvuMro4sFYIa8sulL5Gi5GFqUPvfH2O/dXuKstbaaeg=
|
||||
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
|
||||
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
|
||||
k8s.io/kube-openapi v0.0.0-20241009091222-67ed5848f094 h1:MErs8YA0abvOqJ8gIupA1Tz6PKXYUw34XsGlA7uSL1k=
|
||||
k8s.io/kube-openapi v0.0.0-20241009091222-67ed5848f094/go.mod h1:7ioBJr1A6igWjsR2fxq2EZ0mlMwYLejazSIc2bzMp2U=
|
||||
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 h1:MDF6h2H/h4tbzmtIKTuctcwZmY0tY9mD9fNT47QO6HI=
|
||||
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
k8s.io/kube-openapi v0.0.0-20241127205056-99599406b04f h1:nLHvOvs1CZ+FAEwR4EqLeRLfbtWQNlIu5g393Hq/1UM=
|
||||
k8s.io/kube-openapi v0.0.0-20241127205056-99599406b04f/go.mod h1:iZjdMQzunI7O/sUrf/5WRX1gvaAIam32lKx9+paoLbU=
|
||||
k8s.io/utils v0.0.0-20241210054802-24370beab758 h1:sdbE21q2nlQtFh65saZY+rRM6x6aJJI8IUa1AmH/qa0=
|
||||
k8s.io/utils v0.0.0-20241210054802-24370beab758/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
||||
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE=
|
||||
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.3 h1:sCP7Vv3xx/CWIuTPVN38lUPx0uw0lcLfzaiDa8Ja01A=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.3/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
|
|
|
@ -36,6 +36,12 @@ type Config struct {
|
|||
OpenstackRpcConf zrpc.RpcClientConf
|
||||
OctopusRpcConf zrpc.RpcClientConf
|
||||
PcmCoreRpcConf zrpc.RpcClientConf
|
||||
BlockChain struct {
|
||||
ContractAddress string
|
||||
FunctionName string
|
||||
Url string
|
||||
Type string
|
||||
}
|
||||
|
||||
MinioConf struct {
|
||||
Secret string
|
||||
|
@ -45,6 +51,10 @@ type Config struct {
|
|||
|
||||
SnowflakeConf SnowflakeConf
|
||||
Monitoring Monitoring
|
||||
|
||||
JcsMiddleware JcsMiddleware
|
||||
|
||||
Participant Participant
|
||||
}
|
||||
type Monitoring struct {
|
||||
PromUrl string
|
||||
|
@ -55,3 +65,12 @@ type Monitoring struct {
|
|||
type SnowflakeConf struct {
|
||||
MachineId int64 `json:"machineId"`
|
||||
}
|
||||
|
||||
type JcsMiddleware struct {
|
||||
JobStatusReportUrl string
|
||||
}
|
||||
|
||||
type Participant struct {
|
||||
AdapterId string
|
||||
CloudAdapterId string
|
||||
}
|
||||
|
|
|
@ -16,37 +16,66 @@ package cron
|
|||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/utils/stat"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/schedule"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/utils/status"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
)
|
||||
|
||||
func AddCronGroup(svc *svc.ServiceContext) {
|
||||
|
||||
svc.Cron.AddFunc("*/5 * * * * ?", func() {
|
||||
list, err := GetTaskList(svc)
|
||||
if err != nil {
|
||||
logx.Errorf(err.Error())
|
||||
return
|
||||
}
|
||||
status.UpdateTaskStatus(svc, list)
|
||||
status.UpdateAiTaskStatus(svc, list)
|
||||
})
|
||||
|
||||
svc.Cron.AddFunc("*/5 * * * * ?", func() {
|
||||
UpdateAiAdapterMaps(svc)
|
||||
})
|
||||
|
||||
svc.Cron.AddFunc("30 * * * * ?", func() {
|
||||
adapterList, err := svc.Scheduler.AiStorages.GetAdaptersByType("1")
|
||||
if err != nil {
|
||||
logx.Errorf(err.Error())
|
||||
return
|
||||
}
|
||||
stat.UpdateClusterResources(svc, adapterList)
|
||||
})
|
||||
//svc.Cron.AddFunc("30 * * * * ?", func() {
|
||||
// adapterList, err := svc.Scheduler.AiStorages.GetAdaptersByType("1")
|
||||
// if err != nil {
|
||||
// logx.Errorf(err.Error())
|
||||
// return
|
||||
// }
|
||||
// stat.UpdateClusterResources(svc, adapterList)
|
||||
//})
|
||||
|
||||
svc.Cron.AddFunc("@hourly", func() {
|
||||
status.UpdateAutoStoppedInstance(svc)
|
||||
})
|
||||
|
||||
svc.Cron.AddFunc("1 * * * * *", func() {
|
||||
queryResource := schedule.NewQueryResourcesLogic(svc.HttpClient.R().Context(), svc)
|
||||
trainResrc, err := queryResource.QueryResourcesByClusterId(nil, "Train")
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
}
|
||||
svc.Scheduler.AiService.LocalCache[schedule.QUERY_TRAIN_RESOURCES] = trainResrc
|
||||
inferResrc, err := queryResource.QueryResourcesByClusterId(nil, "Inference")
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
}
|
||||
svc.Scheduler.AiService.LocalCache[schedule.QUERY_INFERENCE_RESOURCES] = inferResrc
|
||||
})
|
||||
|
||||
//更新hpc任务状态
|
||||
svc.Cron.AddFunc("*/5 * * * * ?", func() {
|
||||
status.UpdateHpcTaskStatus(svc)
|
||||
})
|
||||
|
||||
//更新推理任务状态
|
||||
svc.Cron.AddFunc("*/5 * * * * ?", func() {
|
||||
tasks, err := svc.Scheduler.AiStorages.GetInferDeployInstanceListLastMonth()
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
}
|
||||
svc.Scheduler.AiService.Si.UpdateDeployInstanceStatusBatch(tasks, true)
|
||||
})
|
||||
|
||||
//更新训练任务状态
|
||||
svc.Cron.AddFunc("*/10 * * * * ?", func() {
|
||||
tasks, err := svc.Scheduler.AiStorages.AllTaskLastMonth()
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
}
|
||||
go svc.Scheduler.AiService.St.UpdateTaskStatus(tasks)
|
||||
go svc.Scheduler.AiService.St.UpdateAiTaskStatus(tasks)
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package cron
|
||||
|
||||
import (
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
)
|
||||
|
||||
// GetHpcTaskList get hpc task list
|
||||
func GetHpcTaskList(svc *svc.ServiceContext) ([]*types.TaskModel, error) {
|
||||
limit := 10
|
||||
offset := 0
|
||||
var list []*types.TaskModel
|
||||
db := svc.DbEngin.Model(&types.TaskModel{}).Table("task").
|
||||
Joins("join task_hpc hpc on task.id = hpc.task_id").
|
||||
Select("task.* ,hpc.job_id, hpc.work_dir, hpc.status, hpc.updated_time").
|
||||
Where("task.adapter_type_dict = 2 AND task.status NOT IN ('Succeeded', 'Failed') and task.deleted_at is null")
|
||||
|
||||
//count total
|
||||
var total int64
|
||||
err := db.Count(&total).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
db.Limit(limit).Offset(offset)
|
||||
err = db.Order("created_time desc").Scan(&list).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return list, nil
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package adapters
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/adapters"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func GetClusterBaseInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ClusterReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := adapters.NewGetClusterBaseInfoLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetClusterBaseInfo(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -1,18 +1,26 @@
|
|||
package ai
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"encoding/json"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/ai"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
algorithm "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/ai"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func CreateAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateAlgorithmReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
var req algorithm.CreateAlgorithmReq
|
||||
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(body, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -1,18 +1,26 @@
|
|||
package ai
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"encoding/json"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/ai"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
dataset "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/ai"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func CreateDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateDataSetReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
var req dataset.CreateDatasetReq
|
||||
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(body, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package ai
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/ai"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
Model "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/ai"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func CreateModelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req Model.CreateModelReq
|
||||
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(body, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := ai.NewCreateModelLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CreateModel(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package ai
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/ai"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
Model "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/ai"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func TaskResultSyncHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req Model.ResultSyncReq
|
||||
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(body, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := ai.NewTaskResultSyncLogic(r.Context(), svcCtx)
|
||||
resp, err := l.TaskResultSync(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -1,24 +1,39 @@
|
|||
package cloud
|
||||
|
||||
import (
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/cloud"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func CommitGeneralTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var req types.GeneralTaskReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 获取ip信息
|
||||
ip := utils.GetClientIP(r)
|
||||
req.UserIp = ip
|
||||
// 获取token信息
|
||||
token := r.Header.Get("Authorization")
|
||||
req.Token = token
|
||||
// 获取用户信息
|
||||
userStr := r.Header.Get("User")
|
||||
user := &models.JccUserInfo{}
|
||||
json.Unmarshal([]byte(userStr), user)
|
||||
req.UserId = user.Id
|
||||
l := cloud.NewCommitGeneralTaskLogic(r.Context(), svcCtx)
|
||||
err := l.CommitGeneralTask(&req)
|
||||
result.HttpResult(r, w, nil, err)
|
||||
resp, err := l.CommitGeneralTask(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package cloud
|
||||
|
||||
import (
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/cloud"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"io"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"net/http"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
container "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/cloud"
|
||||
)
|
||||
|
||||
func ContainerCreateHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req container.CreateParam
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(body, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
// 获取用户信息
|
||||
userStr := r.Header.Get("User")
|
||||
user := &models.JccUserInfo{}
|
||||
json.Unmarshal([]byte(userStr), user)
|
||||
req.UserId = user.Id
|
||||
l := cloud.NewContainerCreateLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ContainerCreate(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package cloud
|
||||
|
||||
import (
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/cloud"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"io"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"net/http"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
container "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/cloud"
|
||||
)
|
||||
|
||||
func ContainerDeleteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req container.DeleteParam
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(body, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := cloud.NewContainerDeleteLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ContainerDelete(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package cloud
|
||||
|
||||
import (
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/cloud"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"io"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"net/http"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
container "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/cloud"
|
||||
)
|
||||
|
||||
func ContainerGetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req container.GetParam
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(body, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := cloud.NewContainerGetLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ContainerGet(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package cloud
|
||||
|
||||
import (
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/cloud"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
)
|
||||
|
||||
func PodsListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.PodsListReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := cloud.NewPodsListLogic(r.Context(), svcCtx)
|
||||
resp, err := l.PodsList(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/core"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func CancelResourceSpecAlarmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.IdReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := core.NewCancelResourceSpecAlarmLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CancelResourceSpecAlarm(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/core"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func CompareResourceSpecHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.FetchResourceSpecReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
token := r.Header.Get("Authorization")
|
||||
// 获取用户信息
|
||||
jccUserInfo, err := utils.ParseTokenWithoutVerify(token)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
req.UserId = jccUserInfo.Id
|
||||
l := core.NewCompareResourceSpecLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CompareResourceSpec(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/core"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func DeleteResourceSpecHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DeletePathId
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := core.NewDeleteResourceSpecLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DeleteResourceSpec(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/core"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func DetailResourceSpecHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.IdReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := core.NewDetailResourceSpecLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DetailResourceSpec(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/core"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func EditResourceSpecHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.EditResourceReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
token := r.Header.Get("Authorization")
|
||||
// 获取用户信息
|
||||
jccUserInfo, err := utils.ParseTokenWithoutVerify(token)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
req.UserId = jccUserInfo.Id
|
||||
|
||||
l := core.NewEditResourceSpecLogic(r.Context(), svcCtx)
|
||||
resp, err := l.EditResourceSpec(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import (
|
|||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
@ -16,7 +17,15 @@ func PageListTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
token := r.Header.Get("Authorization")
|
||||
// 获取用户信息
|
||||
jccUserInfo, err := utils.ParseTokenWithoutVerify(token)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
req.UserId = jccUserInfo.Id
|
||||
req.UserName = jccUserInfo.UserName
|
||||
l := core.NewPageListTaskLogic(r.Context(), svcCtx)
|
||||
resp, err := l.PageListTask(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/core"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func PageResourceRangeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ResourceSpecReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := core.NewPageResourceRangeLogic(r.Context(), svcCtx)
|
||||
resp, err := l.PageResourceRange(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/core"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func ResourceRangeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ResourceSpecReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := core.NewResourceRangeLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ResourceRange(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/core"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
)
|
||||
|
||||
func ScreenPageTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.PageTaskReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := core.NewScreenPageTaskLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ScreenPageTask(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/core"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func SyncResourceSpecHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.SyncResourceReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
token := r.Header.Get("Authorization")
|
||||
// 获取用户信息
|
||||
jccUserInfo, err := utils.ParseTokenWithoutVerify(token)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
req.UserId = jccUserInfo.Id
|
||||
l := core.NewSyncResourceSpecLogic(r.Context(), svcCtx)
|
||||
resp, err := l.SyncResourceSpec(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -6,7 +6,9 @@ import (
|
|||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func CommitHpcTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
|
@ -16,6 +18,19 @@ func CommitHpcTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
// 获取ip信息
|
||||
ip := utils.GetClientIP(r)
|
||||
req.Parameters["UserIp"] = ip
|
||||
// 获取token信息
|
||||
token := r.Header.Get("Authorization")
|
||||
req.Parameters["Token"] = token
|
||||
// 获取用户信息
|
||||
jccUserInfo, err := utils.ParseTokenWithoutVerify(token)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
req.Parameters["UserId"] = strconv.FormatInt(jccUserInfo.Id, 10)
|
||||
|
||||
l := hpc.NewCommitHpcTaskLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CommitHpcTask(&req)
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package hpc
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/hpc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func GetHpcAppClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.HpcAppClusterReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := hpc.NewGetHpcAppClusterLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetHpcAppCluster(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package hpc
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/hpc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func GetHpcTaskLogHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.HpcTaskLogReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := hpc.NewGetHpcTaskLogLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetHpcTaskLog(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package hpc
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/hpc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func ListInstanceCenterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.HpcInstanceCenterReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := hpc.NewListInstanceCenterLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ListInstanceCenter(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package inference
|
||||
|
||||
import (
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/inference"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
)
|
||||
|
||||
func CreateInferenceTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateInferenceTaskReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
token := r.Header.Get("Authorization")
|
||||
// 获取用户信息
|
||||
jccUserInfo, err := utils.ParseTokenWithoutVerify(token)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
req.UserId = jccUserInfo.Id
|
||||
l := inference.NewCreateInferenceTaskLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CreateInferenceTask(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import (
|
|||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
@ -16,6 +17,15 @@ func DeployInstanceListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
token := r.Header.Get("Authorization")
|
||||
// 获取用户信息
|
||||
jccUserInfo, err := utils.ParseTokenWithoutVerify(token)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
req.UserId = jccUserInfo.Id
|
||||
req.UserName = jccUserInfo.UserName
|
||||
|
||||
l := inference.NewDeployInstanceListLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DeployInstanceList(&req)
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package inference
|
||||
|
||||
import (
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/inference"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
)
|
||||
|
||||
func GetDeployInstanceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.GetDeployInstanceReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := inference.NewGetDeployInstanceLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetDeployInstance(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,26 @@
|
|||
package schedule
|
||||
|
||||
import (
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/schedule"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
)
|
||||
|
||||
func QueryResourcesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.QueryResourcesReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := schedule.NewQueryResourcesLogic(r.Context(), svcCtx)
|
||||
resp, err := l.QueryResources(&req)
|
||||
result.HttpResult(r, w, resp.Data, err)
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package schedule
|
||||
|
||||
import (
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/schedule"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
)
|
||||
|
||||
func ScheduleCancelTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CancelTaskReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := schedule.NewScheduleCancelTaskLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ScheduleCancelTask(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package schedule
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/schedule"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func ScheduleCreateTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateTaskReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
// 获取ip信息
|
||||
ip := utils.GetClientIP(r)
|
||||
req.UserIp = ip
|
||||
// 获取token信息
|
||||
token := r.Header.Get("Authorization")
|
||||
req.Token = token
|
||||
jccUserInfo, err := utils.ParseTokenWithoutVerify(token)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
req.UserId = jccUserInfo.Id
|
||||
l := schedule.NewScheduleCreateTaskLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ScheduleCreateTask(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
|
||||
}
|
||||
}
|
|
@ -7,22 +7,19 @@ import (
|
|||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/schedule"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
)
|
||||
|
||||
func ScheduleGetAiJobLogLogHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.AiJobLogReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := schedule.NewScheduleGetAiJobLogLogLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ScheduleGetAiJobLogLog(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package schedule
|
||||
|
||||
import (
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/schedule"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
)
|
||||
|
||||
func ScheduleRunTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.RunTaskReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := schedule.NewScheduleRunTaskLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ScheduleRunTask(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
|
||||
}
|
||||
}
|
|
@ -17,6 +17,10 @@ func ScheduleSubmitHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||
return
|
||||
}
|
||||
|
||||
// 获取token信息
|
||||
token := r.Header.Get("Authorization")
|
||||
req.Token = token
|
||||
|
||||
l := schedule.NewScheduleSubmitLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ScheduleSubmit(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
|
|
|
@ -58,6 +58,9 @@ func (l *ClusterListLogic) ClusterList(req *types.ClusterReq) (resp *types.PageR
|
|||
if req.ResourceType != "" {
|
||||
db = db.Where("t_adapter.resource_type = ?", req.ResourceType)
|
||||
}
|
||||
if req.StorageSchedule != "" {
|
||||
db = db.Where("t_cluster.storage_schedule = ?", req.StorageSchedule)
|
||||
}
|
||||
|
||||
//count total
|
||||
var total int64
|
||||
|
|
|
@ -6,12 +6,14 @@ import (
|
|||
"fmt"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants"
|
||||
tool "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gorm.io/gorm"
|
||||
"io/ioutil"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
@ -63,7 +65,15 @@ func (l *CreateClusterLogic) CreateCluster(req *types.ClusterCreateReq) (resp *t
|
|||
logx.Errorf(tx.Error.Error())
|
||||
return nil, errors.New("cluster create failed")
|
||||
}
|
||||
|
||||
// 创建资源价格信息
|
||||
clusterId, _ := strconv.ParseInt(cluster.Id, 10, 64)
|
||||
resourcePrice := &types.ResourceCost{
|
||||
ResourceID: clusterId,
|
||||
Price: req.Price,
|
||||
ResourceType: constants.CLUSTER,
|
||||
CostType: req.CostType,
|
||||
}
|
||||
tx = l.svcCtx.DbEngin.Table("resource_cost").Create(resourcePrice)
|
||||
// push cluster info to adapter
|
||||
go func() {
|
||||
var adapterServer string
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
package adapters
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetClusterBaseInfoLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewGetClusterBaseInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetClusterBaseInfoLogic {
|
||||
return &GetClusterBaseInfoLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetClusterBaseInfoLogic) GetClusterBaseInfo(req *types.ClusterReq) (resp *types.PageResult, err error) {
|
||||
limit := req.PageSize
|
||||
offset := req.PageSize * (req.PageNum - 1)
|
||||
resp = &types.PageResult{}
|
||||
var list []types.ClusterBaseInfo
|
||||
db := l.svcCtx.DbEngin.Model(&types.AdapterInfo{}).Table("t_cluster")
|
||||
|
||||
db = db.Joins("left join t_adapter on t_adapter.id = t_cluster.adapter_id").
|
||||
Where("t_cluster.deleted_at is null")
|
||||
if req.Name != "" {
|
||||
db = db.Where("t_cluster.name LIKE ?", "%"+req.Name+"%")
|
||||
}
|
||||
if req.AdapterId != "" {
|
||||
db = db.Where("t_cluster.adapter_id = ?", req.AdapterId)
|
||||
}
|
||||
if req.Nickname != "" {
|
||||
db = db.Where("t_cluster.nickname LIKE ?", "%"+req.Nickname+"%")
|
||||
}
|
||||
if req.Label != "" {
|
||||
db = db.Where("t_cluster.label = ?", req.Label)
|
||||
}
|
||||
if req.Version != "" {
|
||||
db = db.Where("t_cluster.version = ?", req.Version)
|
||||
}
|
||||
if req.ProducerDict != "" {
|
||||
db = db.Where("t_cluster.producer_dict = ?", req.ProducerDict)
|
||||
}
|
||||
if req.RegionDict != "" {
|
||||
db = db.Where("t_cluster.region_dict = ?", req.RegionDict)
|
||||
}
|
||||
if req.Type != "" {
|
||||
db = db.Where("t_adapter.type = ?", req.Type)
|
||||
}
|
||||
if req.ResourceType != "" {
|
||||
db = db.Where("t_adapter.resource_type = ?", req.ResourceType)
|
||||
}
|
||||
if req.StorageSchedule != "" {
|
||||
db = db.Where("t_cluster.storage_schedule = ?", req.StorageSchedule)
|
||||
}
|
||||
|
||||
//count total
|
||||
var total int64
|
||||
err = db.Select("*").Count(&total).Error
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
db = db.Limit(limit).Offset(offset)
|
||||
err = db.Select("t_cluster.*").Order("t_cluster.create_time desc").Scan(&list).Error
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
resp.List = list
|
||||
resp.PageSize = req.PageSize
|
||||
resp.PageNum = req.PageNum
|
||||
resp.Total = total
|
||||
|
||||
return resp, nil
|
||||
}
|
|
@ -3,8 +3,11 @@ package adapters
|
|||
import (
|
||||
"context"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"strconv"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
@ -34,11 +37,30 @@ func (l *UpdateClusterLogic) UpdateCluster(req *types.ClusterCreateReq) (resp *t
|
|||
}
|
||||
utils.Convert(req, &cluster)
|
||||
// 获取集群经纬度
|
||||
location, err := GeoMap(req.RegionName)
|
||||
//location, err := GeoMap(req.RegionName)
|
||||
//if err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
//cluster.Location = location
|
||||
l.svcCtx.DbEngin.Table("t_cluster").Model(&cluster).Updates(&cluster)
|
||||
// 更新资源价格表
|
||||
clusterId, err := strconv.ParseInt(req.Id, 10, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cluster.Location = location
|
||||
l.svcCtx.DbEngin.Table("t_cluster").Model(&cluster).Updates(&cluster)
|
||||
resourceCost := &types.ResourceCost{
|
||||
ResourceID: clusterId,
|
||||
Price: req.Price,
|
||||
ResourceType: constants.CLUSTER,
|
||||
CostType: req.CostType,
|
||||
}
|
||||
dbResult := l.svcCtx.DbEngin.Clauses(clause.OnConflict{
|
||||
Columns: []clause.Column{{Name: "resource_id"}},
|
||||
DoUpdates: clause.AssignmentColumns([]string{"price", "cost_type"}),
|
||||
}).Create(&resourceCost)
|
||||
|
||||
if dbResult.Error != nil {
|
||||
return nil, dbResult.Error
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
@ -16,14 +16,12 @@ package ai
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/participant"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-modelarts/modelarts"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
algorithm "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/ai"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type CreateAlgorithmLogic struct {
|
||||
|
@ -40,18 +38,20 @@ func NewCreateAlgorithmLogic(ctx context.Context, svcCtx *svc.ServiceContext) *C
|
|||
}
|
||||
}
|
||||
|
||||
func (l *CreateAlgorithmLogic) CreateAlgorithm(req *types.CreateAlgorithmReq) (resp *types.CreateAlgorithmResp, err error) {
|
||||
modelartsReq := &modelarts.CreateAlgorithmReq{}
|
||||
err = copier.CopyWithOption(modelartsReq, req, copier.Option{IgnoreEmpty: true, DeepCopy: true, Converters: utils.Converters})
|
||||
ListAlgorithmsResp, err := l.svcCtx.ModelArtsRpc.CreateAlgorithm(l.ctx, modelartsReq)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
func (l *CreateAlgorithmLogic) CreateAlgorithm(req *algorithm.CreateAlgorithmReq) (resp interface{}, err error) {
|
||||
param := &participant.CreateParam{
|
||||
Name: req.Name,
|
||||
Desc: req.Desc,
|
||||
Src: req.Src,
|
||||
Param: req.Param,
|
||||
}
|
||||
marshal, err := json.Marshal(&ListAlgorithmsResp)
|
||||
create, err := l.svcCtx.Ai.AlgorithmCreateById(req.ClusterId, param)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &ListAlgorithmsResp, copier.Option{IgnoreEmpty: true, DeepCopy: true, Converters: utils.Converters})
|
||||
return resp, nil
|
||||
if create.Code != http.StatusOK {
|
||||
return nil, errors.New(create.Message)
|
||||
}
|
||||
resp = create.Data
|
||||
return
|
||||
}
|
||||
|
|
|
@ -16,15 +16,12 @@ package ai
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-modelarts/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/participant"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
dataset "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/ai"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type CreateDataSetLogic struct {
|
||||
|
@ -41,18 +38,21 @@ func NewCreateDataSetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Cre
|
|||
}
|
||||
}
|
||||
|
||||
func (l *CreateDataSetLogic) CreateDataSet(req *types.CreateDataSetReq) (resp *types.CreateDataSetResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
modelartsReq := &modelarts.CreateDataSetReq{}
|
||||
err = copier.CopyWithOption(modelartsReq, req, copier.Option{Converters: utils.Converters})
|
||||
CreateDataSetResp, err := l.svcCtx.ModelArtsRpc.CreateDataSet(l.ctx, modelartsReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get db DataSet list"), "Failed to get db DataSet list err : %v ,req:%+v", err, req)
|
||||
func (l *CreateDataSetLogic) CreateDataSet(req *dataset.CreateDatasetReq) (resp interface{}, err error) {
|
||||
param := &participant.CreateParam{
|
||||
Name: req.Name,
|
||||
Desc: req.Desc,
|
||||
Src: req.Src,
|
||||
Param: req.Param,
|
||||
}
|
||||
resp = &types.CreateDataSetResp{}
|
||||
|
||||
err = copier.CopyWithOption(&resp, &CreateDataSetResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, nil
|
||||
create, err := l.svcCtx.Ai.DatasetCreateById(req.ClusterId, param)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if create.Code != http.StatusOK {
|
||||
return nil, errors.New(create.Message)
|
||||
}
|
||||
resp = create.Data
|
||||
return
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
|
||||
Copyright (c) [2023] [pcm]
|
||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
You may obtain a copy of Mulan PSL v2 at:
|
||||
http://license.coscl.org.cn/MulanPSL2
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
See the Mulan PSL v2 for more details.
|
||||
|
||||
*/
|
||||
|
||||
package ai
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/participant"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
model "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/ai"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type CreateModelLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCreateModelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateModelLogic {
|
||||
return &CreateModelLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateModelLogic) CreateModel(req *model.CreateModelReq) (resp interface{}, err error) {
|
||||
param := &participant.CreateParam{
|
||||
Name: req.Name,
|
||||
Desc: req.Desc,
|
||||
Src: req.Src,
|
||||
Param: req.Param,
|
||||
}
|
||||
create, err := l.svcCtx.Ai.ModelCreateById(req.ClusterId, param)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if create.Code != http.StatusOK {
|
||||
return nil, errors.New(create.Message)
|
||||
}
|
||||
resp = create.Data
|
||||
return
|
||||
}
|
|
@ -16,12 +16,6 @@ package ai
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-modelarts/modelarts"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
||||
|
@ -42,18 +36,11 @@ func NewListAlgorithmsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Li
|
|||
}
|
||||
}
|
||||
|
||||
func (l *ListAlgorithmsLogic) ListAlgorithms(req *types.ListAlgorithmsReq) (resp *types.ListAlgorithmsResp, err error) {
|
||||
modelartsReq := &modelarts.ListAlgorithmsReq{}
|
||||
err = copier.CopyWithOption(modelartsReq, req, copier.Option{IgnoreEmpty: false, DeepCopy: true, Converters: utils.Converters})
|
||||
ListAlgorithmsResp, err := l.svcCtx.ModelArtsRpc.ListAlgorithms(l.ctx, modelartsReq)
|
||||
func (l *ListAlgorithmsLogic) ListAlgorithms(req *types.ListAlgorithmsReq) (resp interface{}, err error) {
|
||||
list, err := l.svcCtx.Ai.AlgorithmById(req.ProjectId)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
return nil, err
|
||||
}
|
||||
marshal, err := json.Marshal(&ListAlgorithmsResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &ListAlgorithmsResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, nil
|
||||
resp = list.Data
|
||||
return
|
||||
}
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
|
||||
Copyright (c) [2023] [pcm]
|
||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
You may obtain a copy of Mulan PSL v2 at:
|
||||
http://license.coscl.org.cn/MulanPSL2
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
See the Mulan PSL v2 for more details.
|
||||
|
||||
*/
|
||||
|
||||
package ai
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/participant"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
sync "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/ai"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type TaskResultSyncLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewTaskResultSyncLogic(ctx context.Context, svcCtx *svc.ServiceContext) *TaskResultSyncLogic {
|
||||
return &TaskResultSyncLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *TaskResultSyncLogic) TaskResultSync(req *sync.ResultSyncReq) (resp interface{}, err error) {
|
||||
|
||||
param := &participant.TaskResultSyncParam{
|
||||
Src: req.Src,
|
||||
Param: req.Param,
|
||||
}
|
||||
rs, err := l.svcCtx.Ai.TaskResultSync(req.ClusterId, param)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if rs.Code != http.StatusOK {
|
||||
return nil, errors.New(rs.Message)
|
||||
}
|
||||
resp = rs.Data
|
||||
return
|
||||
|
||||
}
|
|
@ -39,7 +39,7 @@ func NewCloudListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CloudLi
|
|||
|
||||
func (l *CloudListLogic) CloudList() (resp *types.CloudListResp, err error) {
|
||||
// 查询数据库中数算任务列表
|
||||
var clouds []*models.Cloud
|
||||
var clouds []*models.TaskCloud
|
||||
tx := l.svcCtx.DbEngin.Find(&clouds)
|
||||
if tx.Error != nil {
|
||||
return nil, tx.Error
|
||||
|
|
|
@ -7,14 +7,17 @@ import (
|
|||
clientCore "gitlink.org.cn/JointCloud/pcm-coordinator/client"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/schedulers"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/schedulers/option"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/executor"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models/cloud"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils/remoteUtil"
|
||||
"io"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
syaml "k8s.io/apimachinery/pkg/runtime/serializer/yaml"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
kyaml "k8s.io/apimachinery/pkg/util/yaml"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -40,7 +43,9 @@ func NewCommitGeneralTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
|||
}
|
||||
}
|
||||
|
||||
func (l *CommitGeneralTaskLogic) CommitGeneralTask(req *types.GeneralTaskReq) error {
|
||||
func (l *CommitGeneralTaskLogic) CommitGeneralTask(req *types.GeneralTaskReq) (resp *types.GeneralTaskResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
resp = &types.GeneralTaskResp{}
|
||||
tx := l.svcCtx.DbEngin.Begin()
|
||||
// 执行回滚或者提交操作
|
||||
defer func() {
|
||||
|
@ -55,23 +60,22 @@ func (l *CommitGeneralTaskLogic) CommitGeneralTask(req *types.GeneralTaskReq) er
|
|||
logx.Info("commit success")
|
||||
}
|
||||
}()
|
||||
//TODO adapter
|
||||
adapterId, _ := strconv.ParseUint(req.AdapterIds[0], 10, 64)
|
||||
adapterId, _ := strconv.ParseInt(req.AdapterIds[0], 10, 64)
|
||||
var clusters []*models.CloudModel
|
||||
err := tx.Raw("SELECT * FROM `t_cluster` where adapter_id in ? and id in ?", req.AdapterIds, req.ClusterIds).Scan(&clusters).Error
|
||||
err = tx.Raw("SELECT * FROM `t_cluster` where adapter_id in ? and id in ?", req.AdapterIds, req.ClusterIds).Scan(&clusters).Error
|
||||
if err != nil {
|
||||
logx.Errorf("CommitGeneralTask() => sql execution error: %v", err)
|
||||
return errors.Errorf("the cluster does not match the drive resources. Check the data")
|
||||
return nil, errors.Errorf("the cluster does not match the drive resources. Check the data")
|
||||
}
|
||||
taskCloud := cloud.TaskCloudModel{}
|
||||
opt := &option.CloudOption{}
|
||||
utils.Convert(&req, &opt)
|
||||
sc, _ := schedulers.NewCloudScheduler(l.ctx, "", l.svcCtx.Scheduler, opt, tx, l.svcCtx.PromClient)
|
||||
|
||||
results, err := l.svcCtx.Scheduler.AssignAndSchedule(sc)
|
||||
results, err := l.svcCtx.Scheduler.AssignAndSchedule(sc, executor.SUBMIT_MODE_JOINT_CLOUD, nil)
|
||||
if err != nil {
|
||||
logx.Errorf("AssignAndSchedule() => execution error: %v", err)
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rs := (results).([]*schedulers.CloudResult)
|
||||
|
@ -97,7 +101,9 @@ func (l *CommitGeneralTaskLogic) CommitGeneralTask(req *types.GeneralTaskReq) er
|
|||
AdapterTypeDict: "0",
|
||||
SynergyStatus: synergyStatus,
|
||||
Strategy: strategy,
|
||||
UserId: req.UserId,
|
||||
}
|
||||
resp.TaskId = taskModel.Id
|
||||
var taskClouds []cloud.TaskCloudModel
|
||||
adapterName := ""
|
||||
tx.Table("t_adapter").Select("name").Where("id=?", adapterId).Find(&adapterName)
|
||||
|
@ -105,12 +111,13 @@ func (l *CommitGeneralTaskLogic) CommitGeneralTask(req *types.GeneralTaskReq) er
|
|||
for _, s := range req.ReqBody {
|
||||
sStruct := UnMarshalK8sStruct(s, int64(r.Replica))
|
||||
unString, _ := sStruct.MarshalJSON()
|
||||
taskCloud.Id = utils.GenSnowflakeIDUint()
|
||||
taskCloud.Id = utils.GenSnowflakeID()
|
||||
taskCloud.Name = sStruct.GetName() + "-" + sStruct.GetKind()
|
||||
taskCloud.TaskId = uint(taskModel.Id)
|
||||
taskCloud.TaskId = taskModel.Id
|
||||
clusterId, _ := strconv.ParseUint(r.ClusterId, 10, 64)
|
||||
taskCloud.AdapterId = uint(adapterId)
|
||||
taskCloud.AdapterId = adapterId
|
||||
taskCloud.AdapterName = adapterName
|
||||
taskCloud.UserId = req.UserId
|
||||
taskCloud.ClusterId = uint(clusterId)
|
||||
taskCloud.ClusterName = r.ClusterName
|
||||
taskCloud.Status = constants.Saved
|
||||
|
@ -131,11 +138,35 @@ func (l *CommitGeneralTaskLogic) CommitGeneralTask(req *types.GeneralTaskReq) er
|
|||
db := tx.Table("task").Create(&taskModel)
|
||||
db = tx.Table("task_cloud").Create(&taskClouds)
|
||||
db = tx.Table("t_notice").Create(¬iceInfo)
|
||||
|
||||
if db.Error != nil {
|
||||
logx.Errorf("Task creation failure, err: %v", db.Error)
|
||||
return errors.New("task creation failure")
|
||||
return nil, errors.New("task creation failure")
|
||||
}
|
||||
return nil
|
||||
// 数据上链
|
||||
bytes, _ := json.Marshal(taskModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 查询资源价格
|
||||
var price int64
|
||||
for _, clusterId := range req.ClusterIds {
|
||||
var clusterPrice int64
|
||||
l.svcCtx.DbEngin.Raw("select price from resource_cost where resource_id = ?", clusterId).Scan(&clusterPrice)
|
||||
price = price + clusterPrice
|
||||
}
|
||||
|
||||
remoteUtil.Evidence(remoteUtil.EvidenceParam{
|
||||
UserIp: req.UserIp,
|
||||
Url: l.svcCtx.Config.BlockChain.Url,
|
||||
ContractAddress: l.svcCtx.Config.BlockChain.ContractAddress,
|
||||
FunctionName: l.svcCtx.Config.BlockChain.FunctionName,
|
||||
Type: l.svcCtx.Config.BlockChain.Type,
|
||||
Token: req.Token,
|
||||
Amount: price,
|
||||
Args: []string{strconv.FormatInt(taskModel.Id, 10), string(bytes)},
|
||||
})
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func UnMarshalK8sStruct(yamlString string, replica int64) *unstructured.Unstructured {
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
|
||||
Copyright (c) [2023] [pcm]
|
||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
You may obtain a copy of Mulan PSL v2 at:
|
||||
http://license.coscl.org.cn/MulanPSL2
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
See the Mulan PSL v2 for more details.
|
||||
|
||||
*/
|
||||
|
||||
package cloud
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/participant/cloud"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
container "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/cloud"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
cloud2 "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models/cloud"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ContainerCreateLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewContainerCreateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ContainerCreateLogic {
|
||||
return &ContainerCreateLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ContainerCreateLogic) ContainerCreate(req *container.CreateParam) (resp *ContainerCreateRespStruct, err error) {
|
||||
resp = &ContainerCreateRespStruct{}
|
||||
param := &cloud.CreateParam{
|
||||
Name: req.Name,
|
||||
Description: req.Description,
|
||||
Port: req.Port,
|
||||
Cpu: req.Cpu,
|
||||
Memory: req.Memory,
|
||||
Image: req.Image,
|
||||
Args: req.Args,
|
||||
MountPath: req.MountPath,
|
||||
Envs: req.Envs,
|
||||
NodePort: req.NodePort,
|
||||
ContainerGroupName: req.ContainerGroupName,
|
||||
CreateParameter: req.ContainerCreateParameter,
|
||||
}
|
||||
create, err := l.svcCtx.Cloud.ContainerCreate(req.ClusterId, param)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if create.Code != http.StatusOK {
|
||||
return nil, errors.New(create.Message)
|
||||
}
|
||||
// 构建主任务结构体
|
||||
taskModel := models.Task{
|
||||
Id: utils.GenSnowflakeID(),
|
||||
Status: constants.Saved,
|
||||
Description: req.Description,
|
||||
Name: req.Name,
|
||||
UserId: req.UserId,
|
||||
AdapterTypeDict: "0",
|
||||
CommitTime: time.Now(),
|
||||
}
|
||||
// 保存任务数据到数据库
|
||||
tx := l.svcCtx.DbEngin.Create(&taskModel)
|
||||
if tx.Error != nil {
|
||||
|
||||
}
|
||||
var adapterId int64
|
||||
tx.Table("t_cluster").Select("adapter_id").Where("id=?", req.ClusterId).Find(&adapterId)
|
||||
// 构建cloud任务结构体
|
||||
cloudTaskModel := cloud2.TaskCloudModel{
|
||||
Id: utils.GenSnowflakeID(),
|
||||
TaskId: taskModel.Id,
|
||||
Name: req.Name,
|
||||
AdapterId: adapterId,
|
||||
Status: constants.Saved,
|
||||
Namespace: "default",
|
||||
UserId: req.UserId,
|
||||
}
|
||||
// 保存任务数据到数据库
|
||||
tx = l.svcCtx.DbEngin.Create(&cloudTaskModel)
|
||||
if tx.Error != nil {
|
||||
|
||||
}
|
||||
resp.TaskId = strconv.FormatInt(taskModel.Id, 10)
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
type ContainerCreateRespStruct struct {
|
||||
TaskId string `json:"taskId"`
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
|
||||
Copyright (c) [2023] [pcm]
|
||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
You may obtain a copy of Mulan PSL v2 at:
|
||||
http://license.coscl.org.cn/MulanPSL2
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
See the Mulan PSL v2 for more details.
|
||||
|
||||
*/
|
||||
|
||||
package cloud
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/participant/cloud"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
container "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/cloud"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type ContainerDeleteLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewContainerDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ContainerDeleteLogic {
|
||||
return &ContainerDeleteLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ContainerDeleteLogic) ContainerDelete(req *container.DeleteParam) (resp interface{}, err error) {
|
||||
param := &cloud.DeleteParam{
|
||||
Name: req.Name,
|
||||
}
|
||||
create, err := l.svcCtx.Cloud.ContainerDelete(req.ClusterId, param)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if create.Code != http.StatusOK {
|
||||
return nil, errors.New(create.Message)
|
||||
}
|
||||
resp = create.Data
|
||||
return
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
|
||||
Copyright (c) [2023] [pcm]
|
||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
You may obtain a copy of Mulan PSL v2 at:
|
||||
http://license.coscl.org.cn/MulanPSL2
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
See the Mulan PSL v2 for more details.
|
||||
|
||||
*/
|
||||
|
||||
package cloud
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/participant/cloud"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
container "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/cloud"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type ContainerGetLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewContainerGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ContainerGetLogic {
|
||||
return &ContainerGetLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ContainerGetLogic) ContainerGet(req *container.GetParam) (resp interface{}, err error) {
|
||||
param := &cloud.GetParam{
|
||||
Name: req.Name,
|
||||
}
|
||||
get, err := l.svcCtx.Cloud.ContainerGet(req.ClusterId, param)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if get.Code != http.StatusOK {
|
||||
return nil, errors.New(get.Message)
|
||||
}
|
||||
resp = get.Data
|
||||
return
|
||||
}
|
|
@ -24,7 +24,6 @@ func NewGetClusterListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
|
|||
|
||||
func (l *GetClusterListLogic) GetClusterList(req *types.GetClusterListReq) (resp *types.GetClusterListResp, err error) {
|
||||
resp = &types.GetClusterListResp{}
|
||||
//clusters := []models.ScParticipantPhyInfo{}
|
||||
l.svcCtx.DbEngin.Raw("select * from t_cluster where adapter_id = ?", req.AdapterId).Scan(&resp.Clusters)
|
||||
return resp, nil
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package cloud
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils/httputils"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
)
|
||||
|
||||
type PodsListLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
type ParticipantResp struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"message"`
|
||||
Data *v1.PodList `json:"data"` // 改成结构体
|
||||
}
|
||||
|
||||
type ClusterInfo struct {
|
||||
Name string `json:"name"`
|
||||
Server string `json:"server"`
|
||||
}
|
||||
|
||||
func NewPodsListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PodsListLogic {
|
||||
return &PodsListLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *PodsListLogic) PodsList(req *types.PodsListReq) (resp *types.PodsListResp, err error) {
|
||||
resp = &types.PodsListResp{}
|
||||
// query cluster http url.
|
||||
var clusterInfoList []ClusterInfo
|
||||
l.svcCtx.DbEngin.Raw("select ta.server,tc.name from t_adapter ta,t_cluster tc where ta.id = tc.adapter_id and ta.resource_type = '01'").Scan(&clusterInfoList)
|
||||
for _, clusterInfo := range clusterInfoList {
|
||||
participantResp := ParticipantResp{}
|
||||
param := map[string]string{
|
||||
"clusterName": clusterInfo.Name,
|
||||
}
|
||||
httputils.HttpGetWithResult(param, clusterInfo.Server+"/api/v1/pod/list", &participantResp)
|
||||
|
||||
resp.Data = append(resp.Data, participantResp.Data)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CancelResourceSpecAlarmLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCancelResourceSpecAlarmLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CancelResourceSpecAlarmLogic {
|
||||
return &CancelResourceSpecAlarmLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CancelResourceSpecAlarmLogic) CancelResourceSpecAlarm(req *types.IdReq) (resp *types.CommonResp, err error) {
|
||||
db := l.svcCtx.DbEngin.Model(&types.ResourceSpec{}).Table("t_resource_spec")
|
||||
err = db.Where("t_resource_spec.deleted_at is null and t_resource_spec.id = ?", req.Id).Update("change_type", 0).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return
|
||||
}
|
|
@ -6,6 +6,7 @@ import (
|
|||
clientCore "gitlink.org.cn/JointCloud/pcm-coordinator/client"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/schedulers"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/schedulers/option"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/executor"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants"
|
||||
|
@ -62,7 +63,7 @@ func (l *CommitVmTaskLogic) CommitVmTask(req *types.CommitVmTaskReq) (resp *type
|
|||
return nil, err
|
||||
}
|
||||
// 3、Return scheduling results
|
||||
results, err := l.svcCtx.Scheduler.AssignAndSchedule(vmSchdl)
|
||||
results, err := l.svcCtx.Scheduler.AssignAndSchedule(vmSchdl, executor.SUBMIT_MODE_JOINT_CLOUD, nil)
|
||||
if err != nil {
|
||||
logx.Errorf("AssignAndSchedule() => execution error: %v", err)
|
||||
return nil, err
|
||||
|
|
|
@ -0,0 +1,366 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/rs/zerolog/log"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/schedule"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CompareResourceSpecLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
const (
|
||||
ChangeTypeNormal = 0 // 资源规格正常
|
||||
ChangeTypeModified = 1 // 资源规格变更
|
||||
ChangeTypeDeleted = 2 // 资源被删除
|
||||
)
|
||||
|
||||
type APIResponse struct {
|
||||
ClusterId string `json:"ClusterId"`
|
||||
ClusterType string `json:"clusterType"`
|
||||
Region string `json:"region"`
|
||||
Tag string `json:"tag"`
|
||||
Resources []Resource `json:"resources"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
type Resource struct {
|
||||
Resource ResourceDetail `json:"resource"`
|
||||
BaseResources []ResourceDetail `json:"baseResources"`
|
||||
}
|
||||
|
||||
type ResourceDetail struct {
|
||||
Type string `json:"type"`
|
||||
Name string `json:"name"`
|
||||
Total Metric `json:"total"`
|
||||
Available Metric `json:"available"`
|
||||
}
|
||||
|
||||
type Metric struct {
|
||||
Unit string `json:"unit"`
|
||||
Value float64 `json:"value"`
|
||||
}
|
||||
|
||||
func NewCompareResourceSpecLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CompareResourceSpecLogic {
|
||||
return &CompareResourceSpecLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CompareResourceSpecLogic) CompareResourceSpec(req *types.FetchResourceSpecReq) (resp *types.PageResult, err error) {
|
||||
if req.ClusterId == "" {
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// 获取集群资源数据
|
||||
startTime := time.Now()
|
||||
apiResources, err := l.FetchClusterResources(req.ClusterId, req.Tag)
|
||||
log.Debug().Msgf("调用获取ai训练资源接口耗时: %v", time.Since(startTime))
|
||||
if err != nil {
|
||||
log.Error().Msgf("调用第三方接口获取集群资源失败: %v", err)
|
||||
|
||||
return nil, fmt.Errorf("调用第三方接口获取集群资源失败")
|
||||
}
|
||||
|
||||
// 同步资源到数据库
|
||||
if err := l.syncResourcesToDB(apiResources, req.UserId); err != nil {
|
||||
return nil, fmt.Errorf("failed to sync resources: %w", err)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (l *CompareResourceSpecLogic) FetchClusterResources(clusterId string, tag string) ([]APIResponse, error) {
|
||||
queryLogic := schedule.NewQueryResourcesLogic(l.ctx, l.svcCtx)
|
||||
resources, err := queryLogic.QueryResources(&types.QueryResourcesReq{
|
||||
Type: tag,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("query resources failed: %w", err)
|
||||
}
|
||||
|
||||
var apiResponses []APIResponse
|
||||
if err := decodeAPIResponse(resources.Data, &apiResponses); err != nil {
|
||||
return nil, fmt.Errorf("decode response failed: %w", err)
|
||||
}
|
||||
// 过滤出指定集群的资源
|
||||
var filteredResponses []APIResponse
|
||||
for _, response := range apiResponses {
|
||||
if response.ClusterId == clusterId && response.Resources != nil {
|
||||
filteredResponses = append(filteredResponses, response)
|
||||
}
|
||||
}
|
||||
if len(filteredResponses) == 0 {
|
||||
return nil, fmt.Errorf("no resources found for cluster ID: %s", clusterId)
|
||||
}
|
||||
return filteredResponses, nil
|
||||
}
|
||||
|
||||
func decodeAPIResponse(input interface{}, output *[]APIResponse) error {
|
||||
config := &mapstructure.DecoderConfig{
|
||||
Result: output,
|
||||
TagName: "json",
|
||||
ErrorUnused: true,
|
||||
DecodeHook: mapstructure.ComposeDecodeHookFunc(
|
||||
mapstructure.StringToTimeHookFunc(time.RFC3339),
|
||||
mapstructure.StringToSliceHookFunc(","),
|
||||
),
|
||||
}
|
||||
|
||||
decoder, err := mapstructure.NewDecoder(config)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create decoder: %w", err)
|
||||
}
|
||||
|
||||
if err := decoder.Decode(input); err != nil {
|
||||
return fmt.Errorf("decoding error: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *CompareResourceSpecLogic) syncResourcesToDB(apiResponses []APIResponse, userId int64) error {
|
||||
for _, response := range apiResponses {
|
||||
// 转换API响应到数据库模型
|
||||
dbSpecs, apiSpecs, err := l.processAPIResponse(response, userId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 处理资源变更
|
||||
if err := l.handleResourceChanges(dbSpecs, apiSpecs); err != nil {
|
||||
return fmt.Errorf("failed to handle resource changes: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *CompareResourceSpecLogic) processAPIResponse(response APIResponse, userId int64) ([]models.TResourceSpec, []models.TResourceSpec, error) {
|
||||
ClusterId := utils.StringToInt64(response.ClusterId)
|
||||
var dbSpecs []models.TResourceSpec
|
||||
if err := l.svcCtx.DbEngin.Model(models.TResourceSpec{}).Preload("BaseResourceSpecs").
|
||||
Where("cluster_id = ?", ClusterId).
|
||||
Where("tag = ?", response.Tag).
|
||||
Find(&dbSpecs).Error; err != nil {
|
||||
return nil, nil, fmt.Errorf("database query failed: %w", err)
|
||||
}
|
||||
|
||||
var apiSpecs []models.TResourceSpec
|
||||
for _, res := range response.Resources {
|
||||
// 检查资源类型和名称是否存在
|
||||
if res.Resource.Name == "" || res.Resource.Type == "" {
|
||||
continue
|
||||
}
|
||||
spec := l.convertToResourceSpec(ClusterId, res, response.Tag, userId)
|
||||
apiSpecs = append(apiSpecs, spec)
|
||||
}
|
||||
|
||||
return dbSpecs, apiSpecs, nil
|
||||
}
|
||||
|
||||
func (l *CompareResourceSpecLogic) handleResourceChanges(dbSpecs, apiSpecs []models.TResourceSpec) error {
|
||||
dbMap := make(map[string]models.TResourceSpec)
|
||||
for _, spec := range dbSpecs {
|
||||
key := spec.SourceKey
|
||||
dbMap[key] = spec
|
||||
}
|
||||
|
||||
apiMap := make(map[string]models.TResourceSpec)
|
||||
for _, spec := range apiSpecs {
|
||||
key := resourceKey(spec.Type, spec.Name, spec.Tag)
|
||||
apiMap[key] = spec
|
||||
}
|
||||
|
||||
var createSpecs []*models.TResourceSpec
|
||||
var modifiedIDs []int64
|
||||
var normalIDs []int64
|
||||
|
||||
// 第一阶段:收集需要处理的操作
|
||||
for key, apiSpec := range apiMap {
|
||||
dbSpec, exists := dbMap[key]
|
||||
if !exists {
|
||||
// 创建资源副本避免指针重复
|
||||
newSpec := apiSpec
|
||||
// 初始化时间字段
|
||||
newSpec.CreateTime = time.Now()
|
||||
newSpec.UpdateTime = time.Now()
|
||||
newSpec.Tag = apiSpec.Tag
|
||||
createSpecs = append(createSpecs, &newSpec)
|
||||
continue
|
||||
}
|
||||
|
||||
// 检查资源规格变更
|
||||
if l.isSpecChanged(dbSpec, apiSpec) {
|
||||
modifiedIDs = append(modifiedIDs, dbSpec.Id)
|
||||
} else {
|
||||
normalIDs = append(normalIDs, dbSpec.Id)
|
||||
}
|
||||
}
|
||||
|
||||
// 第二阶段:批量处理数据库操作
|
||||
// 批量创建新资源及关联资源
|
||||
if len(createSpecs) > 0 {
|
||||
tx := l.svcCtx.DbEngin.Begin()
|
||||
if tx.Error != nil {
|
||||
return fmt.Errorf("failed to start transaction: %w", tx.Error)
|
||||
}
|
||||
|
||||
// 批量插入主资源
|
||||
if err := tx.CreateInBatches(createSpecs, 100).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return fmt.Errorf("failed to batch create resources: %w", err)
|
||||
}
|
||||
|
||||
if err := tx.Commit().Error; err != nil {
|
||||
return fmt.Errorf("transaction commit failed: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
// 批量更新变更资源
|
||||
now := time.Now()
|
||||
if len(modifiedIDs) > 0 {
|
||||
if err := l.svcCtx.DbEngin.Model(&models.TResourceSpec{}).
|
||||
Where("id IN ?", modifiedIDs).
|
||||
Updates(map[string]interface{}{
|
||||
"change_type": ChangeTypeModified,
|
||||
"update_time": now,
|
||||
}).Error; err != nil {
|
||||
return fmt.Errorf("batch update modified failed: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
// 批量更新正常资源
|
||||
if len(normalIDs) > 0 {
|
||||
if err := l.svcCtx.DbEngin.Model(&models.TResourceSpec{}).
|
||||
Where("id IN ?", normalIDs).
|
||||
Updates(map[string]interface{}{
|
||||
"change_type": ChangeTypeNormal,
|
||||
"update_time": now,
|
||||
}).Error; err != nil {
|
||||
return fmt.Errorf("batch update normal failed: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
// 处理删除的资源
|
||||
for key, dbSpec := range dbMap {
|
||||
if _, exists := apiMap[key]; !exists {
|
||||
if err := l.markResourceDeleted(dbSpec.Id); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceKey(resType, name, tag string) string {
|
||||
return fmt.Sprintf("%s::%s::%s", resType, name, tag)
|
||||
}
|
||||
|
||||
func (l *CompareResourceSpecLogic) createNewResource(spec *models.TResourceSpec) error {
|
||||
return l.svcCtx.DbEngin.Transaction(func(tx *gorm.DB) error {
|
||||
if err := tx.Create(spec).Error; err != nil {
|
||||
return fmt.Errorf("failed to create resource: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// 标识资源规格变更
|
||||
func (l *CompareResourceSpecLogic) updateResource(existing *models.TResourceSpec, newSpec models.TResourceSpec, changeType int) error {
|
||||
return l.svcCtx.DbEngin.Transaction(func(tx *gorm.DB) error {
|
||||
updates := map[string]interface{}{
|
||||
"change_type": changeType,
|
||||
"update_time": time.Now(),
|
||||
}
|
||||
|
||||
if err := tx.Model(existing).Updates(updates).Error; err != nil {
|
||||
return fmt.Errorf("failed to update resource: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (l *CompareResourceSpecLogic) markResourceDeleted(id int64) error {
|
||||
return l.svcCtx.DbEngin.Model(&models.TResourceSpec{}).
|
||||
Where("id = ?", id).
|
||||
Update("change_type", ChangeTypeDeleted).
|
||||
Error
|
||||
}
|
||||
|
||||
func (l *CompareResourceSpecLogic) isSpecChanged(old, new models.TResourceSpec) bool {
|
||||
if old.TotalCount != new.TotalCount ||
|
||||
old.AvailableCount != new.AvailableCount ||
|
||||
old.Region != new.Region {
|
||||
return true
|
||||
}
|
||||
|
||||
// 比较基础资源
|
||||
oldBaseMap := make(map[string]models.TBaseResourceSpec)
|
||||
for _, br := range old.BaseResourceSpecs {
|
||||
oldBaseMap[resourceKey(br.Type, br.Name, old.Tag)] = br
|
||||
}
|
||||
|
||||
for _, newBr := range new.BaseResourceSpecs {
|
||||
key := resourceKey(newBr.Type, newBr.Name, new.Tag)
|
||||
oldBr, exists := oldBaseMap[key]
|
||||
if !exists ||
|
||||
oldBr.TotalValue != newBr.TotalValue ||
|
||||
oldBr.AvailableValue != newBr.AvailableValue {
|
||||
return true
|
||||
}
|
||||
delete(oldBaseMap, key)
|
||||
}
|
||||
|
||||
return len(oldBaseMap) > 0
|
||||
}
|
||||
|
||||
func (l *CompareResourceSpecLogic) convertToResourceSpec(ClusterId int64, res Resource, tag string, userId int64) models.TResourceSpec {
|
||||
spec := models.TResourceSpec{
|
||||
SourceKey: resourceKey(res.Resource.Type, res.Resource.Name, tag),
|
||||
Type: res.Resource.Type,
|
||||
Name: res.Resource.Name,
|
||||
Tag: tag,
|
||||
TotalCount: int64(res.Resource.Total.Value),
|
||||
AvailableCount: int64(res.Resource.Available.Value),
|
||||
ClusterId: ClusterId,
|
||||
CreateTime: time.Now(),
|
||||
UpdateTime: time.Now(),
|
||||
UserId: userId,
|
||||
ChangeType: ChangeTypeNormal,
|
||||
}
|
||||
|
||||
for _, br := range res.BaseResources {
|
||||
spec.BaseResourceSpecs = append(spec.BaseResourceSpecs, models.TBaseResourceSpec{
|
||||
Type: br.Type,
|
||||
Name: br.Name,
|
||||
TotalValue: br.Total.Value,
|
||||
TotalUnit: br.Total.Unit,
|
||||
AvailableValue: br.Available.Value,
|
||||
AvailableUnit: br.Available.Unit,
|
||||
UserId: userId,
|
||||
CreateTime: time.Now(),
|
||||
UpdateTime: time.Now(),
|
||||
})
|
||||
}
|
||||
|
||||
return spec
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteResourceSpecLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewDeleteResourceSpecLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteResourceSpecLogic {
|
||||
return &DeleteResourceSpecLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteResourceSpecLogic) DeleteResourceSpec(req *types.DeletePathId) (resp *types.CommonResp, err error) {
|
||||
// 初始化事务
|
||||
tx := l.svcCtx.DbEngin.Begin()
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
tx.Rollback()
|
||||
panic(r)
|
||||
}
|
||||
}()
|
||||
|
||||
// 1. 检查主资源规格是否存在
|
||||
var mainSpec models.TResourceSpec
|
||||
if err := tx.Where("id = ? AND deleted_at IS NULL", req.Id).
|
||||
First(&mainSpec).
|
||||
Error; err != nil {
|
||||
tx.Rollback()
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, errors.Errorf("资源规格不存在 (ID: %s)", req.Id)
|
||||
}
|
||||
return nil, errors.Wrapf(err, "查询资源规格失败 (ID: %s)", req.Id)
|
||||
}
|
||||
|
||||
// 2. 删除主资源规格(软删除)
|
||||
if err := tx.Model(&models.TResourceSpec{}).
|
||||
Where("id = ?", req.Id).
|
||||
Update("deleted_at", time.Now()).
|
||||
Error; err != nil {
|
||||
tx.Rollback()
|
||||
return nil, errors.Wrapf(err, "删除主资源规格失败 (ID: %s)", req.Id)
|
||||
}
|
||||
|
||||
// 3. 删除关联的基础资源规格(软删除)
|
||||
if err := tx.Model(&models.TBaseResourceSpec{}).
|
||||
Where("resource_spec_id = ?", req.Id).
|
||||
Update("deleted_at", time.Now()).
|
||||
Error; err != nil {
|
||||
tx.Rollback()
|
||||
return nil, errors.Wrapf(err, "删除基础资源规格失败 (ID: %s)", req.Id)
|
||||
}
|
||||
|
||||
// 提交事务
|
||||
if err := tx.Commit().Error; err != nil {
|
||||
return nil, errors.Wrap(err, "提交事务失败")
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
|
@ -47,8 +47,8 @@ func (l *DeleteTaskLogic) DeleteTask(req *types.DeleteTaskReq) error {
|
|||
return tx.Error
|
||||
}
|
||||
// 将子任务状态修改为待删除
|
||||
tx = l.svcCtx.DbEngin.Model(&models.Cloud{}).Where("task_id", req.Id).Update("status", constants.WaitDelete)
|
||||
l.svcCtx.DbEngin.Where("task_id = ?", req.Id).Delete(&models.Cloud{}, req.Id)
|
||||
tx = l.svcCtx.DbEngin.Model(&models.TaskCloud{}).Where("task_id", req.Id).Update("status", constants.WaitDelete)
|
||||
l.svcCtx.DbEngin.Where("task_id = ?", req.Id).Delete(&models.TaskCloud{}, req.Id)
|
||||
if tx.Error != nil {
|
||||
return tx.Error
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DetailResourceSpecLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewDetailResourceSpecLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DetailResourceSpecLogic {
|
||||
return &DetailResourceSpecLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DetailResourceSpecLogic) DetailResourceSpec(req *types.IdReq) (resp *types.ResourceSpec, err error) {
|
||||
resp = &types.ResourceSpec{}
|
||||
db := l.svcCtx.DbEngin.Model(&types.ResourceSpec{}).Table("t_resource_spec")
|
||||
err = db.Where("id = ? and deleted_at is null", req.Id).Scan(&resp).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if resp.Id == 0 {
|
||||
logx.Errorf("resource spec not found , id:%s not found", req.Id)
|
||||
return resp, errors.New("resource spec not found")
|
||||
}
|
||||
var baseSpecs []types.BaseResourceSpec
|
||||
baseDb := l.svcCtx.DbEngin.Model(&types.BaseResourceSpec{}).Table("t_base_resource_spec")
|
||||
baseDb = baseDb.Where("t_base_resource_spec.deleted_at is null and t_base_resource_spec.resource_spec_id = ?", resp.Id)
|
||||
err = baseDb.Scan(&baseSpecs).Error
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
resp.BaseResourceSpecs = baseSpecs
|
||||
return
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type EditResourceSpecLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewEditResourceSpecLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EditResourceSpecLogic {
|
||||
return &EditResourceSpecLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
func (l *EditResourceSpecLogic) EditResourceSpec(req *types.EditResourceReq) (resp *types.CommonResp, err error) {
|
||||
// 初始化事务
|
||||
tx := l.svcCtx.DbEngin.Begin()
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
tx.Rollback()
|
||||
panic(r)
|
||||
} else if err != nil {
|
||||
tx.Rollback()
|
||||
}
|
||||
}()
|
||||
|
||||
// 1. 验证资源规格存在
|
||||
var existing models.TResourceSpec
|
||||
if err = tx.Model(&models.TResourceSpec{}).
|
||||
Where("id = ? AND deleted_at IS NULL", req.Id).
|
||||
First(&existing).
|
||||
Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, errors.Errorf("资源规格不存在 (ID: %d)", req.Id)
|
||||
}
|
||||
return nil, errors.Wrapf(err, "查询资源规格失败 (ID: %d)", req.Id)
|
||||
}
|
||||
|
||||
// 2. 参数校验
|
||||
if err = validateRequestParams(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 3. 转换参数
|
||||
statusInt := utils.StringToInt64(req.Status)
|
||||
costPerUnit := utils.StringToFloat64(req.CostPerUnit)
|
||||
|
||||
// 4. 更新主资源规格
|
||||
if err = updateMainResourceSpec(tx, req.Id, statusInt, req.CostType, costPerUnit, req.UserId); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 5. 更新子资源规格
|
||||
if err = updateSubResources(tx, req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 提交事务
|
||||
if err = tx.Commit().Error; err != nil {
|
||||
return nil, errors.Wrap(err, "提交事务失败")
|
||||
}
|
||||
|
||||
// 返回成功响应
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// validateRequestParams 验证请求参数合法性
|
||||
func validateRequestParams(req *types.EditResourceReq) error {
|
||||
// 状态校验
|
||||
if req.Status != "0" && req.Status != "1" {
|
||||
return errors.Errorf("资源规格状态不合法 (ID: %d)", req.Id)
|
||||
}
|
||||
|
||||
// 计费类型校验
|
||||
validCostTypes := map[string]struct{}{
|
||||
"hourly": {},
|
||||
"daily": {},
|
||||
"monthly": {},
|
||||
"perUse": {},
|
||||
}
|
||||
if _, ok := validCostTypes[req.CostType]; !ok {
|
||||
return errors.Errorf("资源规格计费类型不合法 (ID: %d)", req.Id)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// updateMainResourceSpec 更新主资源规格
|
||||
func updateMainResourceSpec(tx *gorm.DB, id int64, status int64, costType string, costPerUnit float64, userId int64) error {
|
||||
return tx.Model(&models.TResourceSpec{}).
|
||||
Where("id = ?", id).
|
||||
Updates(map[string]interface{}{
|
||||
"status": status,
|
||||
"cost_type": costType,
|
||||
"cost_per_unit": costPerUnit,
|
||||
"user_id": userId,
|
||||
}).
|
||||
Error
|
||||
}
|
||||
|
||||
// updateSubResources 更新子资源规格
|
||||
func updateSubResources(tx *gorm.DB, req *types.EditResourceReq) error {
|
||||
// 定义更新操作集合
|
||||
updateOperations := []struct {
|
||||
Value string
|
||||
Unit string
|
||||
SpecType string
|
||||
SpecName string
|
||||
}{
|
||||
{req.CpuValue, req.CpuUnit, "CPU", ""},
|
||||
{req.MemoryValue, req.MemoryUnit, "MEMORY", "RAM"},
|
||||
{req.StorageValue, req.StorageUnit, "STORAGE", ""},
|
||||
}
|
||||
|
||||
// 批量执行更新操作
|
||||
for _, op := range updateOperations {
|
||||
if op.Value == "" && op.Unit == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
if err := updateBaseResourceSpec(tx, req.Id, op.SpecType, op.SpecName, op.Value, op.Unit); err != nil {
|
||||
return errors.Wrapf(err, "更新%s规格失败 (ID: %d)", op.SpecType, req.Id)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// updateBaseResourceSpec 通用基础资源规格更新函数
|
||||
func updateBaseResourceSpec(tx *gorm.DB, specID int64, specType string, specName string, value, unit string) error {
|
||||
updates := make(map[string]interface{})
|
||||
if value != "" {
|
||||
updates["total_value"] = value
|
||||
}
|
||||
if unit != "" {
|
||||
updates["total_unit"] = unit
|
||||
}
|
||||
if len(updates) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
query := tx.Model(&models.TBaseResourceSpec{}).
|
||||
Where("resource_spec_id = ? AND type = ?", specID, specType)
|
||||
|
||||
if specName != "" {
|
||||
query = query.Where("name = ?", specName)
|
||||
}
|
||||
|
||||
if err := query.Updates(updates).Error; err != nil {
|
||||
return errors.Wrapf(err, "更新%s规格失败", specType)
|
||||
}
|
||||
return nil
|
||||
}
|
|
@ -19,10 +19,6 @@ import (
|
|||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/enum"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils/httputils"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
)
|
||||
|
||||
type JobTotalLogic struct {
|
||||
|
@ -55,60 +51,60 @@ func NewJobTotalLogic(ctx context.Context, svcCtx *svc.ServiceContext) *JobTotal
|
|||
}
|
||||
|
||||
func (l *JobTotalLogic) JobTotal() (resp *types.JobTotalResp, err error) {
|
||||
// 获取任务时间信息
|
||||
resp = &types.JobTotalResp{}
|
||||
bytes, err := httputils.HttpGet("GET", "http://grampus.openi.org.cn/openapi/v1/sharescreen/computepower/alljobinfo")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(bytes, resp)
|
||||
|
||||
// 获取其他任务信息
|
||||
jobs := &Job{}
|
||||
jobBytes, err := httputils.HttpGet("GET", "http://grampus.openi.org.cn/openapi/v1/sharescreen/trainjob?pageIndex=1&pageSize=10")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(jobBytes, jobs)
|
||||
|
||||
for _, job := range jobs.OtJobs {
|
||||
trainJob := types.TrainJob{
|
||||
Name: job.Name,
|
||||
Status: enum.ExternalStatus(job.Status).String(),
|
||||
Strategy: 0,
|
||||
SynergyStatus: "未协同",
|
||||
}
|
||||
if job.Tasks[0].CenterName != nil {
|
||||
trainJob.ParticipantName = job.Tasks[0].CenterName[0]
|
||||
}
|
||||
resp.TrainJobs = append(resp.TrainJobs, trainJob)
|
||||
}
|
||||
|
||||
var tasks []models.Task
|
||||
tx := l.svcCtx.DbEngin.Find(&tasks)
|
||||
if tx.Error != nil {
|
||||
logx.Error(err)
|
||||
return nil, tx.Error
|
||||
}
|
||||
if len(tasks) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
for _, task := range tasks {
|
||||
var participantName string
|
||||
tx := l.svcCtx.DbEngin.Raw("SELECT name from sc_participant_phy_info where id in (SELECT CONCAT_WS(',',GROUP_CONCAT(DISTINCT h.participant_id) ,GROUP_CONCAT(DISTINCT a.participant_id) ,GROUP_CONCAT(DISTINCT c.participant_id))as service_name from task t left join hpc h on t.id = h.task_id left join cloud c on t.id = c.task_id left join ai a on t.id = a.task_id where t.id = ?)", task.Id).Scan(&participantName)
|
||||
if tx.Error != nil {
|
||||
logx.Error(err)
|
||||
return nil, tx.Error
|
||||
}
|
||||
// 承接方转义
|
||||
resp.TrainJobs = append(resp.TrainJobs, types.TrainJob{
|
||||
ParticipantName: participantName,
|
||||
Name: task.Name,
|
||||
Strategy: int(task.Strategy),
|
||||
SynergyStatus: enum.SynergyStatus(task.SynergyStatus).String(),
|
||||
Status: task.Status,
|
||||
})
|
||||
|
||||
}
|
||||
//// 获取任务时间信息
|
||||
//resp = &types.JobTotalResp{}
|
||||
//bytes, err := httputils.HttpGet("http://grampus.openi.org.cn/openapi/v1/sharescreen/computepower/alljobinfo")
|
||||
//if err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
//json.Unmarshal(bytes, resp)
|
||||
//
|
||||
//// 获取其他任务信息
|
||||
//jobs := &Job{}
|
||||
//jobBytes, err := httputils.HttpGet("http://grampus.openi.org.cn/openapi/v1/sharescreen/trainjob?pageIndex=1&pageSize=10")
|
||||
//if err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
//json.Unmarshal(jobBytes, jobs)
|
||||
//
|
||||
//for _, job := range jobs.OtJobs {
|
||||
// trainJob := types.TrainJob{
|
||||
// Name: job.Name,
|
||||
// Status: enum.ExternalStatus(job.Status).String(),
|
||||
// Strategy: 0,
|
||||
// SynergyStatus: "未协同",
|
||||
// }
|
||||
// if job.Tasks[0].CenterName != nil {
|
||||
// trainJob.ParticipantName = job.Tasks[0].CenterName[0]
|
||||
// }
|
||||
// resp.TrainJobs = append(resp.TrainJobs, trainJob)
|
||||
//}
|
||||
//
|
||||
//var tasks []models.Task
|
||||
//tx := l.svcCtx.DbEngin.Find(&tasks)
|
||||
//if tx.Error != nil {
|
||||
// logx.Error(err)
|
||||
// return nil, tx.Error
|
||||
//}
|
||||
//if len(tasks) == 0 {
|
||||
// return nil, nil
|
||||
//}
|
||||
//for _, task := range tasks {
|
||||
// var participantName string
|
||||
// tx := l.svcCtx.DbEngin.Raw("SELECT name from sc_participant_phy_info where id in (SELECT CONCAT_WS(',',GROUP_CONCAT(DISTINCT h.participant_id) ,GROUP_CONCAT(DISTINCT a.participant_id) ,GROUP_CONCAT(DISTINCT c.participant_id))as service_name from task t left join hpc h on t.id = h.task_id left join cloud c on t.id = c.task_id left join ai a on t.id = a.task_id where t.id = ?)", task.Id).Scan(&participantName)
|
||||
// if tx.Error != nil {
|
||||
// logx.Error(err)
|
||||
// return nil, tx.Error
|
||||
// }
|
||||
// // 承接方转义
|
||||
// resp.TrainJobs = append(resp.TrainJobs, types.TrainJob{
|
||||
// ParticipantName: participantName,
|
||||
// Name: task.Name,
|
||||
// Strategy: int(task.Strategy),
|
||||
// SynergyStatus: enum.SynergyStatus(task.SynergyStatus).String(),
|
||||
// Status: task.Status,
|
||||
// })
|
||||
//
|
||||
//}
|
||||
return resp, nil
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package core
|
|||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/utils/status"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
|
@ -23,53 +22,72 @@ func NewPageListTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Page
|
|||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
//taskStatus: status.NewTaskStatus(svcCtx.Scheduler.AiStorages, svcCtx.Scheduler.AiService.AiCollectorAdapterMap, &svcCtx.Config),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *PageListTaskLogic) PageListTask(req *types.PageTaskReq) (resp *types.PageResult, err error) {
|
||||
res := &types.PageResult{}
|
||||
// 检查请求参数的有效性
|
||||
if req.PageSize <= 0 || req.PageNum <= 0 {
|
||||
return nil, result.NewDefaultError("Invalid page size or page number")
|
||||
}
|
||||
|
||||
limit := req.PageSize
|
||||
offset := req.PageSize * (req.PageNum - 1)
|
||||
resp = &types.PageResult{}
|
||||
var list []*types.TaskModel
|
||||
|
||||
// 构建数据库查询
|
||||
db := l.svcCtx.DbEngin.Model(&types.TaskModel{}).Table("task")
|
||||
if req.UserName != "" && req.UserName != "admin" {
|
||||
db = db.Where("user_id = ?", req.UserId)
|
||||
}
|
||||
|
||||
db = db.Where("deleted_at is null")
|
||||
if req.Name != "" {
|
||||
db = db.Where("name LIKE ?", "%"+req.Name+"%")
|
||||
}
|
||||
|
||||
//count total
|
||||
var total int64
|
||||
err = db.Count(&total).Error
|
||||
db.Limit(limit).Offset(offset)
|
||||
|
||||
if err != nil {
|
||||
return resp, err
|
||||
if req.Type != "" {
|
||||
db = db.Where("adapter_type_dict = ?", req.Type)
|
||||
}
|
||||
err = db.Order("created_time desc").Find(&list).Error
|
||||
if err != nil {
|
||||
// 计算总数
|
||||
var total int64
|
||||
if err := db.Count(&total).Error; err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
|
||||
// 查询任务列表
|
||||
if err := db.Limit(limit).Offset(offset).Order("created_time desc").Find(&list).Error; err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
|
||||
// 更新智算任务状态
|
||||
go status.UpdateTaskStatus(l.svcCtx, list)
|
||||
go status.UpdateAiTaskStatus(l.svcCtx, list)
|
||||
go l.svcCtx.Scheduler.AiService.St.UpdateTaskStatus(list)
|
||||
go l.svcCtx.Scheduler.AiService.St.UpdateAiTaskStatus(list)
|
||||
|
||||
// 计算每个任务的运行时间x
|
||||
for _, model := range list {
|
||||
if model.StartTime != "" && model.EndTime == "" {
|
||||
startTime := timeutils.TimeStringToGoTime(model.StartTime)
|
||||
model.RunningTime = int64(time.Now().Sub(startTime).Seconds())
|
||||
}
|
||||
if model.StartTime != "" && model.EndTime != "" {
|
||||
startTime := timeutils.TimeStringToGoTime(model.StartTime)
|
||||
endTime := timeutils.TimeStringToGoTime(model.EndTime)
|
||||
model.RunningTime = int64(endTime.Sub(startTime).Seconds())
|
||||
}
|
||||
model.RunningTime = calculateRunningTime(model.StartTime, model.EndTime)
|
||||
}
|
||||
resp.List = &list
|
||||
resp.PageSize = req.PageSize
|
||||
resp.PageNum = req.PageNum
|
||||
resp.Total = total
|
||||
|
||||
return
|
||||
// 填充响应数据
|
||||
res.List = &list
|
||||
res.PageSize = req.PageSize
|
||||
res.PageNum = req.PageNum
|
||||
res.Total = total
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// calculateRunningTime 计算任务的运行时间
|
||||
func calculateRunningTime(startTimeStr, endTimeStr string) int64 {
|
||||
if startTimeStr == "" {
|
||||
return 0
|
||||
}
|
||||
startTime := timeutils.TimeStringToGoTime(startTimeStr)
|
||||
if endTimeStr == "" {
|
||||
return int64(time.Now().Sub(startTime).Seconds())
|
||||
}
|
||||
endTime := timeutils.TimeStringToGoTime(endTimeStr)
|
||||
return int64(endTime.Sub(startTime).Seconds())
|
||||
}
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type PageResourceRangeLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewPageResourceRangeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PageResourceRangeLogic {
|
||||
return &PageResourceRangeLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *PageResourceRangeLogic) PageResourceRange(req *types.ResourceSpecReq) (resp *types.PageResult, err error) {
|
||||
if req.PageNum <= 0 || req.PageSize <= 0 {
|
||||
return nil, fmt.Errorf("invalid pagination parameters: PageNum=%d, PageSize=%d", req.PageNum, req.PageSize)
|
||||
}
|
||||
result := &types.PageResult{
|
||||
PageNum: req.PageNum,
|
||||
PageSize: req.PageSize,
|
||||
}
|
||||
|
||||
query := l.buildBaseQuery(req)
|
||||
if err := query.Count(&result.Total).Error; err != nil {
|
||||
return nil, fmt.Errorf("failed to count records: %w", err)
|
||||
}
|
||||
|
||||
var specs []*models.TResourceSpec
|
||||
if err := query.Model(models.TResourceSpec{}).Preload("BaseResourceSpecs").
|
||||
Scopes(paginate(req.PageNum, req.PageSize)).
|
||||
Find(&specs).Error; err != nil {
|
||||
return nil, fmt.Errorf("failed to query resources: %w", err)
|
||||
}
|
||||
|
||||
result.List = specs
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (l *PageResourceRangeLogic) buildBaseQuery(req *types.ResourceSpecReq) *gorm.DB {
|
||||
query := l.svcCtx.DbEngin.Model(&models.TResourceSpec{}).
|
||||
Where("deleted_at IS NULL")
|
||||
|
||||
if req.ClusterId != "" {
|
||||
query = query.Where("cluster_id = ?", req.ClusterId)
|
||||
}
|
||||
if req.Tag != "" {
|
||||
query = query.Where("tag = ?", req.Tag)
|
||||
}
|
||||
if req.Status != "" {
|
||||
query = query.Where("status = ?", req.Status)
|
||||
}
|
||||
if req.ChangeType != "" {
|
||||
query = query.Where("change_type = ?", req.ChangeType)
|
||||
}
|
||||
if req.Type != "" {
|
||||
query = query.Where("type = ?", req.Type)
|
||||
}
|
||||
if req.Name != "" {
|
||||
query = query.Where("name LIKE ?", "%"+req.Name+"%")
|
||||
}
|
||||
|
||||
return query
|
||||
}
|
||||
|
||||
func paginate(pageNum, pageSize int) func(db *gorm.DB) *gorm.DB {
|
||||
return func(db *gorm.DB) *gorm.DB {
|
||||
offset := (pageNum - 1) * pageSize
|
||||
return db.Offset(offset).Limit(pageSize).Order("create_time DESC")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ResourceRangeLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewResourceRangeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ResourceRangeLogic {
|
||||
return &ResourceRangeLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ResourceRangeLogic) ResourceRange(req *types.ResourceSpecReq) (resp *types.ListResult, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/utils/status"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ScreenPageTaskLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
taskStatus *status.TaskStatus
|
||||
}
|
||||
|
||||
func NewScreenPageTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ScreenPageTaskLogic {
|
||||
return &ScreenPageTaskLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ScreenPageTaskLogic) ScreenPageTask(req *types.PageTaskReq) (resp *types.PageResult, err error) {
|
||||
res := &types.PageResult{}
|
||||
// 检查请求参数的有效性
|
||||
if req.PageSize <= 0 || req.PageNum <= 0 {
|
||||
return nil, result.NewDefaultError("Invalid page size or page number")
|
||||
}
|
||||
|
||||
limit := req.PageSize
|
||||
offset := req.PageSize * (req.PageNum - 1)
|
||||
var list []*types.TaskModel
|
||||
|
||||
// 构建数据库查询
|
||||
db := l.svcCtx.DbEngin.Model(&types.TaskModel{}).Table("task")
|
||||
|
||||
db = db.Where("deleted_at is null")
|
||||
if req.Name != "" {
|
||||
db = db.Where("name LIKE ?", "%"+req.Name+"%")
|
||||
}
|
||||
if req.Type != "" {
|
||||
db = db.Where("adapter_type_dict = ?", req.Type)
|
||||
}
|
||||
// 计算总数
|
||||
var total int64
|
||||
if err := db.Count(&total).Error; err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
|
||||
// 运行卡时数
|
||||
|
||||
// 查询任务列表
|
||||
if err := db.Limit(limit).Offset(offset).Order("created_time desc").Find(&list).Error; err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
|
||||
// 填充响应数据
|
||||
res.List = &list
|
||||
res.PageSize = req.PageSize
|
||||
res.PageNum = req.PageNum
|
||||
res.Total = total
|
||||
|
||||
return res, nil
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog/log"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
"gorm.io/gorm"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type SyncResourceSpecLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewSyncResourceSpecLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SyncResourceSpecLogic {
|
||||
return &SyncResourceSpecLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *SyncResourceSpecLogic) SyncResourceSpec(req *types.SyncResourceReq) (resp *types.CommonResp, err error) {
|
||||
var mainSpec models.TResourceSpec
|
||||
if err := l.svcCtx.DbEngin.Where("id = ? AND deleted_at IS NULL", req.Id).
|
||||
First(&mainSpec).
|
||||
Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, errors.Errorf("资源规格不存在 (ID: %s)", req.Id)
|
||||
}
|
||||
return nil, errors.Wrapf(err, "查询资源规格失败 (ID: %s)", req.Id)
|
||||
}
|
||||
// 获取集群资源数据
|
||||
startTime := time.Now()
|
||||
compareLogic := NewCompareResourceSpecLogic(l.ctx, l.svcCtx)
|
||||
apiResources, err := compareLogic.FetchClusterResources(strconv.FormatInt(mainSpec.ClusterId, 10), mainSpec.Tag)
|
||||
log.Debug().Msgf("调用获取ai训练资源接口耗时: %v", time.Since(startTime))
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("同步集群资源失败")
|
||||
return nil, fmt.Errorf("同步集群资源失败,请稍后重试")
|
||||
}
|
||||
for _, response := range apiResources {
|
||||
// 转换API响应到数据库模型
|
||||
_, apiSpecs, err := compareLogic.processAPIResponse(response, req.UserId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 同步资源到数据库
|
||||
for _, spec := range apiSpecs {
|
||||
if spec.SourceKey == mainSpec.SourceKey {
|
||||
err := l.updateResource(&mainSpec, spec)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (l *SyncResourceSpecLogic) updateResource(existing *models.TResourceSpec, newSpec models.TResourceSpec) error {
|
||||
return l.svcCtx.DbEngin.Transaction(func(tx *gorm.DB) error {
|
||||
updates := map[string]interface{}{
|
||||
"type": newSpec.Type,
|
||||
"total_count": newSpec.TotalCount,
|
||||
"available_count": newSpec.AvailableCount,
|
||||
"change_type": ChangeTypeNormal,
|
||||
"update_time": time.Now(),
|
||||
}
|
||||
|
||||
if err := tx.Model(existing).Updates(updates).Error; err != nil {
|
||||
return fmt.Errorf("failed to update resource: %w", err)
|
||||
}
|
||||
|
||||
return l.syncBaseResources(tx, existing.Id, newSpec.BaseResourceSpecs, newSpec.Tag)
|
||||
})
|
||||
}
|
||||
|
||||
func (l *SyncResourceSpecLogic) syncBaseResources(tx *gorm.DB, specID int64, newResources []models.TBaseResourceSpec, tag string) error {
|
||||
// 处理基础资源更新
|
||||
var existingResources []models.TBaseResourceSpec
|
||||
if err := tx.Where("resource_spec_id = ?", specID).Find(&existingResources).Error; err != nil {
|
||||
return fmt.Errorf("failed to query base resources: %w", err)
|
||||
}
|
||||
|
||||
existingMap := make(map[string]models.TBaseResourceSpec)
|
||||
for _, r := range existingResources {
|
||||
key := resourceKey(r.Type, r.Name, tag)
|
||||
existingMap[key] = r
|
||||
}
|
||||
|
||||
// 处理更新和新增
|
||||
for i, newRes := range newResources {
|
||||
newRes.ResourceSpecId = specID
|
||||
key := resourceKey(newRes.Type, newRes.Name, tag)
|
||||
|
||||
if existing, exists := existingMap[key]; exists {
|
||||
newRes.Id = existing.Id
|
||||
newRes.CreateTime = existing.CreateTime
|
||||
if err := tx.Save(&newRes).Error; err != nil {
|
||||
return fmt.Errorf("failed to update base resource: %w", err)
|
||||
}
|
||||
} else {
|
||||
if err := tx.Create(&newRes).Error; err != nil {
|
||||
return fmt.Errorf("failed to create base resource: %w", err)
|
||||
}
|
||||
}
|
||||
newResources[i] = newRes
|
||||
}
|
||||
|
||||
// 处理删除
|
||||
currentIDs := make(map[int64]struct{})
|
||||
for _, r := range newResources {
|
||||
currentIDs[r.Id] = struct{}{}
|
||||
}
|
||||
|
||||
for _, existing := range existingResources {
|
||||
if _, exists := currentIDs[existing.Id]; !exists {
|
||||
if err := tx.Delete(&existing).Error; err != nil {
|
||||
return fmt.Errorf("failed to delete base resource: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
|
@ -61,7 +61,7 @@ func (l *TaskDetailsLogic) TaskDetails(req *types.FId) (resp *types.TaskDetailsR
|
|||
for _, sub := range subList {
|
||||
clusterIds = append(clusterIds, sub.ClusterId)
|
||||
}
|
||||
err = l.svcCtx.DbEngin.Table("t_cluster").Where("id in ?", clusterIds).Scan(&cList).Error
|
||||
err = l.svcCtx.DbEngin.Table("t_cluster").Select("id,adapter_id,name,nickname,description,create_time").Where("id in ?", clusterIds).Scan(&cList).Error
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
@ -70,3 +70,7 @@ func (l *TaskDetailsLogic) TaskDetails(req *types.FId) (resp *types.TaskDetailsR
|
|||
resp.SubTaskInfos = subList
|
||||
return
|
||||
}
|
||||
|
||||
func (l *TaskDetailsLogic) deployTaskDetail() {
|
||||
//l.svcCtx.Scheduler.AiStorages.GetInferDeployInstanceById()
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ func (l *TaskListLogic) TaskList(req *types.TaskListReq) (resp *types.TaskListRe
|
|||
|
||||
// 更新智算任务状态
|
||||
var ch = make(chan struct{})
|
||||
go l.updateAitaskStatus(tasks, ch)
|
||||
//go l.updateAitaskStatus(tasks, ch)
|
||||
|
||||
// 查询任务总数
|
||||
l.svcCtx.DbEngin.Model(&models.Task{}).Count(&resp.TotalCount)
|
||||
|
|
|
@ -2,47 +2,102 @@ package hpc
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-hpc/slurm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
)
|
||||
|
||||
type CancelJobLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
hpcService *service.HpcService
|
||||
}
|
||||
|
||||
type TaskHPCResult struct {
|
||||
ID uint `gorm:"column:id"` // 对应 t.id
|
||||
JobID string `gorm:"column:job_id"` // 对应 hpc.job_id
|
||||
AdapterId string `gorm:"column:adapter_id"` // 对应 hpc.adapter_id
|
||||
ClusterId string `gorm:"column:cluster_id"` // 对应 hpc.cluster_id
|
||||
}
|
||||
|
||||
func NewCancelJobLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CancelJobLogic {
|
||||
cache := make(map[string]interface{}, 10)
|
||||
hpcService, err := service.NewHpcService(&svcCtx.Config, svcCtx.Scheduler.HpcStorages, cache)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return &CancelJobLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
hpcService: hpcService,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CancelJobLogic) CancelJob(req *types.CancelJobReq) error {
|
||||
var clusterInfo *types.ClusterInfo
|
||||
tx := l.svcCtx.DbEngin.Raw("select * from t_cluster where id = ?", req.ClusterId).Scan(&clusterInfo)
|
||||
if tx.Error != nil {
|
||||
return tx.Error
|
||||
//var clusterInfo *types.ClusterInfo
|
||||
//tx := l.svcCtx.DbEngin.Raw("select * from t_cluster where id = ?", req.ClusterId).Scan(&clusterInfo)
|
||||
//if tx.Error != nil {
|
||||
// return tx.Error
|
||||
//}
|
||||
//// 查询p端调用地址
|
||||
//var adapterAddress string
|
||||
//l.svcCtx.DbEngin.Raw("SELECT server FROM `t_adapter` where id = ?", clusterInfo.AdapterId).Scan(&adapterAddress)
|
||||
//var jobResp slurm.GetJobResp
|
||||
//httpClient := resty.New().R()
|
||||
//_, err := httpClient.SetHeader("Content-Type", "application/json").
|
||||
// SetQueryParams(map[string]string{
|
||||
// "jobId": req.JobId,
|
||||
// "server": clusterInfo.Server,
|
||||
// "version": clusterInfo.Version,
|
||||
// "token": clusterInfo.Token,
|
||||
// "username": clusterInfo.Username,
|
||||
// }).
|
||||
// SetResult(&jobResp).
|
||||
// Delete(adapterAddress + "/api/v1/job/cancel")
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
//if len(jobResp.Errors) != 0 {
|
||||
// return errors.Errorf(jobResp.Errors[0].Description)
|
||||
//}
|
||||
//return nil
|
||||
var hpcR TaskHPCResult
|
||||
tx := l.svcCtx.DbEngin.Raw(
|
||||
"SELECT t.id, hpc.job_id ,hpc.adapter_id, hpc.cluster_id FROM task t "+
|
||||
"INNER JOIN task_hpc hpc ON t.id = hpc.task_id "+
|
||||
"WHERE adapter_type_dict = 2 AND t.id = ?",
|
||||
req.TaskId,
|
||||
).Scan(&hpcR).Error
|
||||
if tx != nil {
|
||||
return fmt.Errorf("数据库查询失败: %v", tx.Error)
|
||||
}
|
||||
client, err := slurm.NewClient(slurm.ClientOptions{
|
||||
URL: clusterInfo.Server,
|
||||
ClientVersion: clusterInfo.Version,
|
||||
RestUserName: clusterInfo.Username,
|
||||
Token: clusterInfo.Token})
|
||||
if hpcR.ID == 0 || hpcR.JobID == "" {
|
||||
return fmt.Errorf("作业不存在")
|
||||
}
|
||||
var adapterInfo types.AdapterInfo
|
||||
l.svcCtx.DbEngin.Raw("SELECT * FROM `t_adapter` where id = ?", hpcR.AdapterId).Scan(&adapterInfo)
|
||||
if adapterInfo.Id == "" {
|
||||
return fmt.Errorf("adapter not found")
|
||||
}
|
||||
// 取消作业
|
||||
err := l.hpcService.HpcExecutorAdapterMap[adapterInfo.Id].CancelTask(l.ctx, hpcR.JobID, hpcR.ClusterId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
job, err := client.Job(slurm.JobOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
// 更新数据库状态
|
||||
tx = l.svcCtx.DbEngin.Model(&types.Task{}).Where("id = ?", hpcR.ID).Update("status", "Canceled").Error
|
||||
if tx != nil {
|
||||
return fmt.Errorf("数据库更新失败: %v", tx.Error)
|
||||
}
|
||||
err = job.CancelJob(slurm.CancelJobReq{JobId: req.JobId})
|
||||
if err != nil {
|
||||
return err
|
||||
// 更新数据库状态
|
||||
tx = l.svcCtx.DbEngin.Model(&models.TaskHpc{}).Where("task_id = ?", hpcR.ID).Update("status", "Canceled").Error
|
||||
if tx != nil {
|
||||
return fmt.Errorf("数据库更新失败: %v", tx.Error)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -2,155 +2,362 @@ package hpc
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/go-resty/resty/v2"
|
||||
"fmt"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/zeromicro/go-zero/core/logc"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
clientCore "gitlink.org.cn/JointCloud/pcm-coordinator/client"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
v1 "gitlink.org.cn/JointCloud/pcm-hpc/routers/v1"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"text/template"
|
||||
"time"
|
||||
)
|
||||
|
||||
type CommitHpcTaskLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
hpcService *service.HpcService
|
||||
}
|
||||
|
||||
const (
|
||||
statusSaved = "Saved"
|
||||
statusDeploying = "Deploying"
|
||||
adapterTypeHPC = "2"
|
||||
)
|
||||
|
||||
type JobRequest struct {
|
||||
App string `json:"app"`
|
||||
Common CommonParams `json:"common"`
|
||||
AppSpecific map[string]interface{} `json:"appSpecific"`
|
||||
}
|
||||
type CommonParams struct {
|
||||
JobName string `json:"jobName"`
|
||||
Partition string `json:"partition"`
|
||||
Nodes string `json:"nodes"`
|
||||
NTasks string `json:"ntasks"`
|
||||
Time string `json:"time,omitempty"`
|
||||
App string `json:"app"`
|
||||
}
|
||||
|
||||
func NewCommitHpcTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommitHpcTaskLogic {
|
||||
cache := make(map[string]interface{}, 10)
|
||||
hpcService, err := service.NewHpcService(&svcCtx.Config, svcCtx.Scheduler.HpcStorages, cache)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return &CommitHpcTaskLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
hpcService: hpcService,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *types.CommitHpcTaskResp, err error) {
|
||||
// 新增:缓存模板对象
|
||||
var templateCache = sync.Map{}
|
||||
|
||||
func (l *CommitHpcTaskLogic) getClusterInfo(clusterID string) (*types.ClusterInfo, *types.AdapterInfo, error) {
|
||||
var clusterInfo types.ClusterInfo
|
||||
l.svcCtx.DbEngin.Raw("SELECT * FROM `t_cluster` where id = ?", req.ClusterId).First(&clusterInfo)
|
||||
|
||||
if len(clusterInfo.Id) == 0 {
|
||||
return resp, errors.New("cluster not found")
|
||||
if err := l.svcCtx.DbEngin.Table("t_cluster").Where("id = ?", clusterID).First(&clusterInfo).Error; err != nil {
|
||||
return nil, nil, fmt.Errorf("cluster query failed: %w", err)
|
||||
}
|
||||
|
||||
// 构建主任务结构体
|
||||
if clusterInfo.Id == "" {
|
||||
return nil, nil, errors.New("cluster not found")
|
||||
}
|
||||
|
||||
var adapterInfo types.AdapterInfo
|
||||
if err := l.svcCtx.DbEngin.Table("t_adapter").Where("id = ?", clusterInfo.AdapterId).First(&adapterInfo).Error; err != nil {
|
||||
return nil, nil, fmt.Errorf("adapter query failed: %w", err)
|
||||
}
|
||||
|
||||
if adapterInfo.Id == "" {
|
||||
return nil, nil, errors.New("adapter not found")
|
||||
}
|
||||
|
||||
return &clusterInfo, &adapterInfo, nil
|
||||
}
|
||||
|
||||
// 自定义函数映射
|
||||
func createFuncMap() template.FuncMap {
|
||||
return template.FuncMap{
|
||||
"regexMatch": regexMatch,
|
||||
"required": required,
|
||||
"error": errorHandler,
|
||||
"default": defaultHandler,
|
||||
}
|
||||
}
|
||||
func extractUserError(originalErr error) error {
|
||||
// 尝试匹配模板引擎返回的错误格式
|
||||
re := regexp.MustCompile(`error calling \w+: (.*)$`)
|
||||
matches := re.FindStringSubmatch(originalErr.Error())
|
||||
if len(matches) > 1 {
|
||||
return errors.New(matches[1])
|
||||
}
|
||||
return originalErr
|
||||
}
|
||||
|
||||
// 正则匹配函数
|
||||
func regexMatch(pattern string) *regexp.Regexp {
|
||||
return regexp.MustCompile(pattern)
|
||||
}
|
||||
|
||||
// 必填字段检查
|
||||
func required(msg string, val interface{}) (interface{}, error) {
|
||||
if val == nil || val == "" {
|
||||
return nil, errors.New(msg)
|
||||
}
|
||||
return val, nil
|
||||
}
|
||||
|
||||
// 错误处理函数
|
||||
func errorHandler(msg string) (string, error) {
|
||||
return "", errors.New(msg)
|
||||
}
|
||||
|
||||
// 默认值处理函数
|
||||
func defaultHandler(defaultVal interface{}, val interface{}) interface{} {
|
||||
switch v := val.(type) {
|
||||
case nil:
|
||||
return defaultVal
|
||||
case string:
|
||||
if v == "" {
|
||||
return defaultVal
|
||||
}
|
||||
case int:
|
||||
if v == 0 {
|
||||
return defaultVal
|
||||
}
|
||||
// 可根据需要添加其他类型判断
|
||||
}
|
||||
return val
|
||||
}
|
||||
func (l *CommitHpcTaskLogic) RenderJobScript(templateContent string, req *JobRequest) (string, error) {
|
||||
// 使用缓存模板
|
||||
tmpl, ok := templateCache.Load(templateContent)
|
||||
if !ok {
|
||||
parsedTmpl, err := template.New("slurmTemplate").Funcs(createFuncMap()).Parse(templateContent)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
templateCache.Store(templateContent, parsedTmpl)
|
||||
tmpl = parsedTmpl
|
||||
}
|
||||
|
||||
params := map[string]interface{}{
|
||||
"Common": req.Common,
|
||||
"App": req.AppSpecific,
|
||||
}
|
||||
|
||||
var buf strings.Builder
|
||||
if err := tmpl.(*template.Template).Execute(&buf, params); err != nil {
|
||||
log.Error().Err(err).Msg("模板渲染失败")
|
||||
return "", extractUserError(err)
|
||||
}
|
||||
return buf.String(), nil
|
||||
}
|
||||
|
||||
func ConvertToJobRequest(job *types.CommitHpcTaskReq) (JobRequest, error) {
|
||||
required := []string{"jobName", "nodes", "ntasks"}
|
||||
for _, field := range required {
|
||||
if job.Parameters[field] == "" {
|
||||
return JobRequest{}, fmt.Errorf("%s is empty", field)
|
||||
}
|
||||
}
|
||||
|
||||
return JobRequest{
|
||||
App: job.App,
|
||||
Common: CommonParams{
|
||||
JobName: job.Parameters["jobName"],
|
||||
Partition: job.Parameters["partition"],
|
||||
Nodes: job.Parameters["nodes"],
|
||||
NTasks: job.Parameters["ntasks"],
|
||||
Time: job.Parameters["time"],
|
||||
App: job.App,
|
||||
},
|
||||
AppSpecific: utils.MpaStringToInterface(job.Parameters),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (l *CommitHpcTaskLogic) SaveHpcTaskToDB(req *types.CommitHpcTaskReq, jobScript, jobId, workDir string) (taskId string, err error) {
|
||||
// 使用事务确保数据一致性
|
||||
tx := l.svcCtx.DbEngin.Begin()
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
tx.Rollback()
|
||||
err = fmt.Errorf("transaction panic: %v", r)
|
||||
} else if err != nil {
|
||||
tx.Rollback()
|
||||
}
|
||||
}()
|
||||
|
||||
userID, _ := strconv.ParseInt(req.Parameters["UserId"], 10, 64)
|
||||
taskID := utils.GenSnowflakeID()
|
||||
taskModel := models.Task{
|
||||
Id: taskID,
|
||||
Name: req.Name,
|
||||
Description: req.Description,
|
||||
CommitTime: time.Now(),
|
||||
Status: "Running",
|
||||
AdapterTypeDict: "2",
|
||||
Status: statusSaved,
|
||||
AdapterTypeDict: adapterTypeHPC,
|
||||
UserId: userID,
|
||||
}
|
||||
|
||||
// 保存任务数据到数据库
|
||||
tx := l.svcCtx.DbEngin.Create(&taskModel)
|
||||
if tx.Error != nil {
|
||||
return nil, tx.Error
|
||||
if err = tx.Table("task").Create(&taskModel).Error; err != nil {
|
||||
return "", fmt.Errorf("failed to create task: %w", err)
|
||||
}
|
||||
|
||||
var adapterName string
|
||||
l.svcCtx.DbEngin.Raw("SELECT name FROM `t_adapter` where id = ?", clusterInfo.AdapterId).Scan(&adapterName)
|
||||
var server string
|
||||
l.svcCtx.DbEngin.Raw("SELECT server FROM `t_adapter` where id = ?", clusterInfo.AdapterId).Scan(&server)
|
||||
if len(adapterName) == 0 || adapterName == "" {
|
||||
return nil, errors.New("no corresponding adapter found")
|
||||
clusterInfo, adapterInfo, err := l.getClusterInfo(req.ClusterId)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
clusterId, err := strconv.ParseInt(req.ClusterId, 10, 64)
|
||||
hpcInfo := models.TaskHpc{
|
||||
TaskId: taskModel.Id,
|
||||
|
||||
paramsJSON, err := jsoniter.MarshalToString(req)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to marshal parameters: %w", err)
|
||||
}
|
||||
|
||||
clusterID := utils.StringToInt64(clusterInfo.Id)
|
||||
hpcTask := models.TaskHpc{
|
||||
Id: utils.GenSnowflakeID(),
|
||||
TaskId: taskID,
|
||||
AdapterId: clusterInfo.AdapterId,
|
||||
AdapterName: adapterName,
|
||||
ClusterId: clusterId,
|
||||
AdapterName: adapterInfo.Name,
|
||||
ClusterId: clusterID,
|
||||
ClusterName: clusterInfo.Name,
|
||||
Name: taskModel.Name,
|
||||
CmdScript: req.CmdScript,
|
||||
StartTime: time.Now().String(),
|
||||
CardCount: req.CardCount,
|
||||
WorkDir: req.WorkDir,
|
||||
WallTime: req.WallTime,
|
||||
AppType: req.AppType,
|
||||
AppName: req.AppName,
|
||||
Queue: req.Queue,
|
||||
SubmitType: req.SubmitType,
|
||||
NNode: req.NNode,
|
||||
Backend: req.Backend,
|
||||
OperateType: req.OperateType,
|
||||
CmdScript: req.Parameters["cmdScript"],
|
||||
WallTime: req.Parameters["wallTime"],
|
||||
AppType: req.Parameters["appType"],
|
||||
AppName: req.App,
|
||||
Queue: req.Parameters["queue"],
|
||||
SubmitType: req.Parameters["submitType"],
|
||||
NNode: req.Parameters["nNode"],
|
||||
Account: clusterInfo.Username,
|
||||
StdInput: req.StdInput,
|
||||
Partition: req.Partition,
|
||||
StdInput: req.Parameters["stdInput"],
|
||||
Partition: req.Parameters["partition"],
|
||||
CreatedTime: time.Now(),
|
||||
UpdatedTime: time.Now(),
|
||||
Status: "Running",
|
||||
Status: statusDeploying,
|
||||
UserId: userID,
|
||||
Params: paramsJSON,
|
||||
Script: jobScript,
|
||||
JobId: jobId,
|
||||
WorkDir: workDir,
|
||||
}
|
||||
hpcInfo.WorkDir = clusterInfo.WorkDir + req.WorkDir
|
||||
tx = l.svcCtx.DbEngin.Create(&hpcInfo)
|
||||
if tx.Error != nil {
|
||||
return nil, tx.Error
|
||||
|
||||
if err = tx.Table("task_hpc").Create(&hpcTask).Error; err != nil {
|
||||
return "", fmt.Errorf("failed to create HPC task: %w", err)
|
||||
}
|
||||
// 提交job到指定集群
|
||||
logx.Info("提交job到指定集群")
|
||||
jobId, err := submitJob(&hpcInfo, &clusterInfo, server)
|
||||
logx.Info("提交job到指定集群完成")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 保存操作记录
|
||||
|
||||
noticeInfo := clientCore.NoticeInfo{
|
||||
AdapterId: clusterInfo.AdapterId,
|
||||
AdapterName: adapterName,
|
||||
ClusterId: clusterId,
|
||||
AdapterName: adapterInfo.Name,
|
||||
ClusterId: clusterID,
|
||||
ClusterName: clusterInfo.Name,
|
||||
NoticeType: "create",
|
||||
TaskName: req.Name,
|
||||
TaskId: taskID,
|
||||
Incident: "任务创建中",
|
||||
CreatedTime: time.Now(),
|
||||
}
|
||||
result := l.svcCtx.DbEngin.Table("t_notice").Create(¬iceInfo)
|
||||
if result.Error != nil {
|
||||
logx.Errorf("Task creation failure, err: %v", result.Error)
|
||||
}
|
||||
resp = &types.CommitHpcTaskResp{
|
||||
JobId: string(jobId),
|
||||
|
||||
if err = tx.Table("t_notice").Create(¬iceInfo).Error; err != nil {
|
||||
return "", fmt.Errorf("failed to create notice: %w", err)
|
||||
}
|
||||
|
||||
if err = tx.Commit().Error; err != nil {
|
||||
return "", fmt.Errorf("transaction commit failed: %w", err)
|
||||
}
|
||||
|
||||
return utils.Int64ToString(taskID), nil
|
||||
}
|
||||
|
||||
func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *types.CommitHpcTaskResp, err error) {
|
||||
reqJSON, err := jsoniter.MarshalToString(req)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to marshal request: %w", err)
|
||||
}
|
||||
logc.Infof(l.ctx, "提交超算任务请求参数: %s", reqJSON)
|
||||
|
||||
jobName := generateJobName(req)
|
||||
req.Parameters["jobName"] = jobName
|
||||
|
||||
// 获取集群和适配器信息
|
||||
clusterInfo, adapterInfo, err := l.getClusterInfo(req.ClusterId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
scriptContent := req.ScriptContent
|
||||
if scriptContent == "" {
|
||||
// 获取模板
|
||||
var templateInfo types.HpcAppTemplateInfo
|
||||
tx := l.svcCtx.DbEngin.Table("hpc_app_template").
|
||||
Where("cluster_id = ? and app = ? ", req.ClusterId, req.App)
|
||||
if req.OperateType != "" {
|
||||
tx.Where("app_type = ?", req.OperateType)
|
||||
}
|
||||
if err := tx.First(&templateInfo).Error; err != nil {
|
||||
return nil, fmt.Errorf("获取HPC应用【%s】模板失败: %w", req.App, err)
|
||||
}
|
||||
|
||||
// 转换请求参数
|
||||
jobRequest, err := ConvertToJobRequest(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 渲染脚本
|
||||
script, err := l.RenderJobScript(templateInfo.Content, &jobRequest)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
scriptContent = script
|
||||
}
|
||||
|
||||
q, _ := jsoniter.MarshalToString(scriptContent)
|
||||
submitQ := types.SubmitHpcTaskReq{
|
||||
App: req.App,
|
||||
ClusterId: req.ClusterId,
|
||||
JobName: jobName,
|
||||
ScriptContent: scriptContent,
|
||||
Parameters: req.Parameters,
|
||||
Backend: req.Backend,
|
||||
}
|
||||
log.Info().Msgf("Submitting HPC task to cluster %s with params: %s", clusterInfo.Name, q)
|
||||
resp, err = l.hpcService.HpcExecutorAdapterMap[adapterInfo.Id].SubmitTask(l.ctx, submitQ)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("提交超算任务失败, cluster: %s, jobName: %s, scriptContent: %s", clusterInfo.Name, jobName, scriptContent)
|
||||
return nil, fmt.Errorf("网络请求失败,请稍后重试")
|
||||
}
|
||||
|
||||
jobID := resp.Data.JobInfo["jobId"]
|
||||
workDir := resp.Data.JobInfo["jobDir"]
|
||||
taskID, err := l.SaveHpcTaskToDB(req, scriptContent, jobID, workDir)
|
||||
if err != nil {
|
||||
log.Error().Msgf("超算任务保存到数据库失败, cluster: %s, jobName: %s, scriptContent: %s, error: %v", clusterInfo.Name, jobName, scriptContent, err)
|
||||
return nil, fmt.Errorf("保存超算任务到数据库失败: %w", err)
|
||||
}
|
||||
|
||||
resp.Data.JobInfo["taskId"] = taskID
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func submitJob(hpcInfo *models.TaskHpc, clusterInfo *types.ClusterInfo, adapterAddress string) (int, error) {
|
||||
SubmitJobReq := v1.SubmitJobReq{
|
||||
Server: clusterInfo.Server,
|
||||
Version: clusterInfo.Version,
|
||||
Username: clusterInfo.Username,
|
||||
Token: clusterInfo.Token,
|
||||
JobOptions: v1.JobOptions{
|
||||
Script: hpcInfo.CmdScript,
|
||||
Job: &v1.JobProperties{
|
||||
Account: hpcInfo.Account,
|
||||
Name: hpcInfo.Name,
|
||||
NTasks: 1,
|
||||
CurrentWorkingDirectory: hpcInfo.WorkDir,
|
||||
Partition: hpcInfo.Partition,
|
||||
Environment: map[string]string{"PATH": clusterInfo.EnvPath,
|
||||
"LD_LIBRARY_PATH": clusterInfo.EnvLdPath},
|
||||
StandardOutput: hpcInfo.WorkDir + "/%j.out",
|
||||
StandardError: hpcInfo.WorkDir + "/%j.err",
|
||||
},
|
||||
},
|
||||
func generateJobName(req *types.CommitHpcTaskReq) string {
|
||||
if req.OperateType == "" {
|
||||
return req.Name
|
||||
}
|
||||
var resp v1.SubmitJobResp
|
||||
httpClient := resty.New().R()
|
||||
logx.Info("远程调用p端接口开始")
|
||||
_, err := httpClient.SetHeader("Content-Type", "application/json").
|
||||
SetBody(SubmitJobReq).
|
||||
SetResult(&resp).
|
||||
Post(adapterAddress + "/api/v1/job/submit")
|
||||
logx.Info("远程调用p端接口完成")
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return resp.JobId, nil
|
||||
return req.Name + "_" + req.OperateType
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package hpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/rs/zerolog/log"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetHpcAppClusterLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewGetHpcAppClusterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetHpcAppClusterLogic {
|
||||
return &GetHpcAppClusterLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
type ClusterInfo struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Nickname string `json:"nickname"`
|
||||
Region string `json:"region"`
|
||||
}
|
||||
|
||||
func (l *GetHpcAppClusterLogic) GetHpcAppCluster(req *types.HpcAppClusterReq) (resp *types.ListResult, err error) {
|
||||
resp = &types.ListResult{}
|
||||
var clusterIds []string
|
||||
err = l.svcCtx.DbEngin.Table("hpc_app_template").Distinct("cluster_id").
|
||||
Where(" app = ? and status = 1 and deleted_at is null", req.App).
|
||||
Find(&clusterIds).Error
|
||||
if err != nil {
|
||||
log.Error().Msgf("获取HPC应用集群失败: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var listCluster []ClusterInfo
|
||||
err = l.svcCtx.DbEngin.Table("t_cluster").Where("id in (?)", clusterIds).Scan(&listCluster).Error
|
||||
if err != nil {
|
||||
log.Error().Msgf("获取集群信息失败: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
resp.List = listCluster
|
||||
return
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package hpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetHpcTaskLogLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
hpcService *service.HpcService
|
||||
}
|
||||
|
||||
// 超算任务日志
|
||||
func NewGetHpcTaskLogLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetHpcTaskLogLogic {
|
||||
cache := make(map[string]interface{}, 10)
|
||||
hpcService, err := service.NewHpcService(&svcCtx.Config, svcCtx.Scheduler.HpcStorages, cache)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return &GetHpcTaskLogLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
hpcService: hpcService,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetHpcTaskLogLogic) GetHpcTaskLog(req *types.HpcTaskLogReq) (resp interface{}, err error) {
|
||||
var hpcR TaskHPCResult
|
||||
tx := l.svcCtx.DbEngin.Raw(
|
||||
"SELECT t.id, hpc.job_id ,hpc.adapter_id ,hpc.cluster_id FROM task t "+
|
||||
"INNER JOIN task_hpc hpc ON t.id = hpc.task_id "+
|
||||
"WHERE adapter_type_dict = 2 AND t.id = ?",
|
||||
req.TaskId,
|
||||
).Scan(&hpcR).Error
|
||||
if tx != nil {
|
||||
return nil, fmt.Errorf("数据库查询失败: %v", tx.Error)
|
||||
}
|
||||
if hpcR.ID == 0 {
|
||||
return nil, fmt.Errorf("任务不存在")
|
||||
}
|
||||
var adapterInfo types.AdapterInfo
|
||||
l.svcCtx.DbEngin.Raw("SELECT * FROM `t_adapter` where id = ?", hpcR.AdapterId).Scan(&adapterInfo)
|
||||
if adapterInfo.Id == "" {
|
||||
return nil, fmt.Errorf("adapter not found")
|
||||
}
|
||||
// 取消作业
|
||||
resp, err = l.hpcService.HpcExecutorAdapterMap[adapterInfo.Id].GetTaskLogs(l.ctx, hpcR.JobID, hpcR.ClusterId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
|
@ -2,11 +2,11 @@ package hpc
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/go-resty/resty/v2"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-hpc/slurm"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-hpc/slurm"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
@ -32,20 +32,24 @@ func (l *JobInfoLogic) JobInfo(req *types.JobInfoReq) (resp *types.JobInfoResp,
|
|||
if tx.Error != nil {
|
||||
return nil, tx.Error
|
||||
}
|
||||
client, err := slurm.NewClient(slurm.ClientOptions{
|
||||
URL: clusterInfo.Server,
|
||||
ClientVersion: clusterInfo.Version,
|
||||
RestUserName: clusterInfo.Username,
|
||||
Token: clusterInfo.Token})
|
||||
// 查询p端调用地址
|
||||
var adapterAddress string
|
||||
l.svcCtx.DbEngin.Raw("SELECT server FROM `t_adapter` where id = ?", clusterInfo.AdapterId).Scan(&adapterAddress)
|
||||
var jobResp slurm.GetJobResp
|
||||
httpClient := resty.New().R()
|
||||
_, err = httpClient.SetHeader("Content-Type", "application/json").
|
||||
SetQueryParams(map[string]string{
|
||||
"jobId": req.JobId,
|
||||
"server": clusterInfo.Server,
|
||||
"version": clusterInfo.Version,
|
||||
"token": clusterInfo.Token,
|
||||
"username": clusterInfo.Username,
|
||||
}).
|
||||
SetResult(&jobResp).
|
||||
Get(adapterAddress + "/api/v1/job/info")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
job, err := client.Job(slurm.JobOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
jobResp, _ := job.GetJob(slurm.GetJobReq{JobId: req.JobId})
|
||||
|
||||
if len(jobResp.Errors) != 0 {
|
||||
return nil, errors.Errorf(jobResp.Errors[0].Description)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
package hpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
)
|
||||
|
||||
type ListInstanceCenterLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewListInstanceCenterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListInstanceCenterLogic {
|
||||
return &ListInstanceCenterLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListInstanceCenterLogic) ListInstanceCenter(req *types.HpcInstanceCenterReq) (resp *types.PageResult, err error) {
|
||||
limit := req.PageSize
|
||||
offset := req.PageSize * (req.PageNum - 1)
|
||||
resp = &types.PageResult{}
|
||||
var list *[]models.HpcInstanceCenter
|
||||
db := l.svcCtx.DbEngin.Model(&models.HpcInstanceCenter{}).Table("hpc_instance_center")
|
||||
|
||||
if req.InstanceName != "" {
|
||||
db = db.Where("instance_name like ?", "%"+req.InstanceName+"%")
|
||||
}
|
||||
|
||||
if req.InstanceType != 0 {
|
||||
db = db.Where("instance_type = ?", req.InstanceType)
|
||||
}
|
||||
|
||||
if req.InstanceClass != "" {
|
||||
db = db.Where("instance_class = ?", req.InstanceClass)
|
||||
}
|
||||
var total int64
|
||||
err = db.Count(&total).Error
|
||||
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
db = db.Where("deleted_at is null").Limit(limit).Offset(offset)
|
||||
err = db.Order("created_at desc").Find(&list).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.List = list
|
||||
resp.PageSize = req.PageSize
|
||||
resp.PageNum = req.PageNum
|
||||
resp.Total = total
|
||||
return
|
||||
}
|
|
@ -50,7 +50,7 @@ func (l *CreateDeployTaskLogic) CreateDeployTask(req *types.CreateDeployTaskReq)
|
|||
return nil, errors.New("TaskName already exists")
|
||||
}
|
||||
|
||||
taskId, err := l.svcCtx.Scheduler.AiStorages.SaveInferDeployTask(req.TaskName, req.ModelName, req.ModelType, req.TaskDesc)
|
||||
taskId, err := l.svcCtx.Scheduler.AiStorages.SaveInferDeployTask(req.TaskName, 0, req.ModelName, req.ModelType, req.TaskDesc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,354 @@
|
|||
package inference
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/entity"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/schedulers/option"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/utils/status"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/utils/task"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/strategy"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateInferenceTaskLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCreateInferenceTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateInferenceTaskLogic {
|
||||
return &CreateInferenceTaskLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
const AdapterId = "1777144940459986944"
|
||||
|
||||
func (l *CreateInferenceTaskLogic) CreateInferenceTask(req *types.CreateInferenceTaskReq) (resp *types.CreateInferenceTaskResp, err error) {
|
||||
resp = &types.CreateInferenceTaskResp{}
|
||||
|
||||
err = task.ValidateJobResources(req.JobResources, "inference")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
clusters, err := generateClustersForTaskCreation(req.DataDistributes, req.Name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
modelName, err := generateModelName(clusters)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
taskName, err := l.svcCtx.Scheduler.AiService.HandleDuplicateTaskName(req.Name, "inference")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
assignedClusters := task.CopyParams(clusters, req.JobResources.Clusters, "inference")
|
||||
|
||||
opt := &option.InferOption{
|
||||
TaskName: taskName,
|
||||
TaskDesc: req.Description,
|
||||
ModelType: "",
|
||||
ModelName: modelName,
|
||||
Cmd: "",
|
||||
}
|
||||
|
||||
taskId, err := l.svcCtx.Scheduler.AiStorages.SaveInferDeployTask(taskName, req.UserId, modelName, "", req.Description)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
adapterClusterMap := make(map[string][]*strategy.AssignedCluster)
|
||||
adapterClusterMap[AdapterId] = assignedClusters
|
||||
|
||||
err = l.createInferenceTask(taskId, adapterClusterMap, opt)
|
||||
if err != nil {
|
||||
if len(assignedClusters) != 0 {
|
||||
_ = status.ReportInferenceStatusMessages(l.svcCtx, nil, taskName, strconv.FormatInt(taskId, 10), assignedClusters[0].ClusterId, "", false, "")
|
||||
logx.Errorf("############ Report Infer Task Status Message Error %s", err.Error())
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp.TaskId = strconv.FormatInt(taskId, 10)
|
||||
resp.TaskName = taskName
|
||||
return
|
||||
}
|
||||
|
||||
func (l *CreateInferenceTaskLogic) createInferenceTask(taskId int64, adapterClusterMap map[string][]*strategy.AssignedCluster, option *option.InferOption) error {
|
||||
var clusterlen int
|
||||
for _, c := range adapterClusterMap {
|
||||
clusterlen += len(c)
|
||||
}
|
||||
var errCh = make(chan interface{}, clusterlen)
|
||||
var errs []interface{}
|
||||
|
||||
buf := make(chan bool, 2)
|
||||
var wg sync.WaitGroup
|
||||
for aid, v := range adapterClusterMap {
|
||||
for _, c := range v {
|
||||
wg.Add(1)
|
||||
cluster := c
|
||||
buf <- true
|
||||
go func() {
|
||||
opt, _ := cloneOption(option)
|
||||
|
||||
updateInferOption(cluster, opt)
|
||||
|
||||
err := l.createDeployInstance(taskId, aid, cluster.ClusterId, opt)
|
||||
if err != nil {
|
||||
e := struct {
|
||||
err error
|
||||
clusterId string
|
||||
}{
|
||||
err: err,
|
||||
clusterId: cluster.ClusterId,
|
||||
}
|
||||
errCh <- e
|
||||
wg.Done()
|
||||
<-buf
|
||||
return
|
||||
}
|
||||
wg.Done()
|
||||
<-buf
|
||||
}()
|
||||
}
|
||||
}
|
||||
wg.Wait()
|
||||
close(errCh)
|
||||
|
||||
for e := range errCh {
|
||||
errs = append(errs, e)
|
||||
}
|
||||
|
||||
if len(errs) != 0 {
|
||||
var msg string
|
||||
for _, err := range errs {
|
||||
e := (err).(struct {
|
||||
err error
|
||||
clusterId string
|
||||
})
|
||||
|
||||
clusterName, err := l.svcCtx.Scheduler.AiStorages.GetClusterNameById(e.clusterId)
|
||||
if err != nil {
|
||||
clusterName = e.clusterId
|
||||
}
|
||||
|
||||
msg += fmt.Sprintf("CreateInstance Failed # clusterName: %v, error: %v \n", clusterName, e.err.Error())
|
||||
|
||||
}
|
||||
return errors.New(msg)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func updateInferOption(cluster *strategy.AssignedCluster, opt *option.InferOption) {
|
||||
opt.Cmd = cluster.Cmd
|
||||
opt.Envs = cluster.Envs
|
||||
opt.Params = cluster.Params
|
||||
|
||||
opt.ImageId = cluster.ImageId
|
||||
opt.AlgorithmId = cluster.CodeId
|
||||
opt.ModelID = cluster.ModelId
|
||||
|
||||
opt.ResourcesRequired = cluster.ResourcesRequired
|
||||
|
||||
opt.Output = cluster.Output
|
||||
}
|
||||
|
||||
func generateClustersForTaskCreation(distributes types.DataDistribute, taskName string) ([]*strategy.AssignedCluster, error) {
|
||||
var assignedClusters []*strategy.AssignedCluster
|
||||
clusterMap := make(map[string]*strategy.AssignedCluster)
|
||||
|
||||
for _, distribute := range distributes.Code {
|
||||
if len(distribute.Clusters) == 0 {
|
||||
return nil, fmt.Errorf("Code distribute: must specify at least one cluster")
|
||||
}
|
||||
for _, c := range distribute.Clusters {
|
||||
if c.ClusterID == "" {
|
||||
return nil, fmt.Errorf("Code distribute: clusterId can not be empty")
|
||||
}
|
||||
cluster := &strategy.AssignedCluster{}
|
||||
cluster.ClusterId = c.ClusterID
|
||||
|
||||
jsonData := entity.JsonData{}
|
||||
err := json.Unmarshal([]byte(c.JsonData), &jsonData)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("jsonData convert failed, task %d, cluster %s, datatype: %s", taskName, c.ClusterID, "Code")
|
||||
}
|
||||
if jsonData.Id == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
cluster.CodeId = jsonData.Id
|
||||
clusterMap[c.ClusterID] = cluster
|
||||
}
|
||||
}
|
||||
|
||||
for _, distribute := range distributes.Model {
|
||||
if len(distribute.Clusters) == 0 {
|
||||
return nil, fmt.Errorf("Model distribute: must specify at least one cluster")
|
||||
}
|
||||
|
||||
for _, c := range distribute.Clusters {
|
||||
if c.ClusterID == "" {
|
||||
return nil, fmt.Errorf("Model distribute: clusterId can not be empty")
|
||||
}
|
||||
|
||||
jsonData := entity.JsonData{}
|
||||
err := json.Unmarshal([]byte(c.JsonData), &jsonData)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("jsonData convert failed, task %d, cluster %s, datatype: %s", taskName, c.ClusterID, "Model")
|
||||
}
|
||||
if jsonData.Id == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
cluster, ok := clusterMap[c.ClusterID]
|
||||
if ok {
|
||||
cluster.ModelId = jsonData.Id
|
||||
cluster.ModelName = jsonData.Name
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for _, distribute := range distributes.Image {
|
||||
if len(distribute.Clusters) == 0 {
|
||||
return nil, fmt.Errorf("Image distribute: must specify at least one cluster")
|
||||
}
|
||||
for _, c := range distribute.Clusters {
|
||||
if c.ClusterID == "" {
|
||||
return nil, fmt.Errorf("Image distribute: clusterId can not be empty")
|
||||
}
|
||||
|
||||
jsonData := entity.JsonData{}
|
||||
err := json.Unmarshal([]byte(c.JsonData), &jsonData)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("jsonData convert failed, task %d, cluster %s, datatype: %s", taskName, c.ClusterID, "Image")
|
||||
}
|
||||
|
||||
if jsonData.Id == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
cluster, ok := clusterMap[c.ClusterID]
|
||||
if ok {
|
||||
cluster.ImageId = jsonData.Id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, c := range clusterMap {
|
||||
if c.ModelId == "" {
|
||||
return nil, fmt.Errorf("create inference task failed, cluster %s, empty data : %s", c.ClusterId, "ModelId")
|
||||
}
|
||||
|
||||
if c.CodeId == "" {
|
||||
return nil, fmt.Errorf("create inference task failed, cluster %s, empty data : %s", c.ClusterId, "CodeId")
|
||||
}
|
||||
|
||||
if c.ImageId == "" {
|
||||
return nil, fmt.Errorf("create inference task failed, cluster %s, empty data : %s", c.ClusterId, "ImageId")
|
||||
}
|
||||
|
||||
assignedClusters = append(assignedClusters, c)
|
||||
}
|
||||
|
||||
if len(assignedClusters) == 0 {
|
||||
return nil, fmt.Errorf("no code provided")
|
||||
}
|
||||
|
||||
return assignedClusters, nil
|
||||
}
|
||||
|
||||
func generateModelName(clusters []*strategy.AssignedCluster) (string, error) {
|
||||
if len(clusters) == 1 {
|
||||
return clusters[0].ModelName, nil
|
||||
}
|
||||
|
||||
var modelName string
|
||||
for _, c := range clusters {
|
||||
modelName += c.ModelName + ","
|
||||
}
|
||||
|
||||
modelName = strings.TrimSuffix(modelName, ",")
|
||||
return modelName, nil
|
||||
}
|
||||
|
||||
func (l *CreateInferenceTaskLogic) createDeployInstance(taskId int64, adapterId string, clusterId string, opt *option.InferOption) error {
|
||||
cmap, found := l.svcCtx.Scheduler.AiService.InferenceAdapterMap[adapterId]
|
||||
if !found {
|
||||
return errors.New("adapterId not exist: " + adapterId)
|
||||
}
|
||||
iCluster, found := cmap[clusterId]
|
||||
if !found {
|
||||
return errors.New("clusterId not exist: " + clusterId)
|
||||
}
|
||||
insId, err := iCluster.CreateInferDeployInstance(l.ctx, opt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
aid, err := strconv.ParseInt(adapterId, 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cid, err := strconv.ParseInt(clusterId, 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
adapterName, err := l.svcCtx.Scheduler.AiStorages.GetAdapterNameById(adapterId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
clusterName, err := l.svcCtx.Scheduler.AiStorages.GetClusterNameById(clusterId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ins, err := iCluster.GetInferDeployInstance(l.ctx, insId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = l.svcCtx.Scheduler.AiStorages.SaveInferDeployInstance(taskId, ins.InstanceId, ins.InstanceName, aid, adapterName, cid, clusterName, ins.ModelName, ins.ModelType, ins.InferCard, ins.ClusterType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func cloneOption(opt *option.InferOption) (*option.InferOption, error) {
|
||||
origJSON, err := json.Marshal(opt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
clone := option.InferOption{}
|
||||
if err = json.Unmarshal(origJSON, &clone); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &clone, nil
|
||||
}
|
|
@ -5,7 +5,6 @@ import (
|
|||
"errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/common"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/utils/status"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
|
@ -32,6 +31,9 @@ func (l *DeployInstanceListLogic) DeployInstanceList(req *types.DeployInstanceLi
|
|||
|
||||
var tasklist []*models.AiDeployInstanceTask
|
||||
tx := l.svcCtx.DbEngin.Raw("select * from ai_deploy_instance_task").Scan(&tasklist)
|
||||
if req.UserName != "" && req.UserName != "admin" {
|
||||
tx = tx.Where("user_id = ?", req.UserId)
|
||||
}
|
||||
if tx.Error != nil {
|
||||
logx.Errorf(tx.Error.Error())
|
||||
return nil, tx.Error
|
||||
|
@ -70,7 +72,7 @@ func (l *DeployInstanceListLogic) DeployInstanceList(req *types.DeployInstanceLi
|
|||
list := common.ConcatMultipleSlices(slices)
|
||||
|
||||
if len(list) != 0 {
|
||||
go status.UpdateDeployInstanceStatusBatch(l.svcCtx, list, true)
|
||||
go l.svcCtx.Scheduler.AiService.Si.UpdateDeployInstanceStatusBatch(list, true)
|
||||
}
|
||||
|
||||
resp.List = &deployTasks
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package inference
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetDeployInstanceLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewGetDeployInstanceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDeployInstanceLogic {
|
||||
return &GetDeployInstanceLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetDeployInstanceLogic) GetDeployInstance(req *types.GetDeployInstanceReq) (resp *types.GetDeployInstanceResp, err error) {
|
||||
resp = &types.GetDeployInstanceResp{}
|
||||
|
||||
id, err := strconv.ParseInt(req.Id, 10, 64)
|
||||
ins, err := l.svcCtx.Scheduler.AiStorages.GetInferDeployInstanceById(id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
in, err := l.svcCtx.Scheduler.AiService.InferenceAdapterMap[strconv.FormatInt(ins.AdapterId, 10)][strconv.FormatInt(ins.ClusterId, 10)].GetInferDeployInstance(l.ctx, ins.InstanceId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp.Instance = in
|
||||
|
||||
return
|
||||
}
|
|
@ -5,7 +5,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/utils/status"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
|
@ -83,7 +82,7 @@ func (l *StartAllByDeployTaskIdLogic) startAll(list []*models.AiInferDeployInsta
|
|||
<-buf
|
||||
return
|
||||
}
|
||||
if status.CheckStopStatus(in) {
|
||||
if l.svcCtx.Scheduler.AiService.Si.CheckStopStatus(in) {
|
||||
success := l.svcCtx.Scheduler.AiService.InferenceAdapterMap[strconv.FormatInt(ins.AdapterId, 10)][strconv.FormatInt(ins.ClusterId, 10)].StartInferDeployInstance(l.ctx, ins.InstanceId)
|
||||
if !success {
|
||||
e := struct {
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/utils/status"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
|
@ -84,7 +83,7 @@ func (l *StopAllByDeployTaskIdLogic) stopAll(list []*models.AiInferDeployInstanc
|
|||
<-buf
|
||||
return
|
||||
}
|
||||
if status.CheckRunningStatus(in) {
|
||||
if l.svcCtx.Scheduler.AiService.Si.CheckRunningStatus(in) {
|
||||
success := l.svcCtx.Scheduler.AiService.InferenceAdapterMap[strconv.FormatInt(ins.AdapterId, 10)][strconv.FormatInt(ins.ClusterId, 10)].StopInferDeployInstance(l.ctx, ins.InstanceId)
|
||||
if !success {
|
||||
e := struct {
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/utils/status"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"strconv"
|
||||
|
@ -38,7 +37,7 @@ func (l *StopDeployInstanceLogic) StopDeployInstance(req *types.StopDeployInstan
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if status.CheckRunningStatus(in) {
|
||||
if l.svcCtx.Scheduler.AiService.Si.CheckRunningStatus(in) {
|
||||
success := l.svcCtx.Scheduler.AiService.InferenceAdapterMap[req.AdapterId][req.ClusterId].StopInferDeployInstance(l.ctx, in.InstanceId)
|
||||
if !success {
|
||||
return nil, errors.New("stop instance failed")
|
||||
|
|
|
@ -2,6 +2,7 @@ package monitoring
|
|||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/tracker"
|
||||
"time"
|
||||
|
||||
|
@ -17,6 +18,12 @@ type ClustersLoadLogic struct {
|
|||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
type ClusterInfo struct {
|
||||
ClusterId int64 `json:"clusterId"`
|
||||
ClusterName string `json:"clusterName"`
|
||||
Metrics []tracker.Metric `json:"metrics"`
|
||||
}
|
||||
|
||||
func NewClustersLoadLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ClustersLoadLogic {
|
||||
return &ClustersLoadLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
|
@ -27,8 +34,21 @@ func NewClustersLoadLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Clus
|
|||
|
||||
func (l *ClustersLoadLogic) ClustersLoad(req *types.ClustersLoadReq) (resp *types.ClustersLoadResp, err error) {
|
||||
resp = &types.ClustersLoadResp{}
|
||||
metrics := []string{"cluster_cpu_utilisation", "cluster_cpu_avail", "cluster_cpu_total", "cluster_memory_total", "cluster_memory_avail", "cluster_memory_utilisation", "cluster_disk_utilisation", "cluster_disk_avail", "cluster_disk_total", "cluster_pod_utilisation"}
|
||||
result := l.svcCtx.PromClient.GetNamedMetrics(metrics, time.Now(), tracker.ClusterOption{ClusterName: req.ClusterName})
|
||||
// 查询集群列表
|
||||
var clustersModel []models.ComputeCluster
|
||||
l.svcCtx.DbEngin.Raw("select * from t_cluster where label = 'kubernetes'").Scan(&clustersModel)
|
||||
var result []ClusterInfo
|
||||
for _, cluster := range clustersModel {
|
||||
metrics := []string{"cluster_cpu_utilisation", "cluster_cpu_avail", "cluster_cpu_total", "cluster_memory_total", "cluster_memory_avail", "cluster_memory_utilisation", "cluster_disk_utilisation", "cluster_disk_avail", "cluster_disk_total", "cluster_pod_utilisation", "cluster_node_count"}
|
||||
data := l.svcCtx.PromClient.GetNamedMetrics(metrics, time.Now(), tracker.ClusterOption{ClusterName: cluster.Name.String})
|
||||
clusterInfo := ClusterInfo{
|
||||
ClusterId: cluster.Id,
|
||||
ClusterName: cluster.Name.String,
|
||||
Metrics: data,
|
||||
}
|
||||
result = append(result, clusterInfo)
|
||||
|
||||
}
|
||||
resp.Data = result
|
||||
return resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package schedule
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
@ -25,7 +26,15 @@ func NewGetComputeCardsByClusterLogic(ctx context.Context, svcCtx *svc.ServiceCo
|
|||
|
||||
func (l *GetComputeCardsByClusterLogic) GetComputeCardsByCluster(req *types.GetComputeCardsByClusterReq) (resp *types.GetComputeCardsByClusterResp, err error) {
|
||||
resp = &types.GetComputeCardsByClusterResp{}
|
||||
cards, err := l.svcCtx.Scheduler.AiService.AiCollectorAdapterMap[req.AdapterId][req.ClusterId].GetComputeCards(l.ctx)
|
||||
adapter, ok := l.svcCtx.Scheduler.AiService.AiCollectorAdapterMap[req.AdapterId]
|
||||
if !ok {
|
||||
return nil, errors.New("adapterId does not exist")
|
||||
}
|
||||
cluster, ok := adapter[req.ClusterId]
|
||||
if !ok {
|
||||
return nil, errors.New("clusterId does not exist")
|
||||
}
|
||||
cards, err := cluster.GetComputeCards(l.ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,226 @@
|
|||
package schedule
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/collector"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/storeLink"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
ADAPTERID = "1777144940459986944" // 异构适配器id
|
||||
QUERY_TRAIN_RESOURCES = "train_resources"
|
||||
QUERY_INFERENCE_RESOURCES = "inference_resources"
|
||||
)
|
||||
|
||||
type QueryResourcesLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewQueryResourcesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QueryResourcesLogic {
|
||||
return &QueryResourcesLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *QueryResourcesLogic) QueryResources(req *types.QueryResourcesReq) (resp *types.QueryResourcesResp, err error) {
|
||||
resp = &types.QueryResourcesResp{}
|
||||
|
||||
if len(req.ClusterIDs) == 0 {
|
||||
cs, err := l.svcCtx.Scheduler.AiStorages.GetClustersByAdapterId(ADAPTERID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var resources interface{}
|
||||
switch req.Type {
|
||||
case "Train":
|
||||
resources, _ = l.svcCtx.Scheduler.AiService.LocalCache[QUERY_TRAIN_RESOURCES]
|
||||
case "Inference":
|
||||
resources, _ = l.svcCtx.Scheduler.AiService.LocalCache[QUERY_INFERENCE_RESOURCES]
|
||||
default:
|
||||
resources, _ = l.svcCtx.Scheduler.AiService.LocalCache[QUERY_TRAIN_RESOURCES]
|
||||
}
|
||||
|
||||
specs, ok := resources.([]*collector.ResourceSpec)
|
||||
if ok {
|
||||
results := handleEmptyResourceUsage(cs.List, specs)
|
||||
resp.Data = results
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
rus, err := l.QueryResourcesByClusterId(cs.List, req.Type)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
results := handleEmptyResourceUsage(cs.List, rus)
|
||||
resp.Data = results
|
||||
|
||||
} else {
|
||||
var clusters []types.ClusterInfo
|
||||
for _, id := range req.ClusterIDs {
|
||||
cluster, err := l.svcCtx.Scheduler.AiStorages.GetClustersById(id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
clusters = append(clusters, *cluster)
|
||||
}
|
||||
|
||||
if len(clusters) == 0 {
|
||||
return nil, errors.New("no clusters found ")
|
||||
}
|
||||
|
||||
rus, err := l.QueryResourcesByClusterId(clusters, req.Type)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
results := handleEmptyResourceUsage(clusters, rus)
|
||||
resp.Data = results
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (l *QueryResourcesLogic) QueryResourcesByClusterId(clusterinfos []types.ClusterInfo, resrcType string) ([]*collector.ResourceSpec, error) {
|
||||
var clusters []types.ClusterInfo
|
||||
if len(clusterinfos) == 0 {
|
||||
cs, err := l.svcCtx.Scheduler.AiStorages.GetClustersByAdapterId(ADAPTERID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
clusters = cs.List
|
||||
} else {
|
||||
clusters = clusterinfos
|
||||
}
|
||||
|
||||
var ulist []*collector.ResourceSpec
|
||||
var ch = make(chan *collector.ResourceSpec, len(clusters))
|
||||
|
||||
var wg sync.WaitGroup
|
||||
for _, cluster := range clusters {
|
||||
wg.Add(1)
|
||||
c := cluster
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
done := make(chan bool)
|
||||
var u *collector.ResourceSpec
|
||||
var err error
|
||||
go func() {
|
||||
|
||||
col, found := l.svcCtx.Scheduler.AiService.AiCollectorAdapterMap[strconv.FormatInt(c.AdapterId, 10)][c.Id]
|
||||
if !found {
|
||||
done <- true
|
||||
return
|
||||
}
|
||||
|
||||
u, err = col.GetResourceSpecs(l.ctx, resrcType)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
done <- true
|
||||
return
|
||||
}
|
||||
|
||||
done <- true
|
||||
}()
|
||||
|
||||
select {
|
||||
case <-done:
|
||||
if u != nil {
|
||||
ch <- u
|
||||
}
|
||||
case <-time.After(10 * time.Second):
|
||||
return
|
||||
}
|
||||
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
close(ch)
|
||||
|
||||
for v := range ch {
|
||||
ulist = append(ulist, v)
|
||||
}
|
||||
|
||||
return ulist, nil
|
||||
}
|
||||
|
||||
func handleEmptyResourceUsage(list []types.ClusterInfo, ulist []*collector.ResourceSpec) []*collector.ResourceSpec {
|
||||
var rus []*collector.ResourceSpec
|
||||
m := make(map[string]interface{})
|
||||
for _, u := range ulist {
|
||||
if u == nil {
|
||||
continue
|
||||
}
|
||||
m[u.ClusterId] = u
|
||||
}
|
||||
|
||||
for _, l := range list {
|
||||
s, ok := m[l.Id]
|
||||
if !ok {
|
||||
ru := &collector.ResourceSpec{
|
||||
ClusterId: l.Id,
|
||||
Resources: nil,
|
||||
Msg: "resources unavailable, please retry later",
|
||||
}
|
||||
rus = append(rus, ru)
|
||||
} else {
|
||||
if s == nil {
|
||||
ru := &collector.ResourceSpec{
|
||||
ClusterId: l.Id,
|
||||
Resources: nil,
|
||||
Msg: "resources unavailable, please retry later",
|
||||
}
|
||||
rus = append(rus, ru)
|
||||
} else {
|
||||
r, ok := s.(*collector.ResourceSpec)
|
||||
if ok {
|
||||
if r.Resources == nil || len(r.Resources) == 0 {
|
||||
ru := &collector.ResourceSpec{
|
||||
ClusterId: r.ClusterId,
|
||||
Resources: nil,
|
||||
Msg: "resources unavailable, please retry later",
|
||||
}
|
||||
rus = append(rus, ru)
|
||||
} else {
|
||||
// add cluster type
|
||||
t, ok := storeLink.ClusterTypeMap[strings.Title(l.Name)]
|
||||
if ok {
|
||||
r.ClusterType = t
|
||||
}
|
||||
rus = append(rus, r)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rus
|
||||
}
|
||||
|
||||
func checkCachingCondition(clusters []types.ClusterInfo, specs []*collector.ResourceSpec) bool {
|
||||
var count int
|
||||
for _, spec := range specs {
|
||||
if spec.Resources != nil {
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
if count == len(clusters) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package schedule
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/utils/status"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants"
|
||||
"strconv"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ScheduleCancelTaskLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewScheduleCancelTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ScheduleCancelTaskLogic {
|
||||
return &ScheduleCancelTaskLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ScheduleCancelTaskLogic) ScheduleCancelTask(req *types.CancelTaskReq) (resp *types.CancelTaskResp, err error) {
|
||||
task, err := l.svcCtx.Scheduler.AiService.Storage.GetTaskById(req.TaskId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if task == nil {
|
||||
return nil, errors.New("failed to cancel task, task not found")
|
||||
}
|
||||
|
||||
// find ai tasks
|
||||
aitasks, err := l.svcCtx.Scheduler.AiStorages.GetAiTaskListById(task.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(aitasks) == 0 {
|
||||
return nil, errors.New("failed to cancel task, ai sub tasks have not been created")
|
||||
}
|
||||
|
||||
// update status
|
||||
status.UpdateAiTask(l.svcCtx, aitasks...)
|
||||
|
||||
t := aitasks[0]
|
||||
|
||||
if t.Status != constants.Running {
|
||||
return nil, fmt.Errorf("failed to cancel task, ai sub tasks is %s", t.Status)
|
||||
}
|
||||
|
||||
// assume a task has only one sub ai task
|
||||
err = l.svcCtx.Scheduler.AiService.AiExecutorAdapterMap[strconv.FormatInt(t.AdapterId, 10)][strconv.FormatInt(t.ClusterId, 10)].Stop(l.ctx, t.JobId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
t.Status = constants.Cancelled
|
||||
err = l.svcCtx.Scheduler.AiService.Storage.UpdateAiTask(t)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
task.Status = constants.Cancelled
|
||||
err = l.svcCtx.Scheduler.AiService.Storage.UpdateTaskByModel(task)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
|
@ -0,0 +1,417 @@
|
|||
package schedule
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/common"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/collector"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/utils/task"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/strategy"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/storeLink"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gopkg.in/yaml.v3"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
const (
|
||||
TRAINNING_TASK_REPLICA = 1
|
||||
TRAINNING_TASK_SUFFIX_LEN = 10
|
||||
QUERY_RESOURCE_RETRY = 3
|
||||
)
|
||||
|
||||
type ClustersWithDataDistributes struct {
|
||||
Clusters []*strategy.AssignedCluster
|
||||
DataDistributes *types.DataDistribute
|
||||
}
|
||||
|
||||
type ScheduleCreateTaskLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
queryResource *QueryResourcesLogic
|
||||
}
|
||||
|
||||
func NewScheduleCreateTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ScheduleCreateTaskLogic {
|
||||
return &ScheduleCreateTaskLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
queryResource: NewQueryResourcesLogic(ctx, svcCtx),
|
||||
}
|
||||
}
|
||||
|
||||
func generateFilteredDataDistributes(clusters []*strategy.AssignedCluster, distribute types.DataDistribute) *ClustersWithDataDistributes {
|
||||
|
||||
var clusterIds []string
|
||||
for _, c := range clusters {
|
||||
clusterIds = append(clusterIds, c.ClusterId)
|
||||
}
|
||||
|
||||
clustersWithDataDistributes := &ClustersWithDataDistributes{
|
||||
Clusters: clusters,
|
||||
DataDistributes: &types.DataDistribute{
|
||||
Dataset: make([]*types.DatasetDistribute, 0),
|
||||
Image: make([]*types.ImageDistribute, 0),
|
||||
Model: make([]*types.ModelDistribute, 0),
|
||||
Code: make([]*types.CodeDistribute, 0),
|
||||
},
|
||||
}
|
||||
|
||||
for _, datasetDistribute := range distribute.Dataset {
|
||||
dataset := &types.DatasetDistribute{}
|
||||
dataset.DataName = datasetDistribute.DataName
|
||||
dataset.PackageID = datasetDistribute.PackageID
|
||||
clusterScheduledList := make([]*types.ClusterScheduled, 0)
|
||||
|
||||
if len(datasetDistribute.Clusters) != 0 {
|
||||
for _, cluster := range datasetDistribute.Clusters {
|
||||
if slices.Contains(clusterIds, cluster.ClusterID) {
|
||||
clusterScheduledList = append(clusterScheduledList, cluster)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dataset.Clusters = clusterScheduledList
|
||||
clustersWithDataDistributes.DataDistributes.Dataset = append(clustersWithDataDistributes.DataDistributes.Dataset, dataset)
|
||||
}
|
||||
|
||||
for _, imageDistribute := range distribute.Image {
|
||||
image := &types.ImageDistribute{}
|
||||
image.DataName = imageDistribute.DataName
|
||||
image.PackageID = imageDistribute.PackageID
|
||||
clusterScheduledList := make([]*types.ClusterScheduled, 0)
|
||||
|
||||
if len(imageDistribute.Clusters) != 0 {
|
||||
for _, cluster := range imageDistribute.Clusters {
|
||||
if slices.Contains(clusterIds, cluster.ClusterID) {
|
||||
clusterScheduledList = append(clusterScheduledList, cluster)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
image.Clusters = clusterScheduledList
|
||||
clustersWithDataDistributes.DataDistributes.Image = append(clustersWithDataDistributes.DataDistributes.Image, image)
|
||||
}
|
||||
|
||||
for _, codeDistribute := range distribute.Code {
|
||||
code := &types.CodeDistribute{}
|
||||
code.DataName = codeDistribute.DataName
|
||||
code.PackageID = codeDistribute.PackageID
|
||||
code.Output = codeDistribute.Output
|
||||
clusterScheduledList := make([]*types.ClusterScheduled, 0)
|
||||
|
||||
if len(codeDistribute.Clusters) != 0 {
|
||||
for _, cluster := range codeDistribute.Clusters {
|
||||
if slices.Contains(clusterIds, cluster.ClusterID) {
|
||||
clusterScheduledList = append(clusterScheduledList, cluster)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
code.Clusters = clusterScheduledList
|
||||
clustersWithDataDistributes.DataDistributes.Code = append(clustersWithDataDistributes.DataDistributes.Code, code)
|
||||
}
|
||||
|
||||
for _, modelDistribute := range distribute.Model {
|
||||
model := &types.ModelDistribute{}
|
||||
model.DataName = modelDistribute.DataName
|
||||
model.PackageID = modelDistribute.PackageID
|
||||
clusterScheduledList := make([]*types.ClusterScheduled, 0)
|
||||
|
||||
if len(modelDistribute.Clusters) != 0 {
|
||||
for _, cluster := range modelDistribute.Clusters {
|
||||
if slices.Contains(clusterIds, cluster.ClusterID) {
|
||||
clusterScheduledList = append(clusterScheduledList, cluster)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
model.Clusters = clusterScheduledList
|
||||
clustersWithDataDistributes.DataDistributes.Model = append(clustersWithDataDistributes.DataDistributes.Model, model)
|
||||
}
|
||||
|
||||
return clustersWithDataDistributes
|
||||
}
|
||||
|
||||
func (l *ScheduleCreateTaskLogic) ScheduleCreateTask(req *types.CreateTaskReq) (resp *types.CreateTaskResp, err error) {
|
||||
resp = &types.CreateTaskResp{}
|
||||
|
||||
err = task.ValidateJobResources(req.JobResources, "training")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
taskName, err := l.svcCtx.Scheduler.AiService.HandleDuplicateTaskName(req.Name, "training")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var clusters []string
|
||||
if len(req.JobResources.Clusters) == 1 {
|
||||
clusters = append(clusters, req.JobResources.Clusters[0].ClusterID)
|
||||
schedatas, err := l.generateScheduleResult(req.DataDistributes, clusters)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
assignedClusters := task.CopyParams([]*strategy.AssignedCluster{{
|
||||
ClusterId: req.JobResources.Clusters[0].ClusterID, Replicas: 1,
|
||||
}}, req.JobResources.Clusters, "")
|
||||
|
||||
// filter data distribution
|
||||
clustersWithDataDistributes := generateFilteredDataDistributes(assignedClusters, req.DataDistributes)
|
||||
|
||||
taskId, err := l.createTask(taskName, req.Description, req.UserId, req.JobResources.ScheduleStrategy, clustersWithDataDistributes, req.Token, req.UserIp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.ScheduleDatas = schedatas
|
||||
resp.TaskID = taskId
|
||||
resp.TaskName = taskName
|
||||
return resp, nil
|
||||
|
||||
} else {
|
||||
assignedClusters, err := l.getAssignedClustersByStrategy(&req.JobResources, &req.DataDistributes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(assignedClusters) == 0 {
|
||||
return nil, fmt.Errorf("failed to create task, no scheduled cluster found")
|
||||
}
|
||||
|
||||
for _, c := range assignedClusters {
|
||||
clusters = append(clusters, c.ClusterId)
|
||||
}
|
||||
|
||||
schedatas, err := l.generateScheduleResult(req.DataDistributes, clusters)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// filter data distribution
|
||||
clustersWithDataDistributes := generateFilteredDataDistributes(assignedClusters, req.DataDistributes)
|
||||
|
||||
taskId, err := l.createTask(taskName, req.Description, req.UserId, req.JobResources.ScheduleStrategy, clustersWithDataDistributes, req.Token, req.UserIp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.ScheduleDatas = schedatas
|
||||
resp.TaskID = taskId
|
||||
resp.TaskName = taskName
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ScheduleCreateTaskLogic) getAssignedClustersByStrategy(resources *types.JobResources, dataDistribute *types.DataDistribute) ([]*strategy.AssignedCluster, error) {
|
||||
var assignedClusters []*strategy.AssignedCluster
|
||||
switch resources.ScheduleStrategy {
|
||||
case strategy.LEASTLOADFIRST:
|
||||
var resSpecs []*collector.ResourceSpec
|
||||
var resCount int
|
||||
for i := 0; i < QUERY_RESOURCE_RETRY; i++ {
|
||||
defer time.Sleep(time.Second)
|
||||
qResources, err := l.queryResource.QueryResourcesByClusterId(nil, "Train")
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, resource := range qResources {
|
||||
if resource.Resources != nil {
|
||||
resCount++
|
||||
}
|
||||
}
|
||||
|
||||
if resCount >= 1 {
|
||||
resSpecs = qResources
|
||||
break
|
||||
} else {
|
||||
resCount = 0
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if resCount == 0 {
|
||||
return nil, fmt.Errorf("failed to create task, resources counting fails")
|
||||
}
|
||||
|
||||
strtg := strategy.NewLeastLoadFirst(TRAINNING_TASK_REPLICA, resSpecs)
|
||||
clusters, err := strtg.Schedule()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
assignedClusters = task.CopyParams(clusters, resources.Clusters, "")
|
||||
case strategy.DATA_LOCALITY:
|
||||
strtg := strategy.NewDataLocality(TRAINNING_TASK_REPLICA, dataDistribute)
|
||||
clusters, err := strtg.Schedule()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
assignedClusters = task.CopyParams(clusters, resources.Clusters, "")
|
||||
default:
|
||||
return nil, errors.New("no strategy has been chosen")
|
||||
}
|
||||
|
||||
return assignedClusters, nil
|
||||
}
|
||||
|
||||
func (l *ScheduleCreateTaskLogic) createTask(taskName string, desc string, userId int64, strategyName string, clustersWithDataDistributes *ClustersWithDataDistributes, token string, userIp string) (int64, error) {
|
||||
var synergyStatus int64
|
||||
if len(clustersWithDataDistributes.Clusters) > 1 {
|
||||
synergyStatus = 1
|
||||
}
|
||||
|
||||
y, err := yaml.Marshal(clustersWithDataDistributes)
|
||||
if err != nil {
|
||||
fmt.Printf("Error while Marshaling. %v", err)
|
||||
}
|
||||
|
||||
taskId, err := l.svcCtx.Scheduler.CreateTask(taskName, desc, userId, synergyStatus, strategyName, string(y), token, userIp, &l.svcCtx.Config)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return taskId, nil
|
||||
}
|
||||
|
||||
func (l *ScheduleCreateTaskLogic) generateScheduleResult(distribute types.DataDistribute, clusters []string) ([]*types.ScheduleData, error) {
|
||||
var schedatas []*types.ScheduleData
|
||||
|
||||
for _, d := range distribute.Dataset {
|
||||
data := &types.ScheduleData{
|
||||
DataType: "dataset",
|
||||
PackageID: d.PackageID,
|
||||
ClusterIDs: make([]string, 0),
|
||||
}
|
||||
|
||||
var cSlc []string
|
||||
for _, cluster := range d.Clusters {
|
||||
cSlc = append(cSlc, cluster.ClusterID)
|
||||
}
|
||||
|
||||
for _, cluster := range clusters {
|
||||
if !slices.Contains(cSlc, cluster) {
|
||||
data.ClusterIDs = append(data.ClusterIDs, cluster)
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if len(data.ClusterIDs) != 0 {
|
||||
schedatas = append(schedatas, data)
|
||||
}
|
||||
}
|
||||
|
||||
for _, d := range distribute.Code {
|
||||
data := &types.ScheduleData{
|
||||
DataType: "code",
|
||||
PackageID: d.PackageID,
|
||||
ClusterIDs: make([]string, 0),
|
||||
}
|
||||
|
||||
var cSlc []string
|
||||
for _, cluster := range d.Clusters {
|
||||
cSlc = append(cSlc, cluster.ClusterID)
|
||||
}
|
||||
|
||||
for _, cluster := range clusters {
|
||||
if !slices.Contains(cSlc, cluster) {
|
||||
data.ClusterIDs = append(data.ClusterIDs, cluster)
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if len(data.ClusterIDs) != 0 {
|
||||
schedatas = append(schedatas, data)
|
||||
}
|
||||
}
|
||||
|
||||
for _, d := range distribute.Image {
|
||||
data := &types.ScheduleData{
|
||||
DataType: "image",
|
||||
PackageID: d.PackageID,
|
||||
ClusterIDs: make([]string, 0),
|
||||
}
|
||||
|
||||
var cSlc []string
|
||||
for _, cluster := range d.Clusters {
|
||||
cSlc = append(cSlc, cluster.ClusterID)
|
||||
}
|
||||
|
||||
for _, cluster := range clusters {
|
||||
if !slices.Contains(cSlc, cluster) {
|
||||
data.ClusterIDs = append(data.ClusterIDs, cluster)
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if len(data.ClusterIDs) != 0 {
|
||||
schedatas = append(schedatas, data)
|
||||
}
|
||||
}
|
||||
|
||||
for _, d := range distribute.Model {
|
||||
data := &types.ScheduleData{
|
||||
DataType: "model",
|
||||
PackageID: d.PackageID,
|
||||
ClusterIDs: make([]string, 0),
|
||||
}
|
||||
|
||||
var cSlc []string
|
||||
for _, cluster := range d.Clusters {
|
||||
cSlc = append(cSlc, cluster.ClusterID)
|
||||
}
|
||||
|
||||
for _, cluster := range clusters {
|
||||
if !slices.Contains(cSlc, cluster) {
|
||||
data.ClusterIDs = append(data.ClusterIDs, cluster)
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if len(data.ClusterIDs) != 0 {
|
||||
schedatas = append(schedatas, data)
|
||||
}
|
||||
}
|
||||
|
||||
if len(schedatas) != 0 {
|
||||
err := l.updateStorageType(&schedatas)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return schedatas, nil
|
||||
}
|
||||
|
||||
func (l *ScheduleCreateTaskLogic) updateStorageType(schedatas *[]*types.ScheduleData) error {
|
||||
|
||||
for _, s := range *schedatas {
|
||||
var storageType string
|
||||
var sTypes []string
|
||||
for _, id := range s.ClusterIDs {
|
||||
cluster, err := l.svcCtx.Scheduler.AiStorages.GetClustersById(id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
stype, ok := storeLink.StorageTypeMap[strings.Title(cluster.Name)]
|
||||
if ok {
|
||||
sTypes = append(sTypes, stype)
|
||||
}
|
||||
}
|
||||
sTypes = common.Unique(sTypes)
|
||||
for _, st := range sTypes {
|
||||
storageType += st + storeLink.COMMA
|
||||
}
|
||||
storageType = strings.TrimSuffix(storageType, storeLink.COMMA)
|
||||
s.StorageType = storageType
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue