Compare commits
784 Commits
Author | SHA1 | Date |
---|---|---|
|
daf75cec37 | |
|
406286681b | |
|
71476e27b7 | |
|
c595a58fd9 | |
|
55b9855d04 | |
|
835b51a8d2 | |
|
70c83cbfa1 | |
|
f20eb974f8 | |
|
6b26220e68 | |
|
32190d9b2b | |
|
570946ed48 | |
|
71b2870ead | |
|
49adcc5176 | |
|
8a91b7b683 | |
|
ef3c890ea5 | |
|
cc78fb706c | |
|
3af5fcc802 | |
|
b4ca40b408 | |
|
683c0fa4f8 | |
|
157b474d9e | |
|
5b67f6b63a | |
|
6685492d03 | |
|
cb36582543 | |
![]() |
90a7d4a914 | |
|
5dec03d976 | |
![]() |
961558d9f1 | |
|
b3cd5cb160 | |
|
15540513ed | |
|
c717f0f1d0 | |
|
e599d45c10 | |
|
23ffca2a8d | |
|
caaa3466f4 | |
|
d03433d970 | |
|
ff312781e1 | |
|
922c4149bb | |
|
cf3cfd9b6f | |
|
2e88ecb4d7 | |
|
5379463930 | |
|
405b1832b2 | |
|
f99531dec1 | |
|
17d3a5ee20 | |
|
9b3933586a | |
|
72c6cf998c | |
|
2c01ea8c25 | |
|
d051c2ca11 | |
|
8dafe47efc | |
|
ea1f5f0a84 | |
|
7a02b3ac98 | |
|
7b326c485e | |
|
0eac6041b3 | |
|
4e3fe85ecd | |
|
158b74d8ae | |
|
e69d0cc918 | |
![]() |
64b50119aa | |
|
1d127fdec9 | |
![]() |
cfb5c293ce | |
|
aabbc1719d | |
|
836d8f7f97 | |
|
b4ae22c9ce | |
|
454efc36db | |
|
4c9cce1bec | |
|
c5ac28d222 | |
|
ebe3c21d6d | |
|
94e73c0fd3 | |
|
945ee35bb9 | |
|
7d9d6aff1b | |
|
29a22371cd | |
|
edfde2b701 | |
|
829e00003d | |
|
4bf26036e7 | |
|
b065b3210b | |
|
a15861b507 | |
|
ac91ce5f20 | |
|
fc5e2a0ff0 | |
|
4955139d43 | |
|
1a46411fbc | |
|
bdf9f72c09 | |
|
9e218d5843 | |
|
1329122018 | |
|
458812fca2 | |
|
adc1448071 | |
|
3d7f18b273 | |
|
9a2a5eb7bc | |
|
cb374bb324 | |
|
32aa80967d | |
|
6fe283469d | |
|
7a3214ca2b | |
|
fc08b0aaed | |
|
f3ec691387 | |
|
4a51cebc79 | |
|
12dde250bf | |
|
0dfcf5d24e | |
|
b60efd016c | |
|
f7e3262935 | |
|
59a88853d6 | |
|
ddbc1cb95a | |
|
aba3c3cff2 | |
|
c2a9bffb7b | |
|
22558cc63e | |
|
fbd8808431 | |
|
ad231ed21f | |
|
e884d1e964 | |
|
b59e446af7 | |
|
70b84d8e6d | |
|
d0e5f3565f | |
|
9f24d580c6 | |
|
546fb5f5be | |
|
895dceb1e6 | |
|
26626535da | |
|
bc16ee0d15 | |
|
8902acbd35 | |
|
10432ed17c | |
|
c876889eb9 | |
|
545aa90815 | |
|
8ace4e771e | |
|
36cf496693 | |
|
7a56f0e4d0 | |
|
72fe516fb2 | |
|
8f5a7a83bf | |
|
2b67b31d9d | |
|
6010107783 | |
|
fbb71d90bc | |
|
c1a500ed22 | |
|
875557407a | |
|
fb05379230 | |
|
76270ffaeb | |
|
b917936a20 | |
|
daa650029a | |
|
42fda2f07a | |
|
365e08ce5e | |
|
ef44753204 | |
|
c8de6c78b1 | |
|
35f5fee1af | |
|
0a1f53f6fa | |
|
6d72fcc8a0 | |
|
6e81bf4997 | |
|
634213a618 | |
|
da86729a03 | |
|
7b1ada2f3e | |
|
9cfed9e9e3 | |
|
990658095c | |
|
8bb7ace86b | |
|
a388cd365f | |
|
fe32efbdb3 | |
|
0c0b514bc5 | |
|
e98823088a | |
|
2559e61a8d | |
|
a8d6c0ac6b | |
|
41d06eaa9b | |
|
1dfdd0b3de | |
|
b21e2651f1 | |
|
1b5aac65a3 | |
|
e4a4ee4118 | |
|
0c78204eba | |
|
763071ba76 | |
|
6ed75ea655 | |
|
91656d096e | |
|
f3af07e360 | |
|
190a78c2e7 | |
|
350259a124 | |
|
43a66ceaca | |
|
8c6abe6b1b | |
|
3c3bbaa0a5 | |
|
c3d4d5629b | |
|
367ad56fcd | |
|
02e65867d1 | |
|
abcbf3ec88 | |
|
ce9d470a5b | |
|
0c4c166b6d | |
|
cd54d2f170 | |
|
fc2264d7ab | |
|
2e69f55130 | |
|
e55cb94ef4 | |
|
7bf9595417 | |
|
b139679e41 | |
|
bc8021349d | |
|
02fabcc30a | |
|
c3e65f881c | |
|
42e3e3d809 | |
|
c20c9dbb5a | |
|
3023468120 | |
|
d7a35331ce | |
|
4b22f78193 | |
|
32e055d907 | |
|
6d09c5b808 | |
|
14e2d76333 | |
|
3fa5bd31a0 | |
|
ecd908cee4 | |
|
34c6a8e007 | |
![]() |
a3af50a8d7 | |
![]() |
dbe3f6554b | |
|
e5b3488ecc | |
|
013dc8645f | |
|
1be1acd2b0 | |
|
7c10915517 | |
|
fb3fc7f706 | |
|
20a3916d2c | |
|
77630a215c | |
|
d02ffd8d63 | |
|
e4ef82f78c | |
|
844ae53a2e | |
|
b3e7609f70 | |
|
a108e00353 | |
|
416bd0e54c | |
|
62e24cde4f | |
|
e9294decee | |
|
29128e0ca2 | |
|
ab0b39f4ed | |
|
145e24a917 | |
|
9a5898242b | |
|
f2536eb942 | |
|
6bbc009e18 | |
|
c4ccd504af | |
|
fcca6c8438 | |
|
3a8e24cd06 | |
|
ee8836b10b | |
|
6ae13da052 | |
![]() |
f413ad93b7 | |
![]() |
40540a6dd0 | |
|
5c9909161a | |
|
8f9cd14748 | |
|
22e384a381 | |
|
98ae246782 | |
|
5f5fe61f2b | |
|
f030b1c53b | |
|
a5e9379e51 | |
|
6556395817 | |
|
83f9081ed9 | |
|
53a7c41f3f | |
|
f5d398397a | |
|
5d84c61c35 | |
![]() |
bfc1b11eb5 | |
|
f3afc76fa6 | |
|
51843d2899 | |
![]() |
e1c2ea6e84 | |
|
e9baacfc14 | |
|
bd79becb75 | |
|
d86cc9d529 | |
![]() |
9e0057609c | |
|
d9cd1d41ac | |
|
1eb8398a89 | |
|
840111b6bb | |
|
3987ef1380 | |
|
b11a7b51f7 | |
|
565a4a6b57 | |
|
bd1a46df12 | |
![]() |
a624db8401 | |
|
36de12f7ea | |
|
c2e19df4b8 | |
|
3f9d10aa4d | |
![]() |
b8bbe255f0 | |
|
fabd218b26 | |
|
bbf246369e | |
|
3408273f72 | |
|
c1e77049b6 | |
|
efde0d5a96 | |
|
3e3d7b0a8c | |
|
035e66bc34 | |
|
3c32995455 | |
|
7ec6c07728 | |
|
839fd4761e | |
|
42d9e80409 | |
|
de79300334 | |
|
0440af0e37 | |
|
9de512ee32 | |
|
dc93a69f07 | |
|
7c412649d3 | |
|
9975fdb4d6 | |
|
4a48e5c1e4 | |
|
dc33df489a | |
|
d8d63c116d | |
|
28e9d5c366 | |
|
9e82aae4fd | |
|
5d86dc8ff4 | |
|
6739241de1 | |
|
40b2c7fee4 | |
|
eefc9a75e9 | |
|
78e3c7a683 | |
|
de69357d9b | |
|
726568a74f | |
|
fe276e98a1 | |
|
62cac010a0 | |
|
c3f0f5b3f1 | |
|
fd15722cd3 | |
|
9dcb0036e7 | |
|
8f27b00b8a | |
|
65112cc063 | |
|
41c7236f52 | |
|
96d68b07d1 | |
|
e1760e20de | |
|
163c0a8fd0 | |
|
d80ce1e704 | |
|
4ad39580a9 | |
|
5577c5808e | |
|
c7dce696d7 | |
|
70155c1001 | |
|
35d2a76097 | |
|
a30d161c27 | |
|
b661bec135 | |
|
eed1ae30dd | |
|
56b299e5d4 | |
|
eebee72d1c | |
|
9652fc452b | |
|
19b1b24a6c | |
|
9c7a158e34 | |
|
9c9d0562d2 | |
|
8cd5a25168 | |
|
a0a1dc23af | |
|
a39562abc8 | |
|
ec3fe090a5 | |
|
06cbd0eae6 | |
|
90cf569b70 | |
|
4cf3a7804d | |
|
3db1a6ac45 | |
|
a6090b9e54 | |
|
3f03d5c3a2 | |
|
9b8d271bb1 | |
|
44a3dfd14d | |
|
c301ea7fef | |
|
a81ff31b7c | |
|
5af0d344af | |
|
40d527663f | |
|
2c1e37f6fb | |
|
2c539fe282 | |
|
b72e4e416a | |
|
859c6baca3 | |
|
326d505dc1 | |
|
eb40826910 | |
|
7cceae0438 | |
|
dbf14eb6b8 | |
|
dc2a3a4fc4 | |
|
1e70763e7f | |
|
d47ff79765 | |
|
8d2fffb6f6 | |
|
95e2b32695 | |
|
761d378c4d | |
|
2e745f2c7a | |
|
3c4f190ce8 | |
|
18455bc5a0 | |
|
651ce567ab | |
|
0ef41cdf98 | |
|
edf0488247 | |
|
f95e482ae3 | |
|
b75e9f6cff | |
|
7d21cf74eb | |
|
5ea020ffff | |
|
22456e59e1 | |
![]() |
94e2e5afec | |
![]() |
603574b381 | |
![]() |
2e84df498a | |
![]() |
2203e780fe | |
|
2221bb8578 | |
|
eb41726104 | |
|
65fdb3d873 | |
|
3288ae6838 | |
|
cc686d681f | |
|
4eee4c12a9 | |
|
d409682046 | |
|
a1cfa43774 | |
|
7300f017fa | |
|
3ad235d75e | |
|
ab602b43a6 | |
|
a899d04925 | |
|
f40f21e142 | |
|
3f71c6c2bd | |
|
6546b9888a | |
|
03494c2361 | |
|
f15cf213cd | |
|
ff6e6d46cb | |
|
57e703c2da | |
|
ccdecc6eae | |
|
33a134e92f | |
|
3b2f0899e9 | |
|
ac99327ac4 | |
|
a083d89102 | |
|
20b6f0b3eb | |
|
20896519c2 | |
|
2267561841 | |
|
f77e73db57 | |
|
9c92b5c259 | |
|
8c0a644114 | |
|
ce056b8d2f | |
|
f59160f417 | |
|
2a1ae75d61 | |
|
5fb7b0313b | |
|
c4945eaa44 | |
|
8bdfaa2320 | |
|
cad9cccd41 | |
|
eb90e99d47 | |
|
afa3fa42e1 | |
|
2e52eb0850 | |
|
6519222177 | |
|
91a3a9d7f8 | |
|
04346b58bc | |
|
96060f7cec | |
|
ae0e533058 | |
|
55e7295cfc | |
|
2bdcb634ec | |
|
dadb7daf83 | |
|
730d24000a | |
|
2953905910 | |
|
1d0546bb3a | |
|
35eddac8b6 | |
|
8acc866e51 | |
|
066007df0d | |
|
5e7d1dc22a | |
![]() |
8710013a83 | |
![]() |
5db33d3353 | |
|
a8959f0e07 | |
|
d06528b408 | |
|
9dfd73aad8 | |
|
027911e82f | |
![]() |
0c0586081f | |
![]() |
f3a7238077 | |
|
e210b3c283 | |
|
990fc0500a | |
|
9bb2c298b0 | |
|
9c13fa7882 | |
|
1657ca7305 | |
![]() |
b6a7f7363d | |
![]() |
8388d26ea8 | |
|
4ce1b2956b | |
![]() |
f7cf741b54 | |
![]() |
e9df36b827 | |
|
908063d5a4 | |
|
9c6277828c | |
|
1263851a58 | |
|
f0de1a71a2 | |
![]() |
62ca70a4a1 | |
|
1e2ca857dd | |
![]() |
9c04866bf2 | |
![]() |
7ea991a272 | |
![]() |
7dd50995c0 | |
|
cd070699d1 | |
|
5fa964122f | |
|
85743ac872 | |
|
b9775efde3 | |
|
9c8ef50b78 | |
|
cfc3d23b49 | |
|
d11bdf17f5 | |
|
c4bd96cf4d | |
|
035c357c62 | |
|
f19df9d4b1 | |
|
e6103a5cd0 | |
![]() |
9905536031 | |
![]() |
c00fb78c92 | |
|
35dc202d29 | |
|
a07fd6bad5 | |
|
2e7cfdfda5 | |
|
3693b853c6 | |
|
a45bd574fe | |
|
9b7d7f3315 | |
|
c10f790469 | |
|
660eae566c | |
![]() |
7dc14a00ac | |
|
cf8f383aa9 | |
|
3673109dda | |
|
69cd38ef57 | |
![]() |
d675857c82 | |
|
a1cc97e48d | |
![]() |
b7b6952ffc | |
![]() |
2c56af84c8 | |
|
6d99429548 | |
|
ce5d1d940b | |
![]() |
a2fcb44494 | |
|
cb227ede52 | |
|
455cee1f2d | |
|
bfa8281d3b | |
|
889986361a | |
|
0024d0ddea | |
|
25abd7a7f4 | |
|
68915cf43a | |
|
a25b621bf5 | |
|
0b06b3b508 | |
|
d9c1cd0261 | |
|
afd3152161 | |
|
e35c9a5e05 | |
|
2509f55be2 | |
|
206404d5f3 | |
|
d8b82e03b9 | |
|
0af7b90c91 | |
|
4971f83fd5 | |
|
a2705ef6fc | |
|
8696e3cb16 | |
|
1c63965ba5 | |
|
7b4aa9ed34 | |
|
627e4e0553 | |
|
8fd52e86fd | |
|
f584527e2f | |
|
e6e7389ce2 | |
|
9d851b10e3 | |
|
a7b9c27d37 | |
|
6b5a30defe | |
![]() |
0ad85477e4 | |
![]() |
2c7cae3311 | |
|
ad11733867 | |
|
a2c53e24d1 | |
|
3e024424ac | |
|
5249571be4 | |
|
0c40e5f84c | |
|
b5db884b42 | |
|
ca700f1400 | |
|
0b0b1a5d97 | |
|
4c0b1f8d1d | |
![]() |
31d1d48b7c | |
|
3e97406e76 | |
|
851a19294b | |
|
de14cd03fb | |
|
b7bfd3191c | |
|
d5722a551b | |
|
f4108aade2 | |
|
05031382fd | |
|
f0d39e2ff1 | |
|
6037cb3c85 | |
|
744a11a0d8 | |
|
5d9fe1bd81 | |
|
6a685fee33 | |
|
e7bc89bc5a | |
|
85405ae5a4 | |
![]() |
6bdec0b4f8 | |
|
d480e3510a | |
|
3c0322fe57 | |
|
d00897a5fb | |
|
9b4ecea826 | |
|
313f3d815c | |
|
9983c662e5 | |
|
ede86dbb7b | |
|
4b548d7cd1 | |
|
cb6030d4fa | |
|
617e29e56c | |
|
933d2d204f | |
|
6ba1ceae48 | |
|
e4e7b5685f | |
|
6bf0776d9e | |
|
593a85afef | |
|
f496fcbe25 | |
|
7943b0ac9a | |
|
8cf8a3238d | |
|
5a33aba8bf | |
|
9bdb33268b | |
|
07fc2e447b | |
|
0a598defa8 | |
|
ac8a60ae04 | |
|
528898e302 | |
|
1b26a89f15 | |
|
f3cadc5721 | |
|
db3fe6a903 | |
|
aa7f994446 | |
|
9d4615ff6f | |
|
3506b3ba89 | |
|
5c89390c08 | |
|
269c3fa7e6 | |
|
c6b845f908 | |
|
7c356c3c5f | |
|
1cc0303d2d | |
|
a6fc536e56 | |
|
b911bfbfbf | |
|
0a23e50da2 | |
|
1ab206a821 | |
|
122ec3afc0 | |
|
4da76886f5 | |
|
c12b5b9055 | |
![]() |
cca78dded7 | |
|
f0224fba84 | |
|
f94e9491c0 | |
|
6719fc5c31 | |
|
6b8598fe77 | |
|
2daa2c067f | |
|
b42da439a1 | |
|
1f767f5c79 | |
|
f4208088c5 | |
|
458f24c4cd | |
|
1aae5e2d17 | |
|
230dcb4e51 | |
|
1086a71a5f | |
![]() |
591b567ea1 | |
![]() |
aff2077cf0 | |
![]() |
097000f8d3 | |
![]() |
e857a45ca2 | |
![]() |
1b06963640 | |
|
ffb114ca68 | |
|
6e473ef1eb | |
|
0de2982c10 | |
|
0ca3552e49 | |
|
f8bd112caf | |
|
635cfd7e3a | |
|
7721b3b6ff | |
|
89372339e7 | |
|
4e6978ce83 | |
|
5f029e5098 | |
|
3df2c09c69 | |
|
31a8f1469b | |
|
38ae817c82 | |
|
4bd1fc8e6c | |
|
07bc45a09f | |
|
8242a201cd | |
|
7ffc929575 | |
|
01bea42264 | |
|
39acb91436 | |
|
5c49999d9c | |
|
bebf44c3b5 | |
|
0675883728 | |
|
d35faf6ce6 | |
|
427b30e6bc | |
|
14d580a742 | |
|
dcf79c70d7 | |
|
4e20487446 | |
![]() |
6538b74b87 | |
![]() |
39041886c8 | |
![]() |
bfbd7643f7 | |
|
daab8da594 | |
|
f72f8b9f6f | |
![]() |
a4c90176ce | |
|
9ff3815f56 | |
|
4627f81f93 | |
|
82285d1dba | |
|
b346a12f84 | |
|
cf60ab6a9e | |
|
249c900643 | |
|
61f39aa179 | |
![]() |
b795e3f9be | |
![]() |
0bd56d9534 | |
|
c860a80b83 | |
|
44fff7b179 | |
|
047ee6a804 | |
|
d170dc84c6 | |
|
e13578349e | |
|
b1e010fcf2 | |
![]() |
b82aeac938 | |
![]() |
aad012d1de | |
![]() |
16c284a7ad | |
|
8ef454c276 | |
![]() |
cfd3e17f73 | |
|
9473ef1ab2 | |
|
9cfe3e0a5f | |
|
28f048bdfc | |
|
9e6d65053c | |
|
7ee7b0c5c4 | |
|
0df5d171dc | |
|
838077afc7 | |
|
c6fb5065a6 | |
|
ec61728338 | |
|
fdd81a6b33 | |
|
fba1807a5d | |
|
9c3325b8f4 | |
|
426cab62ba | |
|
3a5cf8cbee | |
|
6d2088c033 | |
|
b65d509bd6 | |
|
e49440f47f | |
|
474a2bc77b | |
|
64242fd919 | |
|
bf0e6c6a09 | |
|
1611ce4e7c | |
|
a0b8934eb3 | |
|
bf96ad6646 | |
|
e35fb35fe3 | |
|
4d246847cd | |
|
f7d1f70f11 | |
|
8f0f03f780 | |
|
72f094fbec | |
|
088cc41d99 | |
|
34cdece43b | |
|
6800f9a6d5 | |
|
15f598faac | |
|
43a5062326 | |
|
efcea561a7 | |
|
64c14f9308 | |
|
fa3519fe5c | |
|
d705dd41fe | |
![]() |
d6386bb55f | |
|
e30cbb370e | |
![]() |
8a9df31afa | |
![]() |
c64c2121c2 | |
![]() |
e2d56722f5 | |
|
7ff060d170 | |
![]() |
922d169796 | |
![]() |
94574bb562 | |
|
6acb3cf134 | |
|
585099db80 | |
|
1689d52ed9 | |
|
d1d24100e3 | |
|
9636cf7657 | |
|
e72a41ae75 | |
|
5eda47bdef | |
|
78409c8553 | |
|
653b972fac | |
![]() |
529b1a9a5e | |
![]() |
aae80f97e2 | |
|
8935c877b5 | |
|
6249ae97f9 | |
|
231524986d | |
|
dbd9e04e37 | |
|
ce44f191c5 | |
|
934fba1947 | |
![]() |
36ff5278ce | |
|
8f0ed19d2c | |
![]() |
4dfead74bb | |
![]() |
cbaa2409c6 | |
|
44777c3833 | |
![]() |
d9bae6d49c | |
|
9596570500 | |
|
46fbd92abc | |
|
15b62d03fd | |
|
c481227cbb | |
|
acf6a6b649 | |
|
8abc72dc72 | |
|
bcfeb8fda6 | |
![]() |
8bea8f8170 | |
![]() |
48095a570a | |
|
66fb94eb65 | |
![]() |
37456dca05 | |
|
1ee2df3200 | |
|
1ccf70a342 | |
|
3b1544fedc | |
|
5a7abd6236 | |
|
9aaa4e746a | |
|
1015390cf0 | |
![]() |
c7b7747f8e | |
![]() |
4f24d51275 | |
|
9b1a448e0a | |
|
209d77bab8 | |
|
38c42d8fac | |
|
75647ecfb3 | |
|
504da056a8 | |
|
c84d288e30 | |
|
636a8d6941 | |
|
dcc77c7b7e | |
|
b8779f052b | |
|
cdf2bffb9a | |
|
033716d66a | |
|
31083cc07b | |
|
6a45c06961 | |
|
f60b58c14c | |
|
54e5eee24c | |
|
fb304e3e7d | |
|
b0639ee26f | |
|
44b49dc998 | |
|
e9129ab518 | |
|
0fa8da48b7 | |
|
11decce9be | |
|
653a939ef6 | |
|
134e81b4a2 | |
|
43d2244641 | |
|
67d4c266a3 | |
|
81391f54c3 | |
|
5a6ed32c20 | |
|
56be610560 | |
|
80349a1015 | |
|
3a39965b54 | |
|
58bba95d9f | |
|
77882bc7a0 | |
|
444b56c4e3 | |
|
271f1e85ef | |
|
fc517e0e40 | |
|
34598e026a | |
|
50846da465 | |
|
0304504ef7 | |
|
88d78d4dc3 | |
|
bb55ca1d0a | |
![]() |
5fc97d3a61 | |
![]() |
66b2b2b936 | |
|
e502be4a9d | |
![]() |
de7a69443a | |
|
240f0fcfac | |
|
876fc52281 | |
|
2c03b013c1 | |
|
2464333833 | |
|
bb4d627271 | |
|
71cbe2c7ce | |
|
b242bc2ed7 | |
|
546c6a7db9 | |
![]() |
95fdd3e217 | |
|
aaf29aa556 | |
|
732d429122 | |
|
a6f7ec5a54 | |
|
f9940003dc | |
|
d999bbc23e | |
|
8398798a0d | |
|
26b20d6f99 | |
|
f58ef1f91f | |
|
024d983ce6 | |
|
62a00d79d8 | |
![]() |
156bfc9f20 |
|
@ -0,0 +1,99 @@
|
|||
version: 2
|
||||
name: api
|
||||
description: ""
|
||||
global:
|
||||
concurrent: 1
|
||||
param:
|
||||
- ref: deploy_path
|
||||
name: deploy_path
|
||||
value: '"pcm-coordinator-api.yaml"'
|
||||
required: false
|
||||
type: STRING
|
||||
hidden: false
|
||||
- ref: secret_name
|
||||
name: ""
|
||||
value: '"jcce-aliyuncs"'
|
||||
required: false
|
||||
type: STRING
|
||||
hidden: false
|
||||
- ref: project_name
|
||||
name: ""
|
||||
value: '"pcm-coordinator-api"'
|
||||
required: false
|
||||
type: STRING
|
||||
hidden: false
|
||||
trigger:
|
||||
webhook: gitlink@1.0.0
|
||||
event:
|
||||
- ref: create_tag
|
||||
ruleset:
|
||||
- param-ref: tag
|
||||
operator: EQ
|
||||
value: '""'
|
||||
ruleset-operator: AND
|
||||
workflow:
|
||||
- ref: start
|
||||
name: 开始
|
||||
task: start
|
||||
- ref: git_clone_0
|
||||
name: git clone
|
||||
task: git_clone@1.2.6
|
||||
input:
|
||||
remote_url: '"https://gitlink.org.cn/JointCloud/pcm-coordinator.git"'
|
||||
ref: '"refs/heads/master"'
|
||||
commit_id: '""'
|
||||
depth: 1
|
||||
needs:
|
||||
- start
|
||||
- ref: docker_image_build_0
|
||||
name: docker镜像构建
|
||||
task: docker_image_build@1.6.0
|
||||
input:
|
||||
docker_username: ((dev.docker_user))
|
||||
docker_password: ((dev.docker_password))
|
||||
image_name: '"registry.cn-hangzhou.aliyuncs.com/jcce/pcm-coordinator-api"'
|
||||
image_tag: git_clone_0.commit_time
|
||||
registry_address: '"registry.cn-hangzhou.aliyuncs.com"'
|
||||
docker_file: git_clone_0.git_path + '/api/Dockerfile'
|
||||
docker_build_path: git_clone_0.git_path
|
||||
workspace: git_clone_0.git_path
|
||||
image_clean: true
|
||||
image_push: true
|
||||
build_args: '""'
|
||||
needs:
|
||||
- shell_0
|
||||
- ref: end
|
||||
name: 结束
|
||||
task: end
|
||||
needs:
|
||||
- kubectl_deploy_0
|
||||
- ref: kubectl_deploy_0
|
||||
name: kubectl部署资源
|
||||
task: kubectl_deploy@1.1.0
|
||||
input:
|
||||
command: '"apply"'
|
||||
resource_file_path: git_clone_0.git_path + '/api'
|
||||
certificate_authority_data: ((dev.k8s_cad))
|
||||
server: '"https://119.45.100.73:6443"'
|
||||
client_certificate_data: ((dev.k8s_ccd))
|
||||
client_key_data: ((dev.k8s_ckd))
|
||||
hosts: '""'
|
||||
needs:
|
||||
- docker_image_build_0
|
||||
- ref: shell_0
|
||||
name: shell
|
||||
image: docker.jianmuhub.com/library/debian:buster-slim
|
||||
env:
|
||||
IMAGE_NAME: '"registry.cn-hangzhou.aliyuncs.com/jcce/pcm-coordinator-api"'
|
||||
IMAGE_TAG: git_clone_0.commit_time
|
||||
SECRET_NAME: global.secret_name
|
||||
PROJECT_NAME: global.project_name
|
||||
PROJECT_PATH: git_clone_0.git_path
|
||||
script:
|
||||
- cd ${PROJECT_PATH}/api
|
||||
- sed -i "s#image_name#${IMAGE_NAME}:${IMAGE_TAG}#" ${PROJECT_NAME}.yaml
|
||||
- sed -i "s#secret_name#${SECRET_NAME}#" ${PROJECT_NAME}.yaml
|
||||
- cat ${PROJECT_NAME}.yaml
|
||||
needs:
|
||||
- git_clone_0
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
version: 2
|
||||
name: rpc
|
||||
description: ""
|
||||
global:
|
||||
concurrent: 1
|
||||
param:
|
||||
- ref: deploy_path
|
||||
name: deploy_path
|
||||
value: '"pcm-coordinator-rpc.yaml"'
|
||||
required: false
|
||||
type: STRING
|
||||
hidden: false
|
||||
- ref: secret_name
|
||||
name: ""
|
||||
value: '"jcce-aliyuncs"'
|
||||
required: false
|
||||
type: STRING
|
||||
hidden: false
|
||||
- ref: project_name
|
||||
name: ""
|
||||
value: '"pcm-coordinator-rpc"'
|
||||
required: false
|
||||
type: STRING
|
||||
hidden: false
|
||||
trigger:
|
||||
webhook: gitlink@1.0.0
|
||||
event:
|
||||
- ref: create_tag
|
||||
ruleset:
|
||||
- param-ref: tag
|
||||
operator: EQ
|
||||
value: '""'
|
||||
ruleset-operator: AND
|
||||
workflow:
|
||||
- ref: start
|
||||
name: 开始
|
||||
task: start
|
||||
- ref: git_clone_0
|
||||
name: git clone
|
||||
task: git_clone@1.2.6
|
||||
input:
|
||||
remote_url: '"https://gitlink.org.cn/JointCloud/pcm-coordinator.git"'
|
||||
ref: '"refs/heads/master"'
|
||||
commit_id: '""'
|
||||
depth: 1
|
||||
needs:
|
||||
- start
|
||||
- ref: docker_image_build_0
|
||||
name: docker镜像构建
|
||||
task: docker_image_build@1.6.0
|
||||
input:
|
||||
docker_username: ((dev.docker_user))
|
||||
docker_password: ((dev.docker_password))
|
||||
image_name: '"registry.cn-hangzhou.aliyuncs.com/jcce/pcm-coordinator-rpc"'
|
||||
image_tag: git_clone_0.commit_time
|
||||
registry_address: '"registry.cn-hangzhou.aliyuncs.com"'
|
||||
docker_file: git_clone_0.git_path + '/rpc/Dockerfile'
|
||||
docker_build_path: git_clone_0.git_path
|
||||
workspace: git_clone_0.git_path
|
||||
image_clean: true
|
||||
image_push: true
|
||||
build_args: '""'
|
||||
needs:
|
||||
- shell_0
|
||||
- ref: end
|
||||
name: 结束
|
||||
task: end
|
||||
needs:
|
||||
- kubectl_deploy_0
|
||||
- ref: kubectl_deploy_0
|
||||
name: kubectl部署资源
|
||||
task: kubectl_deploy@1.1.0
|
||||
input:
|
||||
command: '"apply"'
|
||||
resource_file_path: git_clone_0.git_path + '/rpc'
|
||||
certificate_authority_data: ((dev.k8s_cad))
|
||||
server: '"https://119.45.100.73:6443"'
|
||||
client_certificate_data: ((dev.k8s_ccd))
|
||||
client_key_data: ((dev.k8s_ckd))
|
||||
hosts: '""'
|
||||
needs:
|
||||
- docker_image_build_0
|
||||
- ref: shell_0
|
||||
name: shell
|
||||
image: docker.jianmuhub.com/library/debian:buster-slim
|
||||
env:
|
||||
IMAGE_NAME: '"registry.cn-hangzhou.aliyuncs.com/jcce/pcm-coordinator-rpc"'
|
||||
IMAGE_TAG: git_clone_0.commit_time
|
||||
SECRET_NAME: global.secret_name
|
||||
PROJECT_NAME: global.project_name
|
||||
PROJECT_PATH: git_clone_0.git_path
|
||||
script:
|
||||
- cd ${PROJECT_PATH}/rpc
|
||||
- sed -i "s#image_name#${IMAGE_NAME}:${IMAGE_TAG}#" ${PROJECT_NAME}.yaml
|
||||
- sed -i "s#secret_name#${SECRET_NAME}#" ${PROJECT_NAME}.yaml
|
||||
- cat ${PROJECT_NAME}.yaml
|
||||
needs:
|
||||
- git_clone_0
|
||||
|
|
@ -9,7 +9,7 @@ PCM
|
|||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
# Output of the go coverage utils, specifically when used with LiteIDE
|
||||
*.out
|
||||
coverage.txt
|
||||
|
||||
|
@ -23,11 +23,9 @@ buf.lock
|
|||
.idea/
|
||||
.vscode/
|
||||
|
||||
# remove go sum
|
||||
go.sum
|
||||
|
||||
# config file
|
||||
configs/tenanter.yaml
|
||||
|
||||
log/
|
||||
/go_build_gitlink_org_cn_JCCE_PCM
|
||||
/cache/
|
||||
|
|
141
LICENSE
141
LICENSE
|
@ -1,73 +1,132 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
木兰宽松许可证, 第2版
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
木兰宽松许可证, 第2版
|
||||
|
||||
1. Definitions.
|
||||
2020年1月 http://license.coscl.org.cn/MulanPSL2
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束:
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
0. 定义
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
“软件” 是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
“贡献” 是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
“贡献者” 是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
“法人实体” 是指提交贡献的机构及其“关联实体”。
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
“关联实体” 是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
1. 授予版权许可
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
2. 授予专利许可
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
3. 无商标许可
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
“本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。
|
||||
|
||||
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
4. 分发限制
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
5. 免责声明与责任限制
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
“软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
6. 语言
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
“本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
条款结束
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
如何将木兰宽松许可证,第2版,应用到您的软件
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步:
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字;
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中;
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
3, 请将如下声明文本放入每个源文件的头部注释中。
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
||||
Copyright (c) [Year] [name of copyright holder]
|
||||
[Software Name] 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 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
See the Mulan PSL v2 for more details.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
Mulan Permissive Software License,Version 2
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Mulan Permissive Software License,Version 2 (Mulan PSL v2)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
January 2020 http://license.coscl.org.cn/MulanPSL2
|
||||
|
||||
Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions:
|
||||
|
||||
0. Definition
|
||||
|
||||
Software means the program and related documents which are licensed under this License and comprise all Contribution(s).
|
||||
|
||||
Contribution means the copyrightable work licensed by a particular Contributor under this License.
|
||||
|
||||
Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License.
|
||||
|
||||
Legal Entity means the entity making a Contribution and all its Affiliates.
|
||||
|
||||
Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity.
|
||||
|
||||
1. Grant of Copyright License
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not.
|
||||
|
||||
2. Grant of Patent License
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken.
|
||||
|
||||
3. No Trademark License
|
||||
|
||||
No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in section 4.
|
||||
|
||||
4. Distribution Restriction
|
||||
|
||||
You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software.
|
||||
|
||||
5. Disclaimer of Warranty and Limitation of Liability
|
||||
|
||||
THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
6. Language
|
||||
|
||||
THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL.
|
||||
|
||||
END OF THE TERMS AND CONDITIONS
|
||||
|
||||
How to Apply the Mulan Permissive Software License,Version 2 (Mulan PSL v2) to Your Software
|
||||
|
||||
To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps:
|
||||
|
||||
Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner;
|
||||
|
||||
Create a file named "LICENSE" which contains the whole context of this License in the first directory of your software package;
|
||||
|
||||
Attach the statement to the appropriate annotated syntax at the beginning of each source file.
|
||||
|
||||
Copyright (c) [Year] [name of copyright holder]
|
||||
[Software Name] 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 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
See the Mulan PSL v2 for more details.
|
||||
|
|
103
README.md
103
README.md
|
@ -1,43 +1,96 @@
|
|||
# PCM: Peer Collaboration Mechanism
|
||||
<img src="https://www.gitlink.org.cn/images/avatars/Organization/123822?t=1689062058" alt="PCM" style="float:center" />
|
||||
|
||||
PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration in a non intrusive and autonomous peer-to-peer manner. It focuses on how to make full use of the computing and storage capabilities of multiple source clouds without changing the heterogeneous cloud computing software stack, rather than implementing a new cloud software stack. From the cloud perspective, PCM superimposes on the cloud and focuses more on collaboration between clouds than on the cloud itself.
|
||||
<p align="center">
|
||||
<a href="https://www.gitlink.org.cn/JointCloud/pcm-coordinator/tree/master/docs">Docs</a> |
|
||||
<a href="https://www.gitlink.org.cn/JointCloud/pcm-coordinator/tree/master/docs">简体中文</a> |
|
||||
<a href="https://www.gitlink.org.cn/JointCloud/pcm-coordinator/milestones">Milestones</a>
|
||||
</p>
|
||||
|
||||

|
||||
## What is Jointcloud and PCM
|
||||
|
||||
## Requirements
|
||||
Jointcloud Cooperation Environment (JCCE) comprises Distributed Cloud Trading, Distributed Cloud Community, Distributed Cloud Supervision, and a Blockchain-based Distributed Accounting System. JCCE, with its supporting technologies related to information and value exchange, facilitates breaking the information asymmetry among participants in cloud collaboration. It creates a win-win opportunity for all involved parties and provides robust support for innovative business models in the cloud collaboration computing environment.
|
||||
|
||||
---
|
||||
The vision of the Peer Cooperation Mechanism (PCM) is to build a set of collaboration mechanisms in the cloud environment where all service providers and demand-side entities can autonomously participate, achieve peer-to-peer transactions, and establish efficient connections and invocations in a non-intrusive manner. PCM focuses more on collaboration among clouds rather than individual clouds themselves.
|
||||
|
||||
* Linux amd64
|
||||
PCM is built upon a standardized software-defined framework. Cloud service providers with physical cloud resources can autonomously define PCM rule frameworks. Other entities adhering to these rule frameworks can then participate in collaborative transactions. Subsequently, tailored virtual private clouds can be created for domain-specific applications, meeting the diverse requirements of various cloud participants, such as central, edge, and terminal infrastructure, enabling them to directly participate in collaboration and transactions.
|
||||
|
||||
* [Slurm-2-6-9-1](https://github.com/SchedMD/slurm/archive/refs/tags/slurm-2-6-9-1.tar.gz)
|
||||
## Real-world Issues Addressed by PCM:
|
||||
|
||||
* [Go](https://go.dev/) 1.19 or higher
|
||||
|
||||
* [GCC](https://gcc.gnu.org/) 4.8.5 or higher
|
||||
- **Performance Improvement**
|
||||
Developers in the cloud collaboration environment experience performance enhancement upon joining the PCM framework. They can generate code for the internal functionality structure and most specification definitions using descriptive language, allowing them to focus on business logic development without concerning themselves with underlying management functions. The framework offers features such as microservices management, multi-language code generation, and model bridging, reducing coding workload and entry barriers while improving efficiency.
|
||||
|
||||
|
||||
- **Platform Lock-in Resolution**
|
||||
The PCM effectively addresses platform lock-in issues through multi-cloud adaptation, standardized interfaces, and abstraction layers. This enables cross-platform operations, deployment, and interaction. Standardized interfaces simplify the work for developers, lowering the risk of platform lock-in.
|
||||
|
||||
## Quick Start
|
||||
|
||||
---
|
||||
- **Reduced Code Development Complexity**
|
||||
The PCM development framework lowers the complexity of development by providing structured development patterns, ready-made components, and documentation support. Developers of different skill levels can collaborate more fairly. The framework can save approximately 50% of development time, with junior programmers completing tasks that originally required one person-month in about 15 person-days. Features such as automatic generation tools, code templates, and component reuse allow developers to focus more on business logic implementation. There is no need for additional training of advanced developers, saving time, and reducing labor costs while improving the return on investment.
|
||||
|
||||
```
|
||||
# clone
|
||||
git clone https://gitlink.org.cn/JCCE/PCM.git
|
||||
|
||||
# get required packages
|
||||
go mod tidy
|
||||
- **Reduced Code Development Workload**
|
||||
The PCM framework offers automation features and code generation tools, reducing manual code writing and improving development speed and code quality. With the framework's auto-generation tools, over half of the code is generated, achieving a low code rate of approximately 63%. Developers primarily work on writing descriptive language files to generate the basic structure and then adjust and write logic functions. This enables teams to deliver products more quickly, iterate based on business optimization and user feedback, and be more agile.
|
||||
|
||||
# build pcm components
|
||||
make build
|
||||
|
||||
# start service
|
||||
nohup ./pcm-gateway &> pcm-gateway.log &
|
||||
nohup ./pcm-pod &> pcm-pod.log &
|
||||
nohup ./pcm-vm &> pcm-vm.log &
|
||||
nohup ./pcm-slurm &> pcm-slurm.log &
|
||||
## Architecture
|
||||
The Coordinator is the core component of the framework, providing heterogeneous abstraction for different Participant-side technology stacks. The framework, oriented towards the user side, primarily involves two major functionalities: resource changes (task submission) and centralized display. After task submission, PCM achieves dynamic task flow through a scheduling center deployed on cloud computing, intelligent computing, and supercomputing clouds. In the centralized display section, PCM mainly collects and aggregates information about resources and tasks from multiple Participant services through Tracker and actively reported by the Participant side. It provides users with a standardized unified interface. Users can view the information provided by PCM on the frontend page or directly access data through the interface.
|
||||
|
||||

|
||||
## PCM deploy
|
||||
|
||||
The development environment for PCM requires the installation of Go version 1.18 or above. Please refer to the following instructions to locally start the Kubernetes-related services.
|
||||
|
||||
The command to fetch the project is as follows:
|
||||
```bash
|
||||
git clone https://gitlink.org.cn/JointCloud/pcm-coordinator.git
|
||||
```
|
||||
|
||||
If the startup is successful, the 'gateway' will listen on the '8880' port by default, and no error is reported in the log. The above is a simple demonstration using nohup. It is recommended that the production environment should be hosted by systemd. The relevant service files can be found in the etc/service directory for reference.
|
||||
|
||||
After executing the following command, the Kubernetes RPC service will be launched locally. For its specific functionalities, please refer to the description in the architecture design mentioned earlier.
|
||||
``` bash
|
||||
# get required packages
|
||||
go mod tidy
|
||||
|
||||
# run rpc service
|
||||
go run pcm-coordinator/rpc/pcmcore.go
|
||||
```
|
||||
#### coordinator-api
|
||||
The template for the configuration content of the API service is as follows, where the config information for each Participant (P-side) can be configured as needed based on the actual situation.
|
||||
``` bash
|
||||
Name: pcm.core.api
|
||||
Host: 0.0.0.0
|
||||
Port: 8999
|
||||
|
||||
DB:
|
||||
DataSource: username:password@(x.x.x.x:3306)/pcm?parseTime=true Redis:
|
||||
Host: x.x.x.x:portnumber Pass: password
|
||||
|
||||
# k8s rpc
|
||||
K8sNativeConf:
|
||||
Endpoints: - 127.0.0.1:2003 NonBlock: true
|
||||
#slurm rpc
|
||||
THRpcConf:
|
||||
Endpoints: - 127.0.0.1:2007NonBlock: true
|
||||
|
||||
#modelarts rpc
|
||||
ModelArtsRpcConf:
|
||||
Endpoints: - 127.0.0.1:2002NonBlock: true
|
||||
```
|
||||
After executing the following command, the Kubernetes API service will be launched locally. Once the service is started, users can make HTTP requests to its interfaces for various functional calls.
|
||||
``` bash
|
||||
# get required packages
|
||||
go mod tidy
|
||||
|
||||
# run rpc service
|
||||
go run pcm-coordinator/api/pcm.go
|
||||
```
|
||||
|
||||
## Upcoming Plans
|
||||
|
||||
- Pluginization of Scheduling Algorithms and Definition of Basic Resource Templates.
|
||||
- Fundamental Definition of Resource Operation Types.
|
||||
- Rapid Development Mode.
|
||||
- Implementation of First-level Scheduling.
|
||||
|
||||
## Join&Contribute
|
||||
We look forward to your opinions and contributions. Welcome all friends to provide corrections and improvements to the project, collectively building an efficient and stable cloud collaboration mechanism.
|
|
@ -1,15 +0,0 @@
|
|||
NacosConfig:
|
||||
DataId: pcm-hanwuji-rpc.yaml
|
||||
Group: DEFAULT_GROUP
|
||||
ServerConfigs:
|
||||
# - IpAddr: 127.0.0.1
|
||||
# Port: 8848
|
||||
- IpAddr: 10.101.15.7
|
||||
Port: 8848
|
||||
ClientConfig:
|
||||
NamespaceId: test
|
||||
TimeoutMs: 5000
|
||||
NotLoadCacheAtStart: true
|
||||
LogDir:
|
||||
CacheDir:
|
||||
LogLevel: debug
|
|
@ -1,250 +0,0 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v3.19.4
|
||||
// source: pcm-hanwuji.proto
|
||||
|
||||
package hanwuji
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type CreateDataSetReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ApplyIds []string `protobuf:"bytes,1,rep,name=applyIds,proto3" json:"applyIds,omitempty"` // @gotags: copier:"ApplyIds"
|
||||
Desc string `protobuf:"bytes,2,opt,name=desc,proto3" json:"desc,omitempty"` // @gotags: copier:"Desc"
|
||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // @gotags: copier:"Name"
|
||||
TypeId string `protobuf:"bytes,4,opt,name=typeId,proto3" json:"typeId,omitempty"` // @gotags: copier:"TypeId"
|
||||
}
|
||||
|
||||
func (x *CreateDataSetReq) Reset() {
|
||||
*x = CreateDataSetReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pcm_hanwuji_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *CreateDataSetReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateDataSetReq) ProtoMessage() {}
|
||||
|
||||
func (x *CreateDataSetReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pcm_hanwuji_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CreateDataSetReq.ProtoReflect.Descriptor instead.
|
||||
func (*CreateDataSetReq) Descriptor() ([]byte, []int) {
|
||||
return file_pcm_hanwuji_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *CreateDataSetReq) GetApplyIds() []string {
|
||||
if x != nil {
|
||||
return x.ApplyIds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CreateDataSetReq) GetDesc() string {
|
||||
if x != nil {
|
||||
return x.Desc
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateDataSetReq) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateDataSetReq) GetTypeId() string {
|
||||
if x != nil {
|
||||
return x.TypeId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CreateDataSetResq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // @gotags: copier:"Id"
|
||||
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // @gotags: copier:"Version"
|
||||
}
|
||||
|
||||
func (x *CreateDataSetResq) Reset() {
|
||||
*x = CreateDataSetResq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pcm_hanwuji_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *CreateDataSetResq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateDataSetResq) ProtoMessage() {}
|
||||
|
||||
func (x *CreateDataSetResq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pcm_hanwuji_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CreateDataSetResq.ProtoReflect.Descriptor instead.
|
||||
func (*CreateDataSetResq) Descriptor() ([]byte, []int) {
|
||||
return file_pcm_hanwuji_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *CreateDataSetResq) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateDataSetResq) GetVersion() string {
|
||||
if x != nil {
|
||||
return x.Version
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_pcm_hanwuji_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_pcm_hanwuji_proto_rawDesc = []byte{
|
||||
0x0a, 0x11, 0x70, 0x63, 0x6d, 0x2d, 0x68, 0x61, 0x6e, 0x77, 0x75, 0x6a, 0x69, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x12, 0x07, 0x68, 0x61, 0x6e, 0x77, 0x75, 0x6a, 0x69, 0x22, 0x6e, 0x0a, 0x10,
|
||||
0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71,
|
||||
0x12, 0x1a, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03,
|
||||
0x28, 0x09, 0x52, 0x08, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x64, 0x73, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x64, 0x65, 0x73, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x65, 0x73, 0x63,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x79, 0x70, 0x65, 0x49, 0x64, 0x18, 0x04,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x79, 0x70, 0x65, 0x49, 0x64, 0x22, 0x3d, 0x0a, 0x11,
|
||||
0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73,
|
||||
0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69,
|
||||
0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x32, 0x51, 0x0a, 0x07, 0x48,
|
||||
0x61, 0x6e, 0x77, 0x75, 0x6a, 0x69, 0x12, 0x46, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
|
||||
0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x12, 0x19, 0x2e, 0x68, 0x61, 0x6e, 0x77, 0x75, 0x6a,
|
||||
0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52,
|
||||
0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x68, 0x61, 0x6e, 0x77, 0x75, 0x6a, 0x69, 0x2e, 0x43, 0x72, 0x65,
|
||||
0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x71, 0x42, 0x0a,
|
||||
0x5a, 0x08, 0x2f, 0x68, 0x61, 0x6e, 0x77, 0x75, 0x6a, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_pcm_hanwuji_proto_rawDescOnce sync.Once
|
||||
file_pcm_hanwuji_proto_rawDescData = file_pcm_hanwuji_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_pcm_hanwuji_proto_rawDescGZIP() []byte {
|
||||
file_pcm_hanwuji_proto_rawDescOnce.Do(func() {
|
||||
file_pcm_hanwuji_proto_rawDescData = protoimpl.X.CompressGZIP(file_pcm_hanwuji_proto_rawDescData)
|
||||
})
|
||||
return file_pcm_hanwuji_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_pcm_hanwuji_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_pcm_hanwuji_proto_goTypes = []interface{}{
|
||||
(*CreateDataSetReq)(nil), // 0: hanwuji.CreateDataSetReq
|
||||
(*CreateDataSetResq)(nil), // 1: hanwuji.CreateDataSetResq
|
||||
}
|
||||
var file_pcm_hanwuji_proto_depIdxs = []int32{
|
||||
0, // 0: hanwuji.Hanwuji.CreateDataSet:input_type -> hanwuji.CreateDataSetReq
|
||||
1, // 1: hanwuji.Hanwuji.CreateDataSet:output_type -> hanwuji.CreateDataSetResq
|
||||
1, // [1:2] is the sub-list for method output_type
|
||||
0, // [0:1] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_pcm_hanwuji_proto_init() }
|
||||
func file_pcm_hanwuji_proto_init() {
|
||||
if File_pcm_hanwuji_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_pcm_hanwuji_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CreateDataSetReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_pcm_hanwuji_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CreateDataSetResq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_pcm_hanwuji_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_pcm_hanwuji_proto_goTypes,
|
||||
DependencyIndexes: file_pcm_hanwuji_proto_depIdxs,
|
||||
MessageInfos: file_pcm_hanwuji_proto_msgTypes,
|
||||
}.Build()
|
||||
File_pcm_hanwuji_proto = out.File
|
||||
file_pcm_hanwuji_proto_rawDesc = nil
|
||||
file_pcm_hanwuji_proto_goTypes = nil
|
||||
file_pcm_hanwuji_proto_depIdxs = nil
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.19.4
|
||||
// source: pcm-hanwuji.proto
|
||||
|
||||
package hanwuji
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// HanwujiClient is the client API for Hanwuji service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type HanwujiClient interface {
|
||||
//get modelarts Token
|
||||
CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error)
|
||||
}
|
||||
|
||||
type hanwujiClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewHanwujiClient(cc grpc.ClientConnInterface) HanwujiClient {
|
||||
return &hanwujiClient{cc}
|
||||
}
|
||||
|
||||
func (c *hanwujiClient) CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error) {
|
||||
out := new(CreateDataSetResq)
|
||||
err := c.cc.Invoke(ctx, "/hanwuji.Hanwuji/CreateDataSet", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// HanwujiServer is the server API for Hanwuji service.
|
||||
// All implementations must embed UnimplementedHanwujiServer
|
||||
// for forward compatibility
|
||||
type HanwujiServer interface {
|
||||
//get modelarts Token
|
||||
CreateDataSet(context.Context, *CreateDataSetReq) (*CreateDataSetResq, error)
|
||||
mustEmbedUnimplementedHanwujiServer()
|
||||
}
|
||||
|
||||
// UnimplementedHanwujiServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedHanwujiServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedHanwujiServer) CreateDataSet(context.Context, *CreateDataSetReq) (*CreateDataSetResq, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateDataSet not implemented")
|
||||
}
|
||||
func (UnimplementedHanwujiServer) mustEmbedUnimplementedHanwujiServer() {}
|
||||
|
||||
// UnsafeHanwujiServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to HanwujiServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeHanwujiServer interface {
|
||||
mustEmbedUnimplementedHanwujiServer()
|
||||
}
|
||||
|
||||
func RegisterHanwujiServer(s grpc.ServiceRegistrar, srv HanwujiServer) {
|
||||
s.RegisterService(&Hanwuji_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Hanwuji_CreateDataSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateDataSetReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(HanwujiServer).CreateDataSet(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/hanwuji.Hanwuji/CreateDataSet",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(HanwujiServer).CreateDataSet(ctx, req.(*CreateDataSetReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Hanwuji_ServiceDesc is the grpc.ServiceDesc for Hanwuji service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Hanwuji_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "hanwuji.Hanwuji",
|
||||
HandlerType: (*HanwujiServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "CreateDataSet",
|
||||
Handler: _Hanwuji_CreateDataSet_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "pcm-hanwuji.proto",
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
// Code generated by goctl. DO NOT EDIT.
|
||||
// Source: pcm-hanwuji.proto
|
||||
|
||||
package hanwujiclient
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-HANWUJI/rpc/hanwuji"
|
||||
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type (
|
||||
CreateDataSetReq = hanwuji.CreateDataSetReq
|
||||
CreateDataSetResq = hanwuji.CreateDataSetResq
|
||||
|
||||
Hanwuji interface {
|
||||
// get modelarts Token
|
||||
CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error)
|
||||
}
|
||||
|
||||
defaultHanwuji struct {
|
||||
cli zrpc.Client
|
||||
}
|
||||
)
|
||||
|
||||
func NewHanwuji(cli zrpc.Client) Hanwuji {
|
||||
return &defaultHanwuji{
|
||||
cli: cli,
|
||||
}
|
||||
}
|
||||
|
||||
// get modelarts Token
|
||||
func (m *defaultHanwuji) CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error) {
|
||||
client := hanwuji.NewHanwujiClient(m.cli.Conn())
|
||||
return client.CreateDataSet(ctx, in, opts...)
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package config
|
||||
|
||||
import "github.com/zeromicro/go-zero/zrpc"
|
||||
|
||||
type Config struct {
|
||||
zrpc.RpcServerConf
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
// Code generated by goctl. DO NOT EDIT.
|
||||
// Source: pcm-hanwuji.proto
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-HANWUJI/rpc/hanwuji"
|
||||
"PCM/adaptor/PCM-AI/PCM-HANWUJI/rpc/internal/logic"
|
||||
"PCM/adaptor/PCM-AI/PCM-HANWUJI/rpc/internal/svc"
|
||||
)
|
||||
|
||||
type HanwujiServer struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
hanwuji.UnimplementedHanwujiServer
|
||||
}
|
||||
|
||||
func NewHanwujiServer(svcCtx *svc.ServiceContext) *HanwujiServer {
|
||||
return &HanwujiServer{
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
// get modelarts Token
|
||||
func (s *HanwujiServer) CreateDataSet(ctx context.Context, in *hanwuji.CreateDataSetReq) (*hanwuji.CreateDataSetResq, error) {
|
||||
l := logic.NewCreateDataSetLogic(ctx, s.svcCtx)
|
||||
return l.CreateDataSet(in)
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package svc
|
||||
|
||||
import "PCM/adaptor/PCM-AI/PCM-HANWUJI/rpc/internal/config"
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
FROM alpine:3.16.2
|
||||
WORKDIR /home
|
||||
|
||||
# 修改alpine源为上海交通大学
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.sjtug.sjtu.edu.cn/g' /etc/apk/repositories && \
|
||||
apk update && \
|
||||
apk upgrade && \
|
||||
apk add --no-cache ca-certificates && update-ca-certificates && \
|
||||
apk add --update tzdata && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
|
||||
COPY pcm-modelarts /home/
|
||||
COPY etc/pcmmodelarts.yaml /home/
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
EXPOSE 2003
|
||||
|
||||
ENTRYPOINT ./pcm-modelarts -f pcmmodelarts.yaml
|
|
@ -1,2 +0,0 @@
|
|||
rpc-gen:
|
||||
goctl rpc protoc ./pb/*.proto --go_out=./ --go-grpc_out=./ --zrpc_out=.
|
|
@ -1,15 +0,0 @@
|
|||
NacosConfig:
|
||||
DataId: pcm-modelarts-rpc.yaml
|
||||
Group: DEFAULT_GROUP
|
||||
ServerConfigs:
|
||||
# - IpAddr: 127.0.0.1
|
||||
# Port: 8848
|
||||
- IpAddr: 10.101.15.7
|
||||
Port: 8848
|
||||
ClientConfig:
|
||||
NamespaceId: test
|
||||
TimeoutMs: 5000
|
||||
NotLoadCacheAtStart: true
|
||||
LogDir:
|
||||
CacheDir:
|
||||
LogLevel: debug
|
|
@ -1,68 +0,0 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
IAMUser = "pcmmodelarts"
|
||||
IAMPassword = "!QAZ2wsx3edc4"
|
||||
IAMDomain = "hid_btkv2tt4_rcdv0q"
|
||||
AuthMethod = "password"
|
||||
IAMTokenUrl = "https://iam.cn-north-4.myhuaweicloud.com/v3/auth/tokens"
|
||||
ProjectName = "cn-north-4"
|
||||
TokenHeader = "X-Subject-Token"
|
||||
Status_created = 201
|
||||
)
|
||||
|
||||
var (
|
||||
token, expiredAt = GenerateToken()
|
||||
)
|
||||
|
||||
func GenerateToken() (string, time.Time) {
|
||||
a := Auth{}
|
||||
a.Auth.Scope.Project.Name = ProjectName
|
||||
a.Auth.Identity.Methods = append(a.Auth.Identity.Methods, AuthMethod)
|
||||
a.Auth.Identity.Password.User.Name = IAMUser
|
||||
a.Auth.Identity.Password.User.Password = IAMPassword
|
||||
a.Auth.Identity.Password.User.Domain.Name = IAMDomain
|
||||
|
||||
jsonStr, _ := json.Marshal(a)
|
||||
req_url, err := http.NewRequest("POST", IAMTokenUrl, bytes.NewBuffer(jsonStr))
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
c := http.Client{Timeout: time.Duration(3) * time.Second}
|
||||
|
||||
respUrl, err := c.Do(req_url)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if respUrl.StatusCode != Status_created {
|
||||
panic("获取token失败")
|
||||
}
|
||||
|
||||
defer respUrl.Body.Close()
|
||||
|
||||
var t Token
|
||||
|
||||
result, _ := io.ReadAll(respUrl.Body)
|
||||
json.Unmarshal(result, &t)
|
||||
|
||||
return respUrl.Header.Get(TokenHeader), t.Token.ExpiresAt
|
||||
}
|
||||
|
||||
func GetToken() string {
|
||||
if time.Now().After(expiredAt) {
|
||||
token, expiredAt = GenerateToken()
|
||||
}
|
||||
return token
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
package common
|
||||
|
||||
import "time"
|
||||
|
||||
type Token struct {
|
||||
Token struct {
|
||||
ExpiresAt time.Time `json:"expires_at"`
|
||||
Methods []string `json:"methods"`
|
||||
Catalog []struct {
|
||||
Endpoints []struct {
|
||||
Id string `json:"id"`
|
||||
Interface string `json:"interface"`
|
||||
Region string `json:"region"`
|
||||
RegionId string `json:"region_id"`
|
||||
Url string `json:"url"`
|
||||
} `json:"endpoints"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
} `json:"catalog"`
|
||||
Roles []struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"roles"`
|
||||
Project struct {
|
||||
Domain struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"domain"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"project"`
|
||||
IssuedAt time.Time `json:"issued_at"`
|
||||
User struct {
|
||||
Domain struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"domain"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
PasswordExpiresAt string `json:"password_expires_at"`
|
||||
} `json:"user"`
|
||||
} `json:"token"`
|
||||
}
|
||||
|
||||
type Auth struct {
|
||||
Auth struct {
|
||||
Identity struct {
|
||||
Methods []string `json:"methods"`
|
||||
Password struct {
|
||||
User struct {
|
||||
Name string `json:"name"`
|
||||
Password string `json:"password"`
|
||||
Domain struct {
|
||||
Name string `json:"name"`
|
||||
} `json:"domain"`
|
||||
} `json:"user"`
|
||||
} `json:"password"`
|
||||
} `json:"identity"`
|
||||
Scope struct {
|
||||
Project struct {
|
||||
Name string `json:"name"`
|
||||
} `json:"project"`
|
||||
} `json:"scope"`
|
||||
} `json:"auth"`
|
||||
}
|
||||
|
||||
type Error struct {
|
||||
ErrorCode string `json:"error_code"`
|
||||
ErrorMsg string `json:"error_msg"`
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
zrpc.RpcServerConf
|
||||
LogConf logx.LogConf
|
||||
PcmCoreRpcConf zrpc.RpcClientConf
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type CreateAlgorithmLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewCreateAlgorithmLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateAlgorithmLogic {
|
||||
return &CreateAlgorithmLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// CreateAlgorithm 创建算法
|
||||
func (l *CreateAlgorithmLogic) CreateAlgorithm(in *modelarts.CreateAlgorithmReq) (*modelarts.CreateAlgorithmResp, error) {
|
||||
var resp modelarts.CreateAlgorithmResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/algorithms"
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, url, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 201 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode == 400 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateDataSetLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewCreateDataSetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateDataSetLogic {
|
||||
return &CreateDataSetLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// create DateSet
|
||||
func (l *CreateDataSetLogic) CreateDataSet(in *modelarts.CreateDataSetReq) (*modelarts.CreateDataSetResq, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp modelarts.CreateDataSetResq
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/datasets"
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
body, err := tool.HttpClient(tool.POST, url, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
if &resp == nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package logic
|
||||
|
||||
/*
|
||||
desc: "AI core微服务"
|
||||
author: "xie"
|
||||
*/
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateModelLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewCreateModelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateModelLogic {
|
||||
return &CreateModelLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// model management
|
||||
func (l *CreateModelLogic) CreateModel(in *modelarts.CreateModelReq) (*modelarts.CreateModelResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp modelarts.CreateModelResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/" + in.ProjectId + "/models"
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
body, err := tool.HttpClient(tool.POST, url, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateNotebookLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewCreateNotebookLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateNotebookLogic {
|
||||
return &CreateNotebookLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateNotebookLogic) CreateNotebook(in *modelarts.CreateNotebookReq) (*modelarts.CreateNotebookResp, error) {
|
||||
resp := &modelarts.CreateNotebookResp{}
|
||||
createUrl := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/{project_id}/notebooks"
|
||||
|
||||
token := common.GetToken()
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
res, err := req.
|
||||
SetHeader("x-auth-token", token).
|
||||
SetPathParam("project_id", in.ProjectId).
|
||||
SetBody(in.Param).
|
||||
SetResult(resp.NotebookResp).
|
||||
Post(createUrl)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if res.StatusCode() != 200 || res.StatusCode() != 201 {
|
||||
resp.Code = int32(res.StatusCode())
|
||||
resp.Msg = "Failure"
|
||||
|
||||
var errMsg common.Error
|
||||
err := json.Unmarshal(res.Body(), &errMsg)
|
||||
if err != nil {
|
||||
errMsg.ErrorMsg = ""
|
||||
}
|
||||
resp.ErrorMsg = errMsg.ErrorMsg
|
||||
} else {
|
||||
resp.Code = int32(res.StatusCode())
|
||||
resp.Msg = "Success"
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package logic
|
||||
|
||||
/*
|
||||
desc: "AI core微服务"
|
||||
author: "xie"
|
||||
*/
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateProcessorTaskLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewCreateProcessorTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateProcessorTaskLogic {
|
||||
return &CreateProcessorTaskLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// processor task
|
||||
func (l *CreateProcessorTaskLogic) CreateProcessorTask(in *modelarts.CreateProcessorTaskReq) (*modelarts.CreateProcessorTaskResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp modelarts.CreateProcessorTaskResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/processor-tasks/"
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
body, err := tool.HttpClient(tool.POST, url, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
package logic
|
||||
|
||||
/*
|
||||
desc: "AI core微服务"
|
||||
author: "xie"
|
||||
*/
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
)
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type CreateServiceLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewCreateServiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateServiceLogic {
|
||||
return &CreateServiceLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// service management
|
||||
func (l *CreateServiceLogic) CreateService(in *modelarts.CreateServiceReq) (*modelarts.CreateServiceResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp modelarts.CreateServiceResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/" + in.ProjectId + "/services"
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, url, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateTaskLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewCreateTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateTaskLogic {
|
||||
return &CreateTaskLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// creat task 创建导入任务
|
||||
func (l *CreateTaskLogic) CreateTask(in *modelarts.ImportTaskDataReq) (*modelarts.ImportTaskDataResp, error) {
|
||||
var resp modelarts.ImportTaskDataResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/datasets/" + in.DatasetId + "/import-tasks"
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, url, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateTrainingJobConfigLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewCreateTrainingJobConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateTrainingJobConfigLogic {
|
||||
return &CreateTrainingJobConfigLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// CreateTrainingJobConfig 创建训练作业参数
|
||||
func (l *CreateTrainingJobConfigLogic) CreateTrainingJobConfig(in *modelarts.CreateTrainingJobConfigReq) (*modelarts.CreateTrainingJobConfigResp, error) {
|
||||
var resp modelarts.CreateTrainingJobConfigResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/" + in.ProjectId + "/training-job-configs"
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
body, err := tool.HttpClient(tool.POST, url, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
if &resp == nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateTrainingJobLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewCreateTrainingJobLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateTrainingJobLogic {
|
||||
return &CreateTrainingJobLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// CreateTrainingJob 创建训练作业
|
||||
func (l *CreateTrainingJobLogic) CreateTrainingJob(in *modelarts.CreateTrainingJobReq) (*modelarts.CreateTrainingJobResp, error) {
|
||||
var resp modelarts.CreateTrainingJobResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/training-jobs"
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, url, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 201 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 201 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateVisualizationJobLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewCreateVisualizationJobLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateVisualizationJobLogic {
|
||||
return &CreateVisualizationJobLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateVisualizationJobLogic) CreateVisualizationJob(in *modelarts.CreateVisualizationJobReq) (*modelarts.CreateVisualizationJobResp, error) {
|
||||
var resp modelarts.CreateVisualizationJobResp
|
||||
createVisualJobUrl := "https://modelarts.cn-east-3.myhuaweicloud.com/v1/{project_id}/visualization-jobs"
|
||||
createVisualJobUrl = strings.Replace(createVisualJobUrl, "{project_id}", in.ProjectId, -1)
|
||||
|
||||
reqByte, err := json.Marshal(in.Param)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
body, err := tool.HttpClient(tool.POST, createVisualJobUrl, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/adaptor/PCM-CORE/rpc/pcmcoreclient"
|
||||
"context"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"time"
|
||||
)
|
||||
|
||||
func InitCron(svc *svc.ServiceContext) {
|
||||
submitJobLogic := NewCreateTrainingJobLogic(context.Background(), svc)
|
||||
listLogic := NewGetListTrainingJobsLogic(context.Background(), svc)
|
||||
svc.Cron.AddFunc("*/5 * * * * ?", func() {
|
||||
syncInfoReq := pcmcoreclient.SyncInfoReq{
|
||||
Kind: "ai",
|
||||
ServiceName: "modelArts",
|
||||
}
|
||||
// 查询core端分发下来的任务列表
|
||||
infoList, err := queryCoreInfoList(svc)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return
|
||||
}
|
||||
// 提交任务
|
||||
submitJob(infoList, submitJobLogic)
|
||||
// 查询运行中的任务列表同步信息
|
||||
listReq := modelarts.ListTrainingJobsreq{
|
||||
ProjectId: "0a62ffb0d48026c12fbfc011b8d23f0b",
|
||||
Limit: 10,
|
||||
OffSet: 0,
|
||||
}
|
||||
listJob, err := listLogic.GetListTrainingJobs(&listReq)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return
|
||||
}
|
||||
for index, _ := range infoList.AiInfoList {
|
||||
for _, job := range listJob.Items {
|
||||
if job.Metadata.Name == infoList.AiInfoList[index].Name {
|
||||
infoList.AiInfoList[index].ProjectId = job.ProjectId
|
||||
infoList.AiInfoList[index].JobId = job.Metadata.Id
|
||||
createTime := time.Unix(int64(job.Metadata.CreateTime)/1000, 0)
|
||||
infoList.AiInfoList[index].CreateTime = time.Time.String(createTime)
|
||||
if job.Status.StartTime != 0 {
|
||||
startTime := time.Unix(int64(job.Status.StartTime)/1000, 0)
|
||||
infoList.AiInfoList[index].StartTime = time.Time.String(startTime)
|
||||
}
|
||||
infoList.AiInfoList[index].RunningTime = int64(job.Status.Duration) / 1000
|
||||
infoList.AiInfoList[index].Status = job.Status.Phase
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// 同步信息到core端
|
||||
if len(infoList.AiInfoList) != 0 {
|
||||
syncInfoReq.AiInfoList = infoList.AiInfoList
|
||||
svc.PcmCoreRpc.SyncInfo(context.Background(), &syncInfoReq)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func submitJob(infoList *pcmcoreclient.InfoListResp, submitJobLogic *CreateTrainingJobLogic) {
|
||||
for index, _ := range infoList.AiInfoList {
|
||||
if infoList.AiInfoList[index].Status == "Saved" {
|
||||
submitReq := modelarts.CreateTrainingJobReq{
|
||||
Kind: "job",
|
||||
ProjectId: "0a62ffb0d48026c12fbfc011b8d23f0b",
|
||||
Metadata: &modelarts.MetadataS{
|
||||
Name: infoList.AiInfoList[index].Name,
|
||||
WorkspaceId: "0",
|
||||
Description: "This is a ModelArts Demo Job",
|
||||
},
|
||||
Algorithm: &modelarts.Algorithms{
|
||||
Command: infoList.AiInfoList[index].Command,
|
||||
Engine: &modelarts.EngineCreateTraining{
|
||||
ImageUrl: infoList.AiInfoList[index].ImageUrl,
|
||||
},
|
||||
},
|
||||
Spec: &modelarts.SpecsC{
|
||||
Resource: &modelarts.ResourceCreateTraining{
|
||||
FlavorId: infoList.AiInfoList[index].FlavorId,
|
||||
NodeCount: 1,
|
||||
},
|
||||
},
|
||||
}
|
||||
jobResult, _ := submitJobLogic.CreateTrainingJob(&submitReq)
|
||||
if jobResult.Code == 200 {
|
||||
infoList.AiInfoList[index].Status = jobResult.Status.Phase
|
||||
infoList.AiInfoList[index].ProjectId = jobResult.Metadata.Id
|
||||
} else {
|
||||
infoList.AiInfoList[index].Result = "Failed"
|
||||
infoList.AiInfoList[index].Result = jobResult.Msg
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func queryCoreInfoList(svc *svc.ServiceContext) (*pcmcoreclient.InfoListResp, error) {
|
||||
infoReq := pcmcoreclient.InfoListReq{
|
||||
Kind: "ai",
|
||||
ServiceName: "modelArts",
|
||||
}
|
||||
infoList, err := svc.PcmCoreRpc.InfoList(context.Background(), &infoReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return infoList, nil
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteAlgorithmsLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewDeleteAlgorithmsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteAlgorithmsLogic {
|
||||
return &DeleteAlgorithmsLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteAlgorithms 删除算法
|
||||
func (l *DeleteAlgorithmsLogic) DeleteAlgorithms(in *modelarts.DeleteAlgorithmsReq) (*modelarts.DeleteAlgorithmsResp, error) {
|
||||
var resp modelarts.DeleteAlgorithmsResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/algorithms/" + in.AlgorithmId
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, url, payload, token)
|
||||
if statusCode == 202 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 202 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteDataSetLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewDeleteDataSetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteDataSetLogic {
|
||||
return &DeleteDataSetLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// create DateSet
|
||||
func (l *DeleteDataSetLogic) DeleteDataSet(in *modelarts.DeleteDataSetReq) (*modelarts.DeleteDataSetResq, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp modelarts.DeleteDataSetResq
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/datasets/" + in.DatasetId
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
body, err := tool.HttpClient(tool.DELETE, url, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package logic
|
||||
|
||||
/*
|
||||
desc: "AI core微服务"
|
||||
author: "xie"
|
||||
*/
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteModelLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewDeleteModelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteModelLogic {
|
||||
return &DeleteModelLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteModelLogic) DeleteModel(in *modelarts.DeleteModelReq) (*modelarts.DeleteModelResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp modelarts.DeleteModelResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/" + in.ProjectId + "/models/" + in.ModelId
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
body, err := tool.HttpClient(tool.DELETE, url, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package logic
|
||||
|
||||
/*
|
||||
desc: "AI core微服务"
|
||||
author: "xie"
|
||||
*/
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteServiceLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewDeleteServiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteServiceLogic {
|
||||
return &DeleteServiceLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteServiceLogic) DeleteService(in *modelarts.DeleteServiceReq) (*modelarts.DeleteServiceResp, error) {
|
||||
var resp modelarts.DeleteServiceResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/" + in.ProjectId + "/services/" + in.ServiceId
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, url, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteTrainingJobConfigLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewDeleteTrainingJobConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteTrainingJobConfigLogic {
|
||||
return &DeleteTrainingJobConfigLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteTrainingJobConfig 删除训练作业参数
|
||||
func (l *DeleteTrainingJobConfigLogic) DeleteTrainingJobConfig(in *modelarts.DeleteTrainingJobConfigReq) (*modelarts.DeleteTrainingJobConfigResp, error) {
|
||||
var resp modelarts.DeleteTrainingJobConfigResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/" + in.ProjectId + "/training-job-configs/" + in.ConfigName
|
||||
token := common.GetToken()
|
||||
body, err := tool.HttpClient(tool.DELETE, url, strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
if &resp == nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type DeleteTrainingJobLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewDeleteTrainingJobLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteTrainingJobLogic {
|
||||
return &DeleteTrainingJobLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteTrainingJobConfig 删除训练作业
|
||||
func (l *DeleteTrainingJobLogic) DeleteTrainingJob(in *modelarts.DeleteTrainingJobReq) (*modelarts.DeleteTrainingJobResp, error) {
|
||||
var resp modelarts.DeleteTrainingJobResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/training-jobs/" + in.TrainingJobId
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, url, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 202 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 202 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package logic
|
||||
|
||||
/*
|
||||
desc: "AI core微服务"
|
||||
author: "xie"
|
||||
*/
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DescribeProcessorTaskLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewDescribeProcessorTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DescribeProcessorTaskLogic {
|
||||
return &DescribeProcessorTaskLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DescribeProcessorTaskLogic) DescribeProcessorTask(in *modelarts.DescribeProcessorTaskReq) (*modelarts.DescribeProcessorTaskResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp modelarts.DescribeProcessorTaskResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/processor-tasks/" + in.TaskId
|
||||
token := common.GetToken()
|
||||
body, err := tool.HttpClient(tool.GET, url, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
package logic
|
||||
|
||||
/*
|
||||
desc: "AI core微服务"
|
||||
author: "xie"
|
||||
*/
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
_ "PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ExportTaskLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewExportTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ExportTaskLogic {
|
||||
return &ExportTaskLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// ExportTask for modelarts
|
||||
func (l *ExportTaskLogic) ExportTask(in *modelarts.ExportTaskReq) (*modelarts.ExportTaskDataResp, error) {
|
||||
var resp modelarts.ExportTaskDataResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/datasets/" + in.DatasetId + "/export-tasks"
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, url, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type GetDatasetListLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetDatasetListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDatasetListLogic {
|
||||
return &GetDatasetListLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// find datasetList
|
||||
func (l *GetDatasetListLogic) GetDatasetList(in *modelarts.DataSetReq) (*modelarts.DataSetResp, error) {
|
||||
projectId := in.ProjectId
|
||||
var resp modelarts.DataSetResp
|
||||
offset := strconv.Itoa(int(in.Offset))
|
||||
judgeLimit := strconv.Itoa(int(in.Limit))
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, "https://modelarts.cn-north-4.myhuaweicloud.com/v2/"+projectId+"/datasets?offset="+offset+"&"+"limit="+judgeLimit, strings.NewReader(``), token)
|
||||
//statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, "https://modelarts.cn-north-4.myhuaweicloud.com/v2/"+projectId+"/datasets", strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
package logic
|
||||
|
||||
/*
|
||||
desc: "AI core微服务"
|
||||
author: "xie"
|
||||
*/
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetExportTasksOfDatasetLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetExportTasksOfDatasetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetExportTasksOfDatasetLogic {
|
||||
return &GetExportTasksOfDatasetLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
//type Pppp struct {
|
||||
// TotalCount int `json:"total_count"`
|
||||
// ExportTasks []*Modelarts.ExportTaskStatus `json:"export_tasks"`
|
||||
//}
|
||||
|
||||
func (l *GetExportTasksOfDatasetLogic) GetExportTasksOfDataset(in *modelarts.GetExportTasksOfDatasetReq) (*modelarts.GetExportTasksOfDatasetResp, error) {
|
||||
var resp modelarts.GetExportTasksOfDatasetResp
|
||||
limit := strconv.Itoa(int(in.Limit))
|
||||
offset := strconv.Itoa(int(in.Offset))
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/datasets/" + in.DatasetId + "/export-tasks?limit=" + limit + "&offset=" + offset
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, url, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 202 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package logic
|
||||
|
||||
/*
|
||||
desc: "AI core微服务"
|
||||
author: "xie"
|
||||
*/
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetExportTaskStatusOfDatasetLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetExportTaskStatusOfDatasetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetExportTaskStatusOfDatasetLogic {
|
||||
return &GetExportTaskStatusOfDatasetLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetExportTaskStatusOfDatasetLogic) GetExportTaskStatusOfDataset(in *modelarts.GetExportTaskStatusOfDatasetReq) (*modelarts.GetExportTaskStatusOfDatasetResp, error) {
|
||||
var resp modelarts.GetExportTaskStatusOfDatasetResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/datasets/" + in.ResourceId + "/export-tasks/" + in.TaskId
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, url, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
if statusCode == 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"log"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetImportTaskListLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetImportTaskListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetImportTaskListLogic {
|
||||
return &GetImportTaskListLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// find taskList 查询数据集导入任务列表
|
||||
func (l *GetImportTaskListLogic) GetImportTaskList(in *modelarts.ListImportTasksReq) (*modelarts.ListImportTasksResp, error) {
|
||||
var resp modelarts.ListImportTasksResp
|
||||
limit := strconv.Itoa(int(in.Limit))
|
||||
offset := strconv.Itoa(int(in.Offset))
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, "https://modelarts.cn-north-4.myhuaweicloud.com/v2/"+in.ProjectId+"/datasets/"+in.DatasetId+"/import-tasks?limit="+limit+"&offset="+offset, strings.NewReader(``), token)
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if statusCode == 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetListTrainingJobsLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetListTrainingJobsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetListTrainingJobsLogic {
|
||||
return &GetListTrainingJobsLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// get ListTrainingJobs1
|
||||
func (l *GetListTrainingJobsLogic) GetListTrainingJobs(in *modelarts.ListTrainingJobsreq) (*modelarts.ListTrainingJobsresp, error) {
|
||||
var resp modelarts.ListTrainingJobsresp
|
||||
limit := strconv.Itoa(int(in.Limit))
|
||||
offset := strconv.Itoa(int(in.OffSet))
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/training-job-searches?limit=" + limit + "&offset=" + offset
|
||||
reqByte, err := json.Marshal(in)
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, url, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
for index, _ := range resp.Items {
|
||||
resp.Items[index].ProjectId = in.ProjectId
|
||||
}
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetNotebookStorageLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetNotebookStorageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetNotebookStorageLogic {
|
||||
return &GetNotebookStorageLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetNotebookStorageLogic) GetNotebookStorage(in *modelarts.GetNotebookStorageReq) (*modelarts.GetNotebookStorageResp, error) {
|
||||
var resp modelarts.GetNotebookStorageResp
|
||||
getObsUrl := "https://modelarts.cn-east-3.myhuaweicloud.com/v1/{project_id}/notebooks/{instance_id}/storage"
|
||||
getObsUrl = strings.Replace(getObsUrl, "{project_id}", in.ProjectId, -1)
|
||||
getObsUrl = strings.Replace(getObsUrl, "{instance_id}", in.InstanceId, -1)
|
||||
|
||||
token := common.GetToken()
|
||||
|
||||
//empty struct
|
||||
var e struct{}
|
||||
|
||||
body, err := tool.HttpClientWithQueries(tool.GET, getObsUrl, nil, token, e)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetTokenLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetTokenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTokenLogic {
|
||||
return &GetTokenLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// getToken
|
||||
func (l *GetTokenLogic) GetToken(in *modelarts.TokenReq) (*modelarts.TokenResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
var resp modelarts.TokenResp
|
||||
TokenUrl := "v3/auth/tokens"
|
||||
|
||||
jsonStr, _ := json.Marshal(in)
|
||||
reqUrl, err := http.NewRequest("POST", "https://iam.cn-north-4.myhuaweicloud.com/"+TokenUrl, bytes.NewBuffer(jsonStr))
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer reqUrl.Body.Close()
|
||||
|
||||
c := http.Client{Timeout: time.Duration(3) * time.Second}
|
||||
|
||||
respUrl, err := c.Do(reqUrl)
|
||||
|
||||
print(respUrl)
|
||||
|
||||
defer respUrl.Body.Close()
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
result, _ := ioutil.ReadAll(respUrl.Body)
|
||||
json.Unmarshal([]byte(string(result)), &resp)
|
||||
|
||||
//X-Auth-Token := respUrl.Header().Get("X-Subject-Token")
|
||||
|
||||
//return resp, nil
|
||||
|
||||
return &modelarts.TokenResp{}, nil
|
||||
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetVisualizationJobLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetVisualizationJobLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetVisualizationJobLogic {
|
||||
return &GetVisualizationJobLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// visualization-jobs
|
||||
func (l *GetVisualizationJobLogic) GetVisualizationJob(in *modelarts.GetVisualizationJobReq) (*modelarts.GetVisualizationJobResp, error) {
|
||||
var resp modelarts.GetVisualizationJobResp
|
||||
getVisualJobUrl := "https://modelarts.cn-east-3.myhuaweicloud.com/v1/{project_id}/visualization-jobs"
|
||||
getVisualJobUrl = strings.Replace(getVisualJobUrl, "{project_id}", in.ProjectId, -1)
|
||||
|
||||
token := common.GetToken()
|
||||
|
||||
body, err := tool.HttpClientWithQueries(tool.GET, getVisualJobUrl, nil, token, in.Param)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type ListAlgorithmsLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewListAlgorithmsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListAlgorithmsLogic {
|
||||
return &ListAlgorithmsLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// ListAlgorithms 查询算法
|
||||
func (l *ListAlgorithmsLogic) ListAlgorithms(in *modelarts.ListAlgorithmsReq) (*modelarts.ListAlgorithmsResp, error) {
|
||||
var resp modelarts.ListAlgorithmsResp
|
||||
offset := strconv.Itoa(int(in.Offset))
|
||||
judgeLimit := strconv.Itoa(int(in.Limit))
|
||||
var limit string
|
||||
if judgeLimit != "0" {
|
||||
limit = strconv.Itoa(int(in.Limit))
|
||||
} else {
|
||||
limit = "10"
|
||||
}
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/algorithms?offset=" + offset + "&" + "limit=" + limit
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, url, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package logic
|
||||
|
||||
/*
|
||||
desc: "AI core微服务"
|
||||
author: "xie"
|
||||
*/
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListClustersLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewListClustersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListClustersLogic {
|
||||
return &ListClustersLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListClustersLogic) ListClusters(in *modelarts.ListClustersReq) (*modelarts.ListClustersResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp modelarts.ListClustersResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/" + in.ProjectId + "/clusters"
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, url, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
if statusCode == 200 {
|
||||
json.Unmarshal(body, &resp.Resp200)
|
||||
} else {
|
||||
json.Unmarshal(body, &resp.Resp400)
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
package logic
|
||||
|
||||
/*
|
||||
desc: "AI core微服务"
|
||||
author: "xie"
|
||||
*/
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListModelsLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewListModelsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListModelsLogic {
|
||||
return &ListModelsLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListModelsLogic) ListModels(in *modelarts.ListModelReq) (*modelarts.ListModelResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp modelarts.ListModelResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/" + in.ProjectId + "/models"
|
||||
token := common.GetToken()
|
||||
body, err := tool.HttpClient(tool.GET, url, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListNotebookLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewListNotebookLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListNotebookLogic {
|
||||
return &ListNotebookLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// notebook task
|
||||
func (l *ListNotebookLogic) ListNotebook(in *modelarts.ListNotebookReq) (*modelarts.ListNotebookResp, error) {
|
||||
resp := &modelarts.ListNotebookResp{}
|
||||
getUrl := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/{project_id}/notebooks"
|
||||
|
||||
token := common.GetToken()
|
||||
queryMap := tool.ConvertStructToMap(in.Param)
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
res, err := req.
|
||||
SetHeader("x-auth-token", token).
|
||||
SetPathParam("project_id", in.ProjectId).
|
||||
SetQueryParams(queryMap).
|
||||
SetResult(resp).
|
||||
Get(getUrl)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if res.StatusCode() != 200 {
|
||||
resp.Code = int32(res.StatusCode())
|
||||
resp.Msg = "Failure"
|
||||
|
||||
var errMsg common.Error
|
||||
err := json.Unmarshal(res.Body(), &errMsg)
|
||||
if err != nil {
|
||||
errMsg.ErrorMsg = ""
|
||||
}
|
||||
resp.ErrorMsg = errMsg.ErrorMsg
|
||||
} else {
|
||||
resp.Code = int32(res.StatusCode())
|
||||
resp.Msg = "Success"
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
package logic
|
||||
|
||||
/*
|
||||
desc: "AI core微服务"
|
||||
author: "xie"
|
||||
*/
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type ListServicesLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewListServicesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListServicesLogic {
|
||||
return &ListServicesLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListServicesLogic) ListServices(in *modelarts.ListServicesReq) (*modelarts.ListServicesResp, error) {
|
||||
var resp modelarts.ListServicesResp
|
||||
limit := strconv.Itoa(int(in.Limit))
|
||||
offset := strconv.Itoa(int(in.OffSet))
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/" + in.ProjectId + "/services?limit=" + limit + "&offset=" + offset
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, url, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"github.com/bitly/go-simplejson"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type ListTrainingJobConfigLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewListTrainingJobConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListTrainingJobConfigLogic {
|
||||
return &ListTrainingJobConfigLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// ListTrainingJobConfig 查询训练作业参数
|
||||
func (l *ListTrainingJobConfigLogic) ListTrainingJobConfig(in *modelarts.ListTrainingJobConfigReq) (*modelarts.ListTrainingJobConfigResp, error) {
|
||||
var resp modelarts.ListTrainingJobConfigResp
|
||||
perPage := strconv.Itoa(int(in.PerPage))
|
||||
page := strconv.Itoa(int(in.Page))
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/" + in.ProjectId + "/training-job-configs?" + perPage + "&" + page
|
||||
token := common.GetToken()
|
||||
body, err := tool.HttpClient(tool.GET, url, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
jsonResult, err := simplejson.NewJson(body)
|
||||
println(&jsonResult)
|
||||
json.Unmarshal(body, &resp)
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type MountNotebookStorageLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewMountNotebookStorageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MountNotebookStorageLogic {
|
||||
return &MountNotebookStorageLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *MountNotebookStorageLogic) MountNotebookStorage(in *modelarts.MountNotebookStorageReq) (*modelarts.MountNotebookStorageResp, error) {
|
||||
var resp modelarts.MountNotebookStorageResp
|
||||
mountUrl := "https://modelarts.cn-east-3.myhuaweicloud.com/v1/{project_id}/notebooks/{instance_id}/storage"
|
||||
mountUrl = strings.Replace(mountUrl, "{project_id}", in.ProjectId, -1)
|
||||
mountUrl = strings.Replace(mountUrl, "{instance_id}", in.InstanceId, -1)
|
||||
|
||||
reqByte, err := json.Marshal(in.Param)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
body, err := tool.HttpClient(tool.POST, mountUrl, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ShowAlgorithmByUuidLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewShowAlgorithmByUuidLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShowAlgorithmByUuidLogic {
|
||||
return &ShowAlgorithmByUuidLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// ShowAlgorithmByUuid 展示算法详情
|
||||
func (l *ShowAlgorithmByUuidLogic) ShowAlgorithmByUuid(in *modelarts.ShowAlgorithmByUuidReq) (*modelarts.ShowAlgorithmByUuidResp, error) {
|
||||
var resp modelarts.ShowAlgorithmByUuidResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/algorithms/" + in.AlgorithmId
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, url, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package logic
|
||||
|
||||
/*
|
||||
desc: "AI core微服务"
|
||||
author: "xie"
|
||||
*/
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ShowModelsLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewShowModelsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShowModelsLogic {
|
||||
return &ShowModelsLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ShowModelsLogic) ShowModels(in *modelarts.ShowModelReq) (*modelarts.ShowModelResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp modelarts.ShowModelResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/" + in.ProjectId + "/models/" + in.ModelId
|
||||
token := common.GetToken()
|
||||
body, err := tool.HttpClient(tool.GET, url, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package logic
|
||||
|
||||
/*
|
||||
desc: "AI core微服务"
|
||||
author: "xie"
|
||||
*/
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ShowServiceLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewShowServiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShowServiceLogic {
|
||||
return &ShowServiceLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ShowServiceLogic) ShowService(in *modelarts.ShowServiceReq) (*modelarts.ShowServiceResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp modelarts.ShowServiceResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/" + in.ProjectId + "/services/" + in.ServiceId
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, url, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type StartNotebookLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewStartNotebookLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StartNotebookLogic {
|
||||
return &StartNotebookLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *StartNotebookLogic) StartNotebook(in *modelarts.StartNotebookReq) (*modelarts.StartNotebookResp, error) {
|
||||
var resp modelarts.StartNotebookResp
|
||||
startUrl := "https://modelarts.cn-east-3.myhuaweicloud.com/v1/{project_id}/notebooks/{id}/start"
|
||||
startUrl = strings.Replace(startUrl, "{project_id}", in.ProjectId, -1)
|
||||
startUrl = strings.Replace(startUrl, "{id}", in.Id, -1)
|
||||
|
||||
token := common.GetToken()
|
||||
body, err := tool.HttpClientWithQueries(tool.POST, startUrl, nil, token, in.Param)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp.NotebookResp)
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type StopNotebookLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewStopNotebookLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StopNotebookLogic {
|
||||
return &StopNotebookLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *StopNotebookLogic) StopNotebook(in *modelarts.StopNotebookReq) (*modelarts.StopNotebookResp, error) {
|
||||
var resp modelarts.StopNotebookResp
|
||||
stopUrl := "https://modelarts.cn-east-3.myhuaweicloud.com/v1/{project_id}/notebooks/{id}/stop"
|
||||
stopUrl = strings.Replace(stopUrl, "{project_id}", in.ProjectId, -1)
|
||||
stopUrl = strings.Replace(stopUrl, "{id}", in.Id, -1)
|
||||
|
||||
token := common.GetToken()
|
||||
//empty struct
|
||||
var e struct{}
|
||||
|
||||
body, err := tool.HttpClientWithQueries(tool.POST, stopUrl, nil, token, e)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp.NotebookResp)
|
||||
return &resp, nil
|
||||
}
|
|
@ -1,235 +0,0 @@
|
|||
// Code generated by goctl. DO NOT EDIT.
|
||||
// Source: pcm-modelarts.proto
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/logic"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
)
|
||||
|
||||
type ModelArtsServer struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
modelarts.UnimplementedModelArtsServer
|
||||
}
|
||||
|
||||
func NewModelArtsServer(svcCtx *svc.ServiceContext) *ModelArtsServer {
|
||||
return &ModelArtsServer{
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
// get modelarts Token
|
||||
func (s *ModelArtsServer) GetToken(ctx context.Context, in *modelarts.TokenReq) (*modelarts.TokenResp, error) {
|
||||
l := logic.NewGetTokenLogic(ctx, s.svcCtx)
|
||||
return l.GetToken(in)
|
||||
}
|
||||
|
||||
// get modelarts Token
|
||||
func (s *ModelArtsServer) GetDatasetList(ctx context.Context, in *modelarts.DataSetReq) (*modelarts.DataSetResp, error) {
|
||||
l := logic.NewGetDatasetListLogic(ctx, s.svcCtx)
|
||||
return l.GetDatasetList(in)
|
||||
}
|
||||
|
||||
// create DateSet
|
||||
func (s *ModelArtsServer) CreateDataSet(ctx context.Context, in *modelarts.CreateDataSetReq) (*modelarts.CreateDataSetResq, error) {
|
||||
l := logic.NewCreateDataSetLogic(ctx, s.svcCtx)
|
||||
return l.CreateDataSet(in)
|
||||
}
|
||||
|
||||
// create DateSet
|
||||
func (s *ModelArtsServer) DeleteDataSet(ctx context.Context, in *modelarts.DeleteDataSetReq) (*modelarts.DeleteDataSetResq, error) {
|
||||
l := logic.NewDeleteDataSetLogic(ctx, s.svcCtx)
|
||||
return l.DeleteDataSet(in)
|
||||
}
|
||||
|
||||
// creat task 创建导入任务
|
||||
func (s *ModelArtsServer) CreateTask(ctx context.Context, in *modelarts.ImportTaskDataReq) (*modelarts.ImportTaskDataResp, error) {
|
||||
l := logic.NewCreateTaskLogic(ctx, s.svcCtx)
|
||||
return l.CreateTask(in)
|
||||
}
|
||||
|
||||
// get taskList 查询数据集导入任务列表
|
||||
func (s *ModelArtsServer) GetImportTaskList(ctx context.Context, in *modelarts.ListImportTasksReq) (*modelarts.ListImportTasksResp, error) {
|
||||
l := logic.NewGetImportTaskListLogic(ctx, s.svcCtx)
|
||||
return l.GetImportTaskList(in)
|
||||
}
|
||||
|
||||
// ListTrainingJobs 查询训练作业列表
|
||||
func (s *ModelArtsServer) GetListTrainingJobs(ctx context.Context, in *modelarts.ListTrainingJobsreq) (*modelarts.ListTrainingJobsresp, error) {
|
||||
l := logic.NewGetListTrainingJobsLogic(ctx, s.svcCtx)
|
||||
return l.GetListTrainingJobs(in)
|
||||
}
|
||||
|
||||
// CreateTrainingJob 创建训练作业
|
||||
func (s *ModelArtsServer) CreateTrainingJob(ctx context.Context, in *modelarts.CreateTrainingJobReq) (*modelarts.CreateTrainingJobResp, error) {
|
||||
l := logic.NewCreateTrainingJobLogic(ctx, s.svcCtx)
|
||||
return l.CreateTrainingJob(in)
|
||||
}
|
||||
|
||||
// DeleteTrainingJobConfig 删除训练作业
|
||||
func (s *ModelArtsServer) DeleteTrainingJob(ctx context.Context, in *modelarts.DeleteTrainingJobReq) (*modelarts.DeleteTrainingJobResp, error) {
|
||||
l := logic.NewDeleteTrainingJobLogic(ctx, s.svcCtx)
|
||||
return l.DeleteTrainingJob(in)
|
||||
}
|
||||
|
||||
// CreateTrainingJobConfig 创建训练作业参数
|
||||
func (s *ModelArtsServer) CreateTrainingJobConfig(ctx context.Context, in *modelarts.CreateTrainingJobConfigReq) (*modelarts.CreateTrainingJobConfigResp, error) {
|
||||
l := logic.NewCreateTrainingJobConfigLogic(ctx, s.svcCtx)
|
||||
return l.CreateTrainingJobConfig(in)
|
||||
}
|
||||
|
||||
// DeleteTrainingJobConfig 删除训练作业参数
|
||||
func (s *ModelArtsServer) DeleteTrainingJobConfig(ctx context.Context, in *modelarts.DeleteTrainingJobConfigReq) (*modelarts.DeleteTrainingJobConfigResp, error) {
|
||||
l := logic.NewDeleteTrainingJobConfigLogic(ctx, s.svcCtx)
|
||||
return l.DeleteTrainingJobConfig(in)
|
||||
}
|
||||
|
||||
// ListTrainingJobConfig 查询训练作业参数
|
||||
func (s *ModelArtsServer) ListTrainingJobConfig(ctx context.Context, in *modelarts.ListTrainingJobConfigReq) (*modelarts.ListTrainingJobConfigResp, error) {
|
||||
l := logic.NewListTrainingJobConfigLogic(ctx, s.svcCtx)
|
||||
return l.ListTrainingJobConfig(in)
|
||||
}
|
||||
|
||||
// CreateAlgorithm 创建算法
|
||||
func (s *ModelArtsServer) CreateAlgorithm(ctx context.Context, in *modelarts.CreateAlgorithmReq) (*modelarts.CreateAlgorithmResp, error) {
|
||||
l := logic.NewCreateAlgorithmLogic(ctx, s.svcCtx)
|
||||
return l.CreateAlgorithm(in)
|
||||
}
|
||||
|
||||
// ListAlgorithms 查询算法
|
||||
func (s *ModelArtsServer) ListAlgorithms(ctx context.Context, in *modelarts.ListAlgorithmsReq) (*modelarts.ListAlgorithmsResp, error) {
|
||||
l := logic.NewListAlgorithmsLogic(ctx, s.svcCtx)
|
||||
return l.ListAlgorithms(in)
|
||||
}
|
||||
|
||||
// DeleteAlgorithms 删除算法
|
||||
func (s *ModelArtsServer) DeleteAlgorithms(ctx context.Context, in *modelarts.DeleteAlgorithmsReq) (*modelarts.DeleteAlgorithmsResp, error) {
|
||||
l := logic.NewDeleteAlgorithmsLogic(ctx, s.svcCtx)
|
||||
return l.DeleteAlgorithms(in)
|
||||
}
|
||||
|
||||
// ShowAlgorithmByUuid 展示算法详情
|
||||
func (s *ModelArtsServer) ShowAlgorithmByUuid(ctx context.Context, in *modelarts.ShowAlgorithmByUuidReq) (*modelarts.ShowAlgorithmByUuidResp, error) {
|
||||
l := logic.NewShowAlgorithmByUuidLogic(ctx, s.svcCtx)
|
||||
return l.ShowAlgorithmByUuid(in)
|
||||
}
|
||||
|
||||
// export task
|
||||
func (s *ModelArtsServer) ExportTask(ctx context.Context, in *modelarts.ExportTaskReq) (*modelarts.ExportTaskDataResp, error) {
|
||||
l := logic.NewExportTaskLogic(ctx, s.svcCtx)
|
||||
return l.ExportTask(in)
|
||||
}
|
||||
|
||||
func (s *ModelArtsServer) GetExportTasksOfDataset(ctx context.Context, in *modelarts.GetExportTasksOfDatasetReq) (*modelarts.GetExportTasksOfDatasetResp, error) {
|
||||
l := logic.NewGetExportTasksOfDatasetLogic(ctx, s.svcCtx)
|
||||
return l.GetExportTasksOfDataset(in)
|
||||
}
|
||||
|
||||
func (s *ModelArtsServer) GetExportTaskStatusOfDataset(ctx context.Context, in *modelarts.GetExportTaskStatusOfDatasetReq) (*modelarts.GetExportTaskStatusOfDatasetResp, error) {
|
||||
l := logic.NewGetExportTaskStatusOfDatasetLogic(ctx, s.svcCtx)
|
||||
return l.GetExportTaskStatusOfDataset(in)
|
||||
}
|
||||
|
||||
// processor task
|
||||
func (s *ModelArtsServer) CreateProcessorTask(ctx context.Context, in *modelarts.CreateProcessorTaskReq) (*modelarts.CreateProcessorTaskResp, error) {
|
||||
l := logic.NewCreateProcessorTaskLogic(ctx, s.svcCtx)
|
||||
return l.CreateProcessorTask(in)
|
||||
}
|
||||
|
||||
func (s *ModelArtsServer) DescribeProcessorTask(ctx context.Context, in *modelarts.DescribeProcessorTaskReq) (*modelarts.DescribeProcessorTaskResp, error) {
|
||||
l := logic.NewDescribeProcessorTaskLogic(ctx, s.svcCtx)
|
||||
return l.DescribeProcessorTask(in)
|
||||
}
|
||||
|
||||
// model management
|
||||
func (s *ModelArtsServer) CreateModel(ctx context.Context, in *modelarts.CreateModelReq) (*modelarts.CreateModelResp, error) {
|
||||
l := logic.NewCreateModelLogic(ctx, s.svcCtx)
|
||||
return l.CreateModel(in)
|
||||
}
|
||||
|
||||
func (s *ModelArtsServer) DeleteModel(ctx context.Context, in *modelarts.DeleteModelReq) (*modelarts.DeleteModelResp, error) {
|
||||
l := logic.NewDeleteModelLogic(ctx, s.svcCtx)
|
||||
return l.DeleteModel(in)
|
||||
}
|
||||
|
||||
func (s *ModelArtsServer) ListModels(ctx context.Context, in *modelarts.ListModelReq) (*modelarts.ListModelResp, error) {
|
||||
l := logic.NewListModelsLogic(ctx, s.svcCtx)
|
||||
return l.ListModels(in)
|
||||
}
|
||||
|
||||
func (s *ModelArtsServer) ShowModels(ctx context.Context, in *modelarts.ShowModelReq) (*modelarts.ShowModelResp, error) {
|
||||
l := logic.NewShowModelsLogic(ctx, s.svcCtx)
|
||||
return l.ShowModels(in)
|
||||
}
|
||||
|
||||
// service management
|
||||
func (s *ModelArtsServer) CreateService(ctx context.Context, in *modelarts.CreateServiceReq) (*modelarts.CreateServiceResp, error) {
|
||||
l := logic.NewCreateServiceLogic(ctx, s.svcCtx)
|
||||
return l.CreateService(in)
|
||||
}
|
||||
|
||||
func (s *ModelArtsServer) ListServices(ctx context.Context, in *modelarts.ListServicesReq) (*modelarts.ListServicesResp, error) {
|
||||
l := logic.NewListServicesLogic(ctx, s.svcCtx)
|
||||
return l.ListServices(in)
|
||||
}
|
||||
|
||||
func (s *ModelArtsServer) ShowService(ctx context.Context, in *modelarts.ShowServiceReq) (*modelarts.ShowServiceResp, error) {
|
||||
l := logic.NewShowServiceLogic(ctx, s.svcCtx)
|
||||
return l.ShowService(in)
|
||||
}
|
||||
|
||||
func (s *ModelArtsServer) DeleteService(ctx context.Context, in *modelarts.DeleteServiceReq) (*modelarts.DeleteServiceResp, error) {
|
||||
l := logic.NewDeleteServiceLogic(ctx, s.svcCtx)
|
||||
return l.DeleteService(in)
|
||||
}
|
||||
|
||||
func (s *ModelArtsServer) ListClusters(ctx context.Context, in *modelarts.ListClustersReq) (*modelarts.ListClustersResp, error) {
|
||||
l := logic.NewListClustersLogic(ctx, s.svcCtx)
|
||||
return l.ListClusters(in)
|
||||
}
|
||||
|
||||
// notebook task
|
||||
func (s *ModelArtsServer) ListNotebook(ctx context.Context, in *modelarts.ListNotebookReq) (*modelarts.ListNotebookResp, error) {
|
||||
l := logic.NewListNotebookLogic(ctx, s.svcCtx)
|
||||
return l.ListNotebook(in)
|
||||
}
|
||||
|
||||
func (s *ModelArtsServer) CreateNotebook(ctx context.Context, in *modelarts.CreateNotebookReq) (*modelarts.CreateNotebookResp, error) {
|
||||
l := logic.NewCreateNotebookLogic(ctx, s.svcCtx)
|
||||
return l.CreateNotebook(in)
|
||||
}
|
||||
|
||||
func (s *ModelArtsServer) StartNotebook(ctx context.Context, in *modelarts.StartNotebookReq) (*modelarts.StartNotebookResp, error) {
|
||||
l := logic.NewStartNotebookLogic(ctx, s.svcCtx)
|
||||
return l.StartNotebook(in)
|
||||
}
|
||||
|
||||
func (s *ModelArtsServer) StopNotebook(ctx context.Context, in *modelarts.StopNotebookReq) (*modelarts.StopNotebookResp, error) {
|
||||
l := logic.NewStopNotebookLogic(ctx, s.svcCtx)
|
||||
return l.StopNotebook(in)
|
||||
}
|
||||
|
||||
func (s *ModelArtsServer) GetNotebookStorage(ctx context.Context, in *modelarts.GetNotebookStorageReq) (*modelarts.GetNotebookStorageResp, error) {
|
||||
l := logic.NewGetNotebookStorageLogic(ctx, s.svcCtx)
|
||||
return l.GetNotebookStorage(in)
|
||||
}
|
||||
|
||||
func (s *ModelArtsServer) MountNotebookStorage(ctx context.Context, in *modelarts.MountNotebookStorageReq) (*modelarts.MountNotebookStorageResp, error) {
|
||||
l := logic.NewMountNotebookStorageLogic(ctx, s.svcCtx)
|
||||
return l.MountNotebookStorage(in)
|
||||
}
|
||||
|
||||
// visualization-jobs
|
||||
func (s *ModelArtsServer) GetVisualizationJob(ctx context.Context, in *modelarts.GetVisualizationJobReq) (*modelarts.GetVisualizationJobResp, error) {
|
||||
l := logic.NewGetVisualizationJobLogic(ctx, s.svcCtx)
|
||||
return l.GetVisualizationJob(in)
|
||||
}
|
||||
|
||||
func (s *ModelArtsServer) CreateVisualizationJob(ctx context.Context, in *modelarts.CreateVisualizationJobReq) (*modelarts.CreateVisualizationJobResp, error) {
|
||||
l := logic.NewCreateVisualizationJobLogic(ctx, s.svcCtx)
|
||||
return l.CreateVisualizationJob(in)
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package svc
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/config"
|
||||
"PCM/adaptor/PCM-CORE/rpc/pcmcoreclient"
|
||||
"github.com/robfig/cron/v3"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
Cron *cron.Cron
|
||||
PcmCoreRpc pcmcoreclient.PcmCore
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
Cron: cron.New(cron.WithSeconds()),
|
||||
PcmCoreRpc: pcmcoreclient.NewPcmCore(zrpc.MustNewClient(c.PcmCoreRpcConf)),
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,530 +0,0 @@
|
|||
// Code generated by goctl. DO NOT EDIT.
|
||||
// Source: pcm-modelarts.proto
|
||||
|
||||
package modelartsclient
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type (
|
||||
AdvancedConfigAl = modelarts.AdvancedConfigAl
|
||||
AlgoConfigs = modelarts.AlgoConfigs
|
||||
Algorithm = modelarts.Algorithm
|
||||
AlgorithmResponse = modelarts.AlgorithmResponse
|
||||
Algorithms = modelarts.Algorithms
|
||||
AnnotationFormatConfig = modelarts.AnnotationFormatConfig
|
||||
AttributesAlRq = modelarts.AttributesAlRq
|
||||
Auth = modelarts.Auth
|
||||
AutoSearch = modelarts.AutoSearch
|
||||
AutoSearchAlgoConfigParameter = modelarts.AutoSearchAlgoConfigParameter
|
||||
Billing = modelarts.Billing
|
||||
Children = modelarts.Children
|
||||
Cluster = modelarts.Cluster
|
||||
ClusterNode = modelarts.ClusterNode
|
||||
CodeTree = modelarts.CodeTree
|
||||
Config = modelarts.Config
|
||||
ConfigResponse = modelarts.ConfigResponse
|
||||
Constraint = modelarts.Constraint
|
||||
ConstraintAlRp = modelarts.ConstraintAlRp
|
||||
ConstraintAlRq = modelarts.ConstraintAlRq
|
||||
ConstraintCreateTraining = modelarts.ConstraintCreateTraining
|
||||
ContainerHooks = modelarts.ContainerHooks
|
||||
Cpu = modelarts.Cpu
|
||||
CreateAlgorithmReq = modelarts.CreateAlgorithmReq
|
||||
CreateAlgorithmResp = modelarts.CreateAlgorithmResp
|
||||
CreateDataSetReq = modelarts.CreateDataSetReq
|
||||
CreateDataSetResq = modelarts.CreateDataSetResq
|
||||
CreateModelReq = modelarts.CreateModelReq
|
||||
CreateModelRequestInferParams = modelarts.CreateModelRequestInferParams
|
||||
CreateModelRequestModelApis = modelarts.CreateModelRequestModelApis
|
||||
CreateModelRequestTemplateInput = modelarts.CreateModelRequestTemplateInput
|
||||
CreateModelResp = modelarts.CreateModelResp
|
||||
CreateNotebookParam = modelarts.CreateNotebookParam
|
||||
CreateNotebookReq = modelarts.CreateNotebookReq
|
||||
CreateNotebookResp = modelarts.CreateNotebookResp
|
||||
CreateProcessorTaskReq = modelarts.CreateProcessorTaskReq
|
||||
CreateProcessorTaskResp = modelarts.CreateProcessorTaskResp
|
||||
CreateServiceReq = modelarts.CreateServiceReq
|
||||
CreateServiceResp = modelarts.CreateServiceResp
|
||||
CreateTrainingJobConfigReq = modelarts.CreateTrainingJobConfigReq
|
||||
CreateTrainingJobConfigResp = modelarts.CreateTrainingJobConfigResp
|
||||
CreateTrainingJobReq = modelarts.CreateTrainingJobReq
|
||||
CreateTrainingJobResp = modelarts.CreateTrainingJobResp
|
||||
CreateTrainingJobResp400 = modelarts.CreateTrainingJobResp400
|
||||
CreateVisualizationJobParam = modelarts.CreateVisualizationJobParam
|
||||
CreateVisualizationJobReq = modelarts.CreateVisualizationJobReq
|
||||
CreateVisualizationJobResp = modelarts.CreateVisualizationJobResp
|
||||
CustomHooks = modelarts.CustomHooks
|
||||
CustomSpec = modelarts.CustomSpec
|
||||
DataSetReq = modelarts.DataSetReq
|
||||
DataSetResp = modelarts.DataSetResp
|
||||
DataSets = modelarts.DataSets
|
||||
DataSource = modelarts.DataSource
|
||||
DataSources = modelarts.DataSources
|
||||
DataVolumesRes = modelarts.DataVolumesRes
|
||||
Dataset = modelarts.Dataset
|
||||
DeleteAlgorithmsReq = modelarts.DeleteAlgorithmsReq
|
||||
DeleteAlgorithmsResp = modelarts.DeleteAlgorithmsResp
|
||||
DeleteDataSetReq = modelarts.DeleteDataSetReq
|
||||
DeleteDataSetResq = modelarts.DeleteDataSetResq
|
||||
DeleteModelReq = modelarts.DeleteModelReq
|
||||
DeleteModelResp = modelarts.DeleteModelResp
|
||||
DeleteModelResponseFailedList = modelarts.DeleteModelResponseFailedList
|
||||
DeleteServiceReq = modelarts.DeleteServiceReq
|
||||
DeleteServiceResp = modelarts.DeleteServiceResp
|
||||
DeleteTrainingJobConfigReq = modelarts.DeleteTrainingJobConfigReq
|
||||
DeleteTrainingJobConfigResp = modelarts.DeleteTrainingJobConfigResp
|
||||
DeleteTrainingJobReq = modelarts.DeleteTrainingJobReq
|
||||
DeleteTrainingJobResp = modelarts.DeleteTrainingJobResp
|
||||
DescribeProcessorTaskReq = modelarts.DescribeProcessorTaskReq
|
||||
DescribeProcessorTaskResp = modelarts.DescribeProcessorTaskResp
|
||||
Disk = modelarts.Disk
|
||||
Domain = modelarts.Domain
|
||||
EndpointsReq = modelarts.EndpointsReq
|
||||
EndpointsRes = modelarts.EndpointsRes
|
||||
Engine = modelarts.Engine
|
||||
EngineAlRp = modelarts.EngineAlRp
|
||||
EngineAlRq = modelarts.EngineAlRq
|
||||
EngineCreateTraining = modelarts.EngineCreateTraining
|
||||
Environments = modelarts.Environments
|
||||
ExportParams = modelarts.ExportParams
|
||||
ExportTaskDataResp = modelarts.ExportTaskDataResp
|
||||
ExportTaskReq = modelarts.ExportTaskReq
|
||||
ExportTaskStatus = modelarts.ExportTaskStatus
|
||||
FileStatistics = modelarts.FileStatistics
|
||||
Flavor = modelarts.Flavor
|
||||
FlavorDetail = modelarts.FlavorDetail
|
||||
FlavorInfo = modelarts.FlavorInfo
|
||||
FlavorResponse = modelarts.FlavorResponse
|
||||
GetExportTaskStatusOfDatasetReq = modelarts.GetExportTaskStatusOfDatasetReq
|
||||
GetExportTaskStatusOfDatasetResp = modelarts.GetExportTaskStatusOfDatasetResp
|
||||
GetExportTasksOfDatasetReq = modelarts.GetExportTasksOfDatasetReq
|
||||
GetExportTasksOfDatasetResp = modelarts.GetExportTasksOfDatasetResp
|
||||
GetNotebookStorageReq = modelarts.GetNotebookStorageReq
|
||||
GetNotebookStorageResp = modelarts.GetNotebookStorageResp
|
||||
GetVisualizationJobParam = modelarts.GetVisualizationJobParam
|
||||
GetVisualizationJobReq = modelarts.GetVisualizationJobReq
|
||||
GetVisualizationJobResp = modelarts.GetVisualizationJobResp
|
||||
Gpu = modelarts.Gpu
|
||||
GuideDoc = modelarts.GuideDoc
|
||||
I18NDescription = modelarts.I18NDescription
|
||||
Identity = modelarts.Identity
|
||||
Image = modelarts.Image
|
||||
ImageInfo = modelarts.ImageInfo
|
||||
ImportTaskDataReq = modelarts.ImportTaskDataReq
|
||||
ImportTaskDataResp = modelarts.ImportTaskDataResp
|
||||
ImportTasks = modelarts.ImportTasks
|
||||
Input = modelarts.Input
|
||||
InputDataInfo = modelarts.InputDataInfo
|
||||
Inputs = modelarts.Inputs
|
||||
InputsAlRp = modelarts.InputsAlRp
|
||||
InputsAlRq = modelarts.InputsAlRq
|
||||
JobAlgorithmResponse = modelarts.JobAlgorithmResponse
|
||||
JobConfigAl = modelarts.JobConfigAl
|
||||
JobConfigAlRq = modelarts.JobConfigAlRq
|
||||
JobMetadata = modelarts.JobMetadata
|
||||
JobProgress = modelarts.JobProgress
|
||||
JobResponse = modelarts.JobResponse
|
||||
Jobs = modelarts.Jobs
|
||||
Lease = modelarts.Lease
|
||||
LeaseReq = modelarts.LeaseReq
|
||||
ListAlgorithmsReq = modelarts.ListAlgorithmsReq
|
||||
ListAlgorithmsResp = modelarts.ListAlgorithmsResp
|
||||
ListClustersReq = modelarts.ListClustersReq
|
||||
ListClustersResp = modelarts.ListClustersResp
|
||||
ListClustersResp200 = modelarts.ListClustersResp200
|
||||
ListClustersResp400 = modelarts.ListClustersResp400
|
||||
ListImportTasksReq = modelarts.ListImportTasksReq
|
||||
ListImportTasksResp = modelarts.ListImportTasksResp
|
||||
ListModelReq = modelarts.ListModelReq
|
||||
ListModelResp = modelarts.ListModelResp
|
||||
ListNotebookParam = modelarts.ListNotebookParam
|
||||
ListNotebookReq = modelarts.ListNotebookReq
|
||||
ListNotebookResp = modelarts.ListNotebookResp
|
||||
ListServices = modelarts.ListServices
|
||||
ListServicesReq = modelarts.ListServicesReq
|
||||
ListServicesResp = modelarts.ListServicesResp
|
||||
ListTrainingJobConfigReq = modelarts.ListTrainingJobConfigReq
|
||||
ListTrainingJobConfigResp = modelarts.ListTrainingJobConfigResp
|
||||
ListTrainingJobsreq = modelarts.ListTrainingJobsreq
|
||||
ListTrainingJobsresp = modelarts.ListTrainingJobsresp
|
||||
LogExportPath = modelarts.LogExportPath
|
||||
LogExportPathCreateTraining = modelarts.LogExportPathCreateTraining
|
||||
Memory = modelarts.Memory
|
||||
MetadataAlRp = modelarts.MetadataAlRp
|
||||
MetadataAlRq = modelarts.MetadataAlRq
|
||||
MetadataCrAl = modelarts.MetadataCrAl
|
||||
MetadataS = modelarts.MetadataS
|
||||
Methods = modelarts.Methods
|
||||
ModelDependencies = modelarts.ModelDependencies
|
||||
ModelHealth = modelarts.ModelHealth
|
||||
ModelInOutputParams = modelarts.ModelInOutputParams
|
||||
ModelListItem = modelarts.ModelListItem
|
||||
ModelParamsInfo = modelarts.ModelParamsInfo
|
||||
ModelSpecification = modelarts.ModelSpecification
|
||||
MountNotebookStorageParam = modelarts.MountNotebookStorageParam
|
||||
MountNotebookStorageReq = modelarts.MountNotebookStorageReq
|
||||
MountNotebookStorageResp = modelarts.MountNotebookStorageResp
|
||||
Nfs = modelarts.Nfs
|
||||
NotebookResp = modelarts.NotebookResp
|
||||
Npu = modelarts.Npu
|
||||
Obs = modelarts.Obs
|
||||
Obs1 = modelarts.Obs1
|
||||
OperatorParam = modelarts.OperatorParam
|
||||
Output = modelarts.Output
|
||||
Outputs = modelarts.Outputs
|
||||
OutputsAl = modelarts.OutputsAl
|
||||
OutputsAlRp = modelarts.OutputsAlRp
|
||||
Packages = modelarts.Packages
|
||||
Parameter = modelarts.Parameter
|
||||
ParameterS = modelarts.ParameterS
|
||||
ParametersAlRp = modelarts.ParametersAlRp
|
||||
ParametersAlRq = modelarts.ParametersAlRq
|
||||
ParametersTrainJob = modelarts.ParametersTrainJob
|
||||
Password = modelarts.Password
|
||||
Policies = modelarts.Policies
|
||||
PoliciesCreateTraining = modelarts.PoliciesCreateTraining
|
||||
Pool = modelarts.Pool
|
||||
ProcessorDataSource = modelarts.ProcessorDataSource
|
||||
Project = modelarts.Project
|
||||
QueryServiceConfig = modelarts.QueryServiceConfig
|
||||
Remote = modelarts.Remote
|
||||
RemoteConstraint = modelarts.RemoteConstraint
|
||||
RemoteConstraints = modelarts.RemoteConstraints
|
||||
Resource = modelarts.Resource
|
||||
ResourceCreateTraining = modelarts.ResourceCreateTraining
|
||||
ResourceRequirements = modelarts.ResourceRequirements
|
||||
RewardAttrs = modelarts.RewardAttrs
|
||||
Schedule = modelarts.Schedule
|
||||
Scheduler = modelarts.Scheduler
|
||||
SchemaMaps = modelarts.SchemaMaps
|
||||
Scope = modelarts.Scope
|
||||
SearchCondition = modelarts.SearchCondition
|
||||
SearchLabel = modelarts.SearchLabel
|
||||
SearchLabels = modelarts.SearchLabels
|
||||
SearchParams = modelarts.SearchParams
|
||||
SearchProp = modelarts.SearchProp
|
||||
ServiceConfig = modelarts.ServiceConfig
|
||||
ShareInfo = modelarts.ShareInfo
|
||||
ShareInfoAlRp = modelarts.ShareInfoAlRp
|
||||
ShowAlgorithmByUuidReq = modelarts.ShowAlgorithmByUuidReq
|
||||
ShowAlgorithmByUuidResp = modelarts.ShowAlgorithmByUuidResp
|
||||
ShowModelReq = modelarts.ShowModelReq
|
||||
ShowModelResp = modelarts.ShowModelResp
|
||||
ShowServiceReq = modelarts.ShowServiceReq
|
||||
ShowServiceResp = modelarts.ShowServiceResp
|
||||
SourceInfo = modelarts.SourceInfo
|
||||
Spec = modelarts.Spec
|
||||
Specs = modelarts.Specs
|
||||
SpecsC = modelarts.SpecsC
|
||||
StartNotebookParam = modelarts.StartNotebookParam
|
||||
StartNotebookReq = modelarts.StartNotebookReq
|
||||
StartNotebookResp = modelarts.StartNotebookResp
|
||||
Status = modelarts.Status
|
||||
StopNotebookReq = modelarts.StopNotebookReq
|
||||
StopNotebookResp = modelarts.StopNotebookResp
|
||||
TagsAlRp = modelarts.TagsAlRp
|
||||
TaskResponse = modelarts.TaskResponse
|
||||
TaskStatuses = modelarts.TaskStatuses
|
||||
Template = modelarts.Template
|
||||
TemplateParam = modelarts.TemplateParam
|
||||
TokenReq = modelarts.TokenReq
|
||||
TokenResp = modelarts.TokenResp
|
||||
User = modelarts.User
|
||||
VolumeReq = modelarts.VolumeReq
|
||||
VolumeRes = modelarts.VolumeRes
|
||||
Volumes = modelarts.Volumes
|
||||
Weigou = modelarts.Weigou
|
||||
WorkPath = modelarts.WorkPath
|
||||
|
||||
ModelArts interface {
|
||||
// get modelarts Token
|
||||
GetToken(ctx context.Context, in *TokenReq, opts ...grpc.CallOption) (*TokenResp, error)
|
||||
// get modelarts Token
|
||||
GetDatasetList(ctx context.Context, in *DataSetReq, opts ...grpc.CallOption) (*DataSetResp, error)
|
||||
// create DateSet
|
||||
CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error)
|
||||
// create DateSet
|
||||
DeleteDataSet(ctx context.Context, in *DeleteDataSetReq, opts ...grpc.CallOption) (*DeleteDataSetResq, error)
|
||||
// creat task 创建导入任务
|
||||
CreateTask(ctx context.Context, in *ImportTaskDataReq, opts ...grpc.CallOption) (*ImportTaskDataResp, error)
|
||||
// get taskList 查询数据集导入任务列表
|
||||
GetImportTaskList(ctx context.Context, in *ListImportTasksReq, opts ...grpc.CallOption) (*ListImportTasksResp, error)
|
||||
// ListTrainingJobs 查询训练作业列表
|
||||
GetListTrainingJobs(ctx context.Context, in *ListTrainingJobsreq, opts ...grpc.CallOption) (*ListTrainingJobsresp, error)
|
||||
// CreateTrainingJob 创建训练作业
|
||||
CreateTrainingJob(ctx context.Context, in *CreateTrainingJobReq, opts ...grpc.CallOption) (*CreateTrainingJobResp, error)
|
||||
// DeleteTrainingJobConfig 删除训练作业
|
||||
DeleteTrainingJob(ctx context.Context, in *DeleteTrainingJobReq, opts ...grpc.CallOption) (*DeleteTrainingJobResp, error)
|
||||
// CreateTrainingJobConfig 创建训练作业参数
|
||||
CreateTrainingJobConfig(ctx context.Context, in *CreateTrainingJobConfigReq, opts ...grpc.CallOption) (*CreateTrainingJobConfigResp, error)
|
||||
// DeleteTrainingJobConfig 删除训练作业参数
|
||||
DeleteTrainingJobConfig(ctx context.Context, in *DeleteTrainingJobConfigReq, opts ...grpc.CallOption) (*DeleteTrainingJobConfigResp, error)
|
||||
// ListTrainingJobConfig 查询训练作业参数
|
||||
ListTrainingJobConfig(ctx context.Context, in *ListTrainingJobConfigReq, opts ...grpc.CallOption) (*ListTrainingJobConfigResp, error)
|
||||
// CreateAlgorithm 创建算法
|
||||
CreateAlgorithm(ctx context.Context, in *CreateAlgorithmReq, opts ...grpc.CallOption) (*CreateAlgorithmResp, error)
|
||||
// ListAlgorithms 查询算法
|
||||
ListAlgorithms(ctx context.Context, in *ListAlgorithmsReq, opts ...grpc.CallOption) (*ListAlgorithmsResp, error)
|
||||
// DeleteAlgorithms 删除算法
|
||||
DeleteAlgorithms(ctx context.Context, in *DeleteAlgorithmsReq, opts ...grpc.CallOption) (*DeleteAlgorithmsResp, error)
|
||||
// ShowAlgorithmByUuid 展示算法详情
|
||||
ShowAlgorithmByUuid(ctx context.Context, in *ShowAlgorithmByUuidReq, opts ...grpc.CallOption) (*ShowAlgorithmByUuidResp, error)
|
||||
// export task
|
||||
ExportTask(ctx context.Context, in *ExportTaskReq, opts ...grpc.CallOption) (*ExportTaskDataResp, error)
|
||||
GetExportTasksOfDataset(ctx context.Context, in *GetExportTasksOfDatasetReq, opts ...grpc.CallOption) (*GetExportTasksOfDatasetResp, error)
|
||||
GetExportTaskStatusOfDataset(ctx context.Context, in *GetExportTaskStatusOfDatasetReq, opts ...grpc.CallOption) (*GetExportTaskStatusOfDatasetResp, error)
|
||||
// processor task
|
||||
CreateProcessorTask(ctx context.Context, in *CreateProcessorTaskReq, opts ...grpc.CallOption) (*CreateProcessorTaskResp, error)
|
||||
DescribeProcessorTask(ctx context.Context, in *DescribeProcessorTaskReq, opts ...grpc.CallOption) (*DescribeProcessorTaskResp, error)
|
||||
// model management
|
||||
CreateModel(ctx context.Context, in *CreateModelReq, opts ...grpc.CallOption) (*CreateModelResp, error)
|
||||
DeleteModel(ctx context.Context, in *DeleteModelReq, opts ...grpc.CallOption) (*DeleteModelResp, error)
|
||||
ListModels(ctx context.Context, in *ListModelReq, opts ...grpc.CallOption) (*ListModelResp, error)
|
||||
ShowModels(ctx context.Context, in *ShowModelReq, opts ...grpc.CallOption) (*ShowModelResp, error)
|
||||
// service management
|
||||
CreateService(ctx context.Context, in *CreateServiceReq, opts ...grpc.CallOption) (*CreateServiceResp, error)
|
||||
ListServices(ctx context.Context, in *ListServicesReq, opts ...grpc.CallOption) (*ListServicesResp, error)
|
||||
ShowService(ctx context.Context, in *ShowServiceReq, opts ...grpc.CallOption) (*ShowServiceResp, error)
|
||||
DeleteService(ctx context.Context, in *DeleteServiceReq, opts ...grpc.CallOption) (*DeleteServiceResp, error)
|
||||
ListClusters(ctx context.Context, in *ListClustersReq, opts ...grpc.CallOption) (*ListClustersResp, error)
|
||||
// notebook task
|
||||
ListNotebook(ctx context.Context, in *ListNotebookReq, opts ...grpc.CallOption) (*ListNotebookResp, error)
|
||||
CreateNotebook(ctx context.Context, in *CreateNotebookReq, opts ...grpc.CallOption) (*CreateNotebookResp, error)
|
||||
StartNotebook(ctx context.Context, in *StartNotebookReq, opts ...grpc.CallOption) (*StartNotebookResp, error)
|
||||
StopNotebook(ctx context.Context, in *StopNotebookReq, opts ...grpc.CallOption) (*StopNotebookResp, error)
|
||||
GetNotebookStorage(ctx context.Context, in *GetNotebookStorageReq, opts ...grpc.CallOption) (*GetNotebookStorageResp, error)
|
||||
MountNotebookStorage(ctx context.Context, in *MountNotebookStorageReq, opts ...grpc.CallOption) (*MountNotebookStorageResp, error)
|
||||
// visualization-jobs
|
||||
GetVisualizationJob(ctx context.Context, in *GetVisualizationJobReq, opts ...grpc.CallOption) (*GetVisualizationJobResp, error)
|
||||
CreateVisualizationJob(ctx context.Context, in *CreateVisualizationJobReq, opts ...grpc.CallOption) (*CreateVisualizationJobResp, error)
|
||||
}
|
||||
|
||||
defaultModelArts struct {
|
||||
cli zrpc.Client
|
||||
}
|
||||
)
|
||||
|
||||
func NewModelArts(cli zrpc.Client) ModelArts {
|
||||
return &defaultModelArts{
|
||||
cli: cli,
|
||||
}
|
||||
}
|
||||
|
||||
// get modelarts Token
|
||||
func (m *defaultModelArts) GetToken(ctx context.Context, in *TokenReq, opts ...grpc.CallOption) (*TokenResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.GetToken(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// get modelarts Token
|
||||
func (m *defaultModelArts) GetDatasetList(ctx context.Context, in *DataSetReq, opts ...grpc.CallOption) (*DataSetResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.GetDatasetList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// create DateSet
|
||||
func (m *defaultModelArts) CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.CreateDataSet(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// create DateSet
|
||||
func (m *defaultModelArts) DeleteDataSet(ctx context.Context, in *DeleteDataSetReq, opts ...grpc.CallOption) (*DeleteDataSetResq, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.DeleteDataSet(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// creat task 创建导入任务
|
||||
func (m *defaultModelArts) CreateTask(ctx context.Context, in *ImportTaskDataReq, opts ...grpc.CallOption) (*ImportTaskDataResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.CreateTask(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// get taskList 查询数据集导入任务列表
|
||||
func (m *defaultModelArts) GetImportTaskList(ctx context.Context, in *ListImportTasksReq, opts ...grpc.CallOption) (*ListImportTasksResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.GetImportTaskList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// ListTrainingJobs 查询训练作业列表
|
||||
func (m *defaultModelArts) GetListTrainingJobs(ctx context.Context, in *ListTrainingJobsreq, opts ...grpc.CallOption) (*ListTrainingJobsresp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.GetListTrainingJobs(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// CreateTrainingJob 创建训练作业
|
||||
func (m *defaultModelArts) CreateTrainingJob(ctx context.Context, in *CreateTrainingJobReq, opts ...grpc.CallOption) (*CreateTrainingJobResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.CreateTrainingJob(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// DeleteTrainingJobConfig 删除训练作业
|
||||
func (m *defaultModelArts) DeleteTrainingJob(ctx context.Context, in *DeleteTrainingJobReq, opts ...grpc.CallOption) (*DeleteTrainingJobResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.DeleteTrainingJob(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// CreateTrainingJobConfig 创建训练作业参数
|
||||
func (m *defaultModelArts) CreateTrainingJobConfig(ctx context.Context, in *CreateTrainingJobConfigReq, opts ...grpc.CallOption) (*CreateTrainingJobConfigResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.CreateTrainingJobConfig(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// DeleteTrainingJobConfig 删除训练作业参数
|
||||
func (m *defaultModelArts) DeleteTrainingJobConfig(ctx context.Context, in *DeleteTrainingJobConfigReq, opts ...grpc.CallOption) (*DeleteTrainingJobConfigResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.DeleteTrainingJobConfig(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// ListTrainingJobConfig 查询训练作业参数
|
||||
func (m *defaultModelArts) ListTrainingJobConfig(ctx context.Context, in *ListTrainingJobConfigReq, opts ...grpc.CallOption) (*ListTrainingJobConfigResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.ListTrainingJobConfig(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// CreateAlgorithm 创建算法
|
||||
func (m *defaultModelArts) CreateAlgorithm(ctx context.Context, in *CreateAlgorithmReq, opts ...grpc.CallOption) (*CreateAlgorithmResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.CreateAlgorithm(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// ListAlgorithms 查询算法
|
||||
func (m *defaultModelArts) ListAlgorithms(ctx context.Context, in *ListAlgorithmsReq, opts ...grpc.CallOption) (*ListAlgorithmsResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.ListAlgorithms(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// DeleteAlgorithms 删除算法
|
||||
func (m *defaultModelArts) DeleteAlgorithms(ctx context.Context, in *DeleteAlgorithmsReq, opts ...grpc.CallOption) (*DeleteAlgorithmsResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.DeleteAlgorithms(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// ShowAlgorithmByUuid 展示算法详情
|
||||
func (m *defaultModelArts) ShowAlgorithmByUuid(ctx context.Context, in *ShowAlgorithmByUuidReq, opts ...grpc.CallOption) (*ShowAlgorithmByUuidResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.ShowAlgorithmByUuid(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// export task
|
||||
func (m *defaultModelArts) ExportTask(ctx context.Context, in *ExportTaskReq, opts ...grpc.CallOption) (*ExportTaskDataResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.ExportTask(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultModelArts) GetExportTasksOfDataset(ctx context.Context, in *GetExportTasksOfDatasetReq, opts ...grpc.CallOption) (*GetExportTasksOfDatasetResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.GetExportTasksOfDataset(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultModelArts) GetExportTaskStatusOfDataset(ctx context.Context, in *GetExportTaskStatusOfDatasetReq, opts ...grpc.CallOption) (*GetExportTaskStatusOfDatasetResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.GetExportTaskStatusOfDataset(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// processor task
|
||||
func (m *defaultModelArts) CreateProcessorTask(ctx context.Context, in *CreateProcessorTaskReq, opts ...grpc.CallOption) (*CreateProcessorTaskResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.CreateProcessorTask(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultModelArts) DescribeProcessorTask(ctx context.Context, in *DescribeProcessorTaskReq, opts ...grpc.CallOption) (*DescribeProcessorTaskResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.DescribeProcessorTask(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// model management
|
||||
func (m *defaultModelArts) CreateModel(ctx context.Context, in *CreateModelReq, opts ...grpc.CallOption) (*CreateModelResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.CreateModel(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultModelArts) DeleteModel(ctx context.Context, in *DeleteModelReq, opts ...grpc.CallOption) (*DeleteModelResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.DeleteModel(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultModelArts) ListModels(ctx context.Context, in *ListModelReq, opts ...grpc.CallOption) (*ListModelResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.ListModels(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultModelArts) ShowModels(ctx context.Context, in *ShowModelReq, opts ...grpc.CallOption) (*ShowModelResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.ShowModels(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// service management
|
||||
func (m *defaultModelArts) CreateService(ctx context.Context, in *CreateServiceReq, opts ...grpc.CallOption) (*CreateServiceResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.CreateService(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultModelArts) ListServices(ctx context.Context, in *ListServicesReq, opts ...grpc.CallOption) (*ListServicesResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.ListServices(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultModelArts) ShowService(ctx context.Context, in *ShowServiceReq, opts ...grpc.CallOption) (*ShowServiceResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.ShowService(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultModelArts) DeleteService(ctx context.Context, in *DeleteServiceReq, opts ...grpc.CallOption) (*DeleteServiceResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.DeleteService(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultModelArts) ListClusters(ctx context.Context, in *ListClustersReq, opts ...grpc.CallOption) (*ListClustersResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.ListClusters(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// notebook task
|
||||
func (m *defaultModelArts) ListNotebook(ctx context.Context, in *ListNotebookReq, opts ...grpc.CallOption) (*ListNotebookResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.ListNotebook(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultModelArts) CreateNotebook(ctx context.Context, in *CreateNotebookReq, opts ...grpc.CallOption) (*CreateNotebookResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.CreateNotebook(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultModelArts) StartNotebook(ctx context.Context, in *StartNotebookReq, opts ...grpc.CallOption) (*StartNotebookResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.StartNotebook(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultModelArts) StopNotebook(ctx context.Context, in *StopNotebookReq, opts ...grpc.CallOption) (*StopNotebookResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.StopNotebook(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultModelArts) GetNotebookStorage(ctx context.Context, in *GetNotebookStorageReq, opts ...grpc.CallOption) (*GetNotebookStorageResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.GetNotebookStorage(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultModelArts) MountNotebookStorage(ctx context.Context, in *MountNotebookStorageReq, opts ...grpc.CallOption) (*MountNotebookStorageResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.MountNotebookStorage(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// visualization-jobs
|
||||
func (m *defaultModelArts) GetVisualizationJob(ctx context.Context, in *GetVisualizationJobReq, opts ...grpc.CallOption) (*GetVisualizationJobResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.GetVisualizationJob(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultModelArts) CreateVisualizationJob(ctx context.Context, in *CreateVisualizationJobReq, opts ...grpc.CallOption) (*CreateVisualizationJobResp, error) {
|
||||
client := modelarts.NewModelArtsClient(m.cli.Conn())
|
||||
return client.CreateVisualizationJob(ctx, in, opts...)
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,67 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/config"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/logic"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/server"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
|
||||
commonConfig "PCM/common/config"
|
||||
"PCM/common/interceptor/rpcserver"
|
||||
"flag"
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/zeromicro/go-zero/core/service"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "adaptor/PCM-AI/PCM-MODELARTS/rpc/etc/pcmmodelarts.yaml", "the config file")
|
||||
|
||||
func main() {
|
||||
|
||||
flag.Parse()
|
||||
|
||||
var bootstrapConfig commonConfig.BootstrapConfig
|
||||
conf.MustLoad(*configFile, &bootstrapConfig)
|
||||
|
||||
//解析业务配置
|
||||
var c config.Config
|
||||
nacosConfig := bootstrapConfig.NacosConfig
|
||||
|
||||
serviceConfigContent := nacosConfig.InitConfig(func(data string) {
|
||||
err := conf.LoadFromYamlBytes([]byte(data), &c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
})
|
||||
err := conf.LoadFromYamlBytes([]byte(serviceConfigContent), &c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// start log component
|
||||
logx.MustSetup(c.LogConf)
|
||||
// 注册到nacos
|
||||
nacosConfig.Discovery(&c.RpcServerConf)
|
||||
|
||||
ctx := svc.NewServiceContext(c)
|
||||
ctx.Cron.Start()
|
||||
|
||||
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
||||
modelarts.RegisterModelArtsServer(grpcServer, server.NewModelArtsServer(ctx))
|
||||
|
||||
if c.Mode == service.DevMode || c.Mode == service.TestMode {
|
||||
reflection.Register(grpcServer)
|
||||
}
|
||||
})
|
||||
|
||||
//rpc log
|
||||
s.AddUnaryInterceptors(rpcserver.LoggerInterceptor)
|
||||
|
||||
defer s.Stop()
|
||||
|
||||
logx.Infof("Starting rpc server at %s...\n", c.ListenOn)
|
||||
logic.InitCron(ctx)
|
||||
s.Start()
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
rpc-gen:
|
||||
goctl rpc protoc ./pb/*.proto --go_out=./ --go-grpc_out=./ --zrpc_out=.
|
|
@ -1,16 +0,0 @@
|
|||
NacosConfig:
|
||||
DataId: pcm-octopus-rpc.yaml
|
||||
Group: DEFAULT_GROUP
|
||||
ServerConfigs:
|
||||
- IpAddr: 10.101.15.7
|
||||
Port: 8848
|
||||
# - IpAddr: nacos-headless
|
||||
# Port: 8848
|
||||
ClientConfig:
|
||||
NamespaceId: test_octopus
|
||||
TimeoutMs: 5000
|
||||
NotLoadCacheAtStart: true
|
||||
LogDir:
|
||||
CacheDir:
|
||||
LogLevel: debug
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
package common
|
||||
|
||||
type TokenResp struct {
|
||||
Success bool `json:"success"`
|
||||
Payload struct {
|
||||
Token string `json:"token"`
|
||||
Expiration int `json:"expiration"`
|
||||
} `json:"payload"`
|
||||
Error interface{} `json:"error"`
|
||||
}
|
||||
|
||||
type SuiyuanResp struct {
|
||||
Success bool `json:"success"`
|
||||
Payload struct {
|
||||
MapResourceSpecIdList struct {
|
||||
Debug struct {
|
||||
ResourceSpecs []struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Price int `json:"price"`
|
||||
ResourceQuantity struct {
|
||||
Cpu string `json:"cpu,omitempty"`
|
||||
EnflameComDtu string `json:"enflame.com/dtu,omitempty"`
|
||||
Memory string `json:"memory"`
|
||||
Shm string `json:"shm,omitempty"`
|
||||
CpuCpu string `json:"cpu_cpu,omitempty"`
|
||||
} `json:"resourceQuantity"`
|
||||
} `json:"resourceSpecs"`
|
||||
} `json:"debug"`
|
||||
Deploy struct {
|
||||
ResourceSpecs []interface{} `json:"resourceSpecs"`
|
||||
} `json:"deploy"`
|
||||
Train struct {
|
||||
ResourceSpecs []struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Price int `json:"price"`
|
||||
ResourceQuantity struct {
|
||||
Cpu string `json:"cpu"`
|
||||
EnflameComDtu string `json:"enflame.com/dtu"`
|
||||
Memory string `json:"memory"`
|
||||
Shm string `json:"shm"`
|
||||
} `json:"resourceQuantity"`
|
||||
} `json:"resourceSpecs"`
|
||||
} `json:"train"`
|
||||
} `json:"mapResourceSpecIdList"`
|
||||
} `json:"payload"`
|
||||
Error interface{} `json:"error"`
|
||||
}
|
||||
|
||||
type HanwujiResp struct {
|
||||
Success bool `json:"success"`
|
||||
Payload struct {
|
||||
MapResourceSpecIdList struct {
|
||||
Debug struct {
|
||||
ResourceSpecs []struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Price int `json:"price"`
|
||||
ResourceQuantity struct {
|
||||
CambriconComMlu string `json:"cambricon.com/mlu,omitempty"`
|
||||
Cpu string `json:"cpu"`
|
||||
Memory string `json:"memory"`
|
||||
Shm string `json:"shm,omitempty"`
|
||||
} `json:"resourceQuantity"`
|
||||
} `json:"resourceSpecs"`
|
||||
} `json:"debug"`
|
||||
Deploy struct {
|
||||
ResourceSpecs []interface{} `json:"resourceSpecs"`
|
||||
} `json:"deploy"`
|
||||
Train struct {
|
||||
ResourceSpecs []struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Price int `json:"price"`
|
||||
ResourceQuantity struct {
|
||||
CambriconComMlu string `json:"cambricon.com/mlu,omitempty"`
|
||||
Cpu string `json:"cpu"`
|
||||
Memory string `json:"memory"`
|
||||
Shm string `json:"shm,omitempty"`
|
||||
} `json:"resourceQuantity"`
|
||||
} `json:"resourceSpecs"`
|
||||
} `json:"train"`
|
||||
} `json:"mapResourceSpecIdList"`
|
||||
} `json:"payload"`
|
||||
Error interface{} `json:"error"`
|
||||
}
|
||||
|
||||
type SailingsiResp struct {
|
||||
Success bool `json:"success"`
|
||||
Payload struct {
|
||||
MapResourceSpecIdList struct {
|
||||
Debug struct {
|
||||
ResourceSpecs []interface{} `json:"resourceSpecs"`
|
||||
} `json:"debug"`
|
||||
Deploy struct {
|
||||
ResourceSpecs []interface{} `json:"resourceSpecs"`
|
||||
} `json:"deploy"`
|
||||
Train struct {
|
||||
ResourceSpecs []interface{} `json:"resourceSpecs"`
|
||||
} `json:"train"`
|
||||
} `json:"mapResourceSpecIdList"`
|
||||
} `json:"payload"`
|
||||
Error interface{} `json:"error"`
|
||||
}
|
||||
|
||||
type Login struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
func OctopusHttpClient(method string, url string, payload io.Reader, token string) ([]byte, error) {
|
||||
request, err := http.NewRequest(method, url, payload)
|
||||
if token != "" {
|
||||
request.Header.Set("Authorization", "Bearer "+token)
|
||||
} else {
|
||||
request.Header.Set("Content-Type", "application/json")
|
||||
}
|
||||
client := http.Client{Timeout: time.Duration(2) * time.Second}
|
||||
res, err := client.Do(request)
|
||||
if err != nil {
|
||||
if os.IsTimeout(err) {
|
||||
log.Println("接口调用超时 : ", err)
|
||||
request.Body.Close()
|
||||
return nil, err
|
||||
}
|
||||
log.Println(err)
|
||||
}
|
||||
defer res.Body.Close()
|
||||
body, err := io.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
log.Println("body转换错误: ", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return body, err
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/config"
|
||||
"PCM/common/tool"
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"log"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
Hanwuji = "hanwuji"
|
||||
Suiyuan = "suiyuan"
|
||||
Sailingsi = "sailingsi"
|
||||
)
|
||||
|
||||
type TokenTimePair struct {
|
||||
Token string
|
||||
ExpiredAt time.Time
|
||||
}
|
||||
|
||||
var (
|
||||
tokenMap = generateTokenMap()
|
||||
OctopusUrls = getOctopusUrls()
|
||||
)
|
||||
|
||||
func generateTokenMap() map[string]TokenTimePair {
|
||||
var tokenMap = make(map[string]TokenTimePair)
|
||||
octopusConfig := config.Cfg
|
||||
login := Login{
|
||||
Username: octopusConfig.OctopusConfig.Username,
|
||||
Password: octopusConfig.OctopusConfig.Password,
|
||||
}
|
||||
jsonStr, _ := json.Marshal(login)
|
||||
urlMap := map[string]string{
|
||||
Hanwuji: octopusConfig.OctopusConfig.HanwujiUrl + octopusConfig.OctopusConfig.OctopusTokenUrl,
|
||||
Suiyuan: octopusConfig.OctopusConfig.SuiyuanUrl + octopusConfig.OctopusConfig.OctopusTokenUrl,
|
||||
Sailingsi: octopusConfig.OctopusConfig.SailingsiUrl + octopusConfig.OctopusConfig.OctopusTokenUrl,
|
||||
}
|
||||
for k, v := range urlMap {
|
||||
token, expiredAt := generateToken(jsonStr, v)
|
||||
tokenTimePair := TokenTimePair{
|
||||
Token: token,
|
||||
ExpiredAt: expiredAt,
|
||||
}
|
||||
tokenMap[k] = tokenTimePair
|
||||
}
|
||||
return tokenMap
|
||||
}
|
||||
|
||||
func generateToken(jsonStr []byte, tokenUrl string) (string, time.Time) {
|
||||
|
||||
body, err := OctopusHttpClient(tool.POST, tokenUrl, bytes.NewBuffer(jsonStr), "")
|
||||
var tokenResp TokenResp
|
||||
err = json.Unmarshal(body, &tokenResp)
|
||||
if err != nil {
|
||||
log.Println("token json转换失败 : ", err)
|
||||
return "", time.Time{}
|
||||
}
|
||||
|
||||
var d time.Duration
|
||||
d = time.Second * time.Duration(tokenResp.Payload.Expiration)
|
||||
return tokenResp.Payload.Token, time.Now().Add(d)
|
||||
}
|
||||
|
||||
func GetToken(kForToken string) string {
|
||||
|
||||
if tokenMap[kForToken].Token == "" {
|
||||
tokenMap = generateTokenMap()
|
||||
}
|
||||
|
||||
tokenTimePair := tokenMap[kForToken]
|
||||
|
||||
if tokenTimePair.Token == "" {
|
||||
return ""
|
||||
}
|
||||
|
||||
if time.Now().After(tokenTimePair.ExpiredAt) {
|
||||
tokenMap = generateTokenMap()
|
||||
}
|
||||
return tokenTimePair.Token
|
||||
}
|
||||
|
||||
func getOctopusUrls() map[string]string {
|
||||
octopusConfig := config.Cfg
|
||||
urlMap := map[string]string{
|
||||
Hanwuji: octopusConfig.OctopusConfig.HanwujiUrl,
|
||||
Suiyuan: octopusConfig.OctopusConfig.SuiyuanUrl,
|
||||
Sailingsi: octopusConfig.OctopusConfig.SailingsiUrl,
|
||||
}
|
||||
return urlMap
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
commonConfig "PCM/common/config"
|
||||
"flag"
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/zeromicro/go-zero/core/stores/redis"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
zrpc.RpcServerConf
|
||||
OctopusConfig OctopusConfig
|
||||
OctopusApi OctopusApi
|
||||
PcmCoreRpcConf zrpc.RpcClientConf
|
||||
LogConf logx.LogConf
|
||||
RedisConf redis.RedisConf
|
||||
}
|
||||
|
||||
var configFile = flag.String("f", "adaptor/PCM-AI/PCM-OCTOPUS/rpc/etc/octopus.yaml", "the config file")
|
||||
|
||||
var Cfg = getConfig()
|
||||
|
||||
func getConfig() Config {
|
||||
var bootstrapConfig commonConfig.BootstrapConfig
|
||||
conf.MustLoad(*configFile, &bootstrapConfig)
|
||||
|
||||
//解析业务配置
|
||||
var c Config
|
||||
nacosConfig := bootstrapConfig.NacosConfig
|
||||
|
||||
serviceConfigContent := nacosConfig.InitConfig(func(data string) {
|
||||
err := conf.LoadFromYamlBytes([]byte(data), &c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
})
|
||||
err := conf.LoadFromYamlBytes([]byte(serviceConfigContent), &c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// start log component
|
||||
logx.MustSetup(c.LogConf)
|
||||
// 注册到nacos
|
||||
nacosConfig.Discovery(&c.RpcServerConf)
|
||||
|
||||
return c
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package config
|
||||
|
||||
type OctopusConfig struct {
|
||||
Username string
|
||||
Password string
|
||||
HanwujiUrl string
|
||||
SuiyuanUrl string
|
||||
SailingsiUrl string
|
||||
OctopusResouceSpec string
|
||||
OctopusTokenUrl string
|
||||
CambriconMLU290 int32
|
||||
EnflameT20 int32
|
||||
OctopusCp string
|
||||
}
|
||||
|
||||
type OctopusApi struct {
|
||||
GetUserImageList string
|
||||
GetMyAlgorithmList string
|
||||
GetNotebookList string
|
||||
GetMydatasetList string
|
||||
CreateImage string
|
||||
DeleteImage string
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
"context"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateDataSetLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewCreateDataSetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateDataSetLogic {
|
||||
return &CreateDataSetLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateDataSetLogic) CreateDataSet(in *octopus.CreateDataSetReq) (*octopus.CreateDataSetResq, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
/* {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp octopus.CreateDataSetResq
|
||||
url := "http://192.168.242.41:8001/openaiserver/v1/datasetmanage/dataset"
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, url, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
} else if statusCode == 400 {
|
||||
json.Unmarshal(body, &resp)
|
||||
}
|
||||
|
||||
}*/
|
||||
return &octopus.CreateDataSetResq{}, nil
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateImageLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewCreateImageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateImageLogic {
|
||||
return &CreateImageLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateImageLogic) CreateImage(in *octopus.CreateImageReq) (*octopus.CreateImageResp, error) {
|
||||
resp := &octopus.CreateImageResp{}
|
||||
|
||||
var url_prefix = common.OctopusUrls[in.Platform]
|
||||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.CreateImage
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
SetHeader("Authorization", "Bearer "+token).
|
||||
SetBody(in.CreateImage).
|
||||
SetResult(resp).
|
||||
Post(reqUrl)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteImageLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewDeleteImageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteImageLogic {
|
||||
return &DeleteImageLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteImageLogic) DeleteImage(in *octopus.DeleteImageReq) (*octopus.DeleteImageResp, error) {
|
||||
resp := &octopus.DeleteImageResp{}
|
||||
|
||||
var url_prefix = common.OctopusUrls[in.Platform]
|
||||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.DeleteImage
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
SetHeader("Authorization", "Bearer "+token).
|
||||
SetPathParam("imageId", in.ImageId).
|
||||
SetResult(resp).
|
||||
Delete(reqUrl)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
|
@ -1,125 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/config"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/go-redis/redis"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"log"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
type GetComputingPowerLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetComputingPowerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetComputingPowerLogic {
|
||||
return &GetComputingPowerLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetComputingPowerLogic) GetComputingPower(in *octopus.ResourceReq) (*octopus.CpResp, error) {
|
||||
var resp octopus.CpResp
|
||||
var cp float32
|
||||
|
||||
redisClient := redis.NewClient(&redis.Options{
|
||||
Addr: l.svcCtx.Config.RedisConf.Host,
|
||||
Password: l.svcCtx.Config.RedisConf.Pass,
|
||||
})
|
||||
|
||||
defer redisClient.Close()
|
||||
_, err := redisClient.Ping().Result()
|
||||
|
||||
if err != nil {
|
||||
log.Println("redis连接失败", err)
|
||||
cp = getCPFromOctopus()
|
||||
redisClient.Set(l.svcCtx.Config.OctopusConfig.OctopusCp, cp, 168*time.Hour)
|
||||
} else {
|
||||
res, err := redisClient.Get(l.svcCtx.Config.OctopusConfig.OctopusCp).Float32()
|
||||
if err == redis.Nil {
|
||||
log.Println("redis key未找到或已过期,重新请求")
|
||||
cp = getCPFromOctopus()
|
||||
redisClient.Set(l.svcCtx.Config.OctopusConfig.OctopusCp, cp, 168*time.Hour)
|
||||
} else {
|
||||
cp = res
|
||||
}
|
||||
}
|
||||
resp.POpsAtFp16 = cp
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
func getCPFromOctopus() float32 {
|
||||
octopusConfig := config.Cfg
|
||||
|
||||
urlMap := map[string]string{
|
||||
common.Hanwuji: octopusConfig.OctopusConfig.HanwujiUrl + octopusConfig.OctopusConfig.OctopusResouceSpec,
|
||||
common.Suiyuan: octopusConfig.OctopusConfig.SuiyuanUrl + octopusConfig.OctopusConfig.OctopusResouceSpec,
|
||||
common.Sailingsi: octopusConfig.OctopusConfig.SailingsiUrl + octopusConfig.OctopusConfig.OctopusResouceSpec,
|
||||
}
|
||||
|
||||
var computingPowerInTops int32
|
||||
for k, v := range urlMap {
|
||||
token := common.GetToken(k)
|
||||
body, err := common.OctopusHttpClient("GET", v, nil, token)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
//获取训练资源算力
|
||||
switch k {
|
||||
case common.Hanwuji:
|
||||
resourceSpec := common.HanwujiResp{}
|
||||
err := json.Unmarshal(body, &resourceSpec)
|
||||
if err != nil {
|
||||
log.Println("Hanwuji json转换失败 : ", err)
|
||||
continue
|
||||
}
|
||||
if !resourceSpec.Success {
|
||||
log.Println("Hanwuji 获取训练资源失败 : ", resourceSpec.Error)
|
||||
continue
|
||||
}
|
||||
for _, spec := range resourceSpec.Payload.MapResourceSpecIdList.Train.ResourceSpecs {
|
||||
numOfCards, err := strconv.ParseInt(spec.ResourceQuantity.CambriconComMlu, 10, 32)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
computingPowerInTops += octopusConfig.OctopusConfig.CambriconMLU290 * int32(numOfCards)
|
||||
}
|
||||
case common.Suiyuan:
|
||||
resourceSpec := common.SuiyuanResp{}
|
||||
err := json.Unmarshal(body, &resourceSpec)
|
||||
if err != nil {
|
||||
log.Println("Suiyuan json转换失败 : ", err)
|
||||
continue
|
||||
}
|
||||
if !resourceSpec.Success {
|
||||
log.Println("Suiyuan 获取训练资源失败 : ", resourceSpec.Error)
|
||||
continue
|
||||
}
|
||||
for _, spec := range resourceSpec.Payload.MapResourceSpecIdList.Train.ResourceSpecs {
|
||||
numOfCards, err := strconv.ParseInt(spec.ResourceQuantity.EnflameComDtu, 10, 32)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
computingPowerInTops += octopusConfig.OctopusConfig.EnflameT20 * int32(numOfCards)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if computingPowerInTops == 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
return float32(computingPowerInTops) / 1024
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/config"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/go-redis/redis"
|
||||
"log"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
const (
|
||||
GI = "Gi"
|
||||
OctopusGeneralInfo = "octopusGeneralInfo"
|
||||
Comma = ","
|
||||
)
|
||||
|
||||
type GetGeneralInfoLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetGeneralInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetGeneralInfoLogic {
|
||||
return &GetGeneralInfoLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetGeneralInfoLogic) GetGeneralInfo(in *octopus.ResourceReq) (*octopus.GiResp, error) {
|
||||
var resp octopus.GiResp
|
||||
var octopusCpuCores int32
|
||||
var octopusMemoryInGi int32
|
||||
|
||||
redisClient := redis.NewClient(&redis.Options{
|
||||
Addr: l.svcCtx.Config.RedisConf.Host,
|
||||
Password: l.svcCtx.Config.RedisConf.Pass,
|
||||
})
|
||||
|
||||
defer redisClient.Close()
|
||||
_, err := redisClient.Ping().Result()
|
||||
|
||||
if err != nil {
|
||||
log.Println("redis连接失败", err)
|
||||
octopusCpuCores, octopusMemoryInGi = getGeneralInfoFromOctopus()
|
||||
octopusGeneralInfo := strconv.FormatInt(int64(octopusCpuCores), 10) + Comma + strconv.FormatInt(int64(octopusMemoryInGi), 10)
|
||||
redisClient.Set(OctopusGeneralInfo, octopusGeneralInfo, 168*time.Hour)
|
||||
} else {
|
||||
res, err := redisClient.Get(OctopusGeneralInfo).Result()
|
||||
if err == redis.Nil {
|
||||
log.Println("redis key未找到或已过期,重新请求")
|
||||
octopusCpuCores, octopusMemoryInGi = getGeneralInfoFromOctopus()
|
||||
octopusGeneralInfo := strconv.FormatInt(int64(octopusCpuCores), 10) + Comma + strconv.FormatInt(int64(octopusMemoryInGi), 10)
|
||||
redisClient.Set(OctopusGeneralInfo, octopusGeneralInfo, 168*time.Hour)
|
||||
} else {
|
||||
strs := strings.Split(res, Comma)
|
||||
cpu, _ := strconv.ParseInt(strs[0], 10, 32)
|
||||
memory, _ := strconv.ParseInt(strs[1], 10, 32)
|
||||
octopusCpuCores = int32(cpu)
|
||||
octopusMemoryInGi = int32(memory)
|
||||
}
|
||||
}
|
||||
|
||||
resp.CpuCoreNum = octopusCpuCores
|
||||
resp.MemoryInGib = octopusMemoryInGi
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
func getGeneralInfoFromOctopus() (int32, int32) {
|
||||
octopusConfig := config.Cfg
|
||||
|
||||
urlMap := map[string]string{
|
||||
common.Hanwuji: octopusConfig.OctopusConfig.HanwujiUrl + octopusConfig.OctopusConfig.OctopusResouceSpec,
|
||||
common.Suiyuan: octopusConfig.OctopusConfig.SuiyuanUrl + octopusConfig.OctopusConfig.OctopusResouceSpec,
|
||||
common.Sailingsi: octopusConfig.OctopusConfig.SailingsiUrl + octopusConfig.OctopusConfig.OctopusResouceSpec,
|
||||
}
|
||||
|
||||
var cpuCoreNum int32
|
||||
var memoryInGib int32
|
||||
for k, v := range urlMap {
|
||||
token := common.GetToken(k)
|
||||
body, err := common.OctopusHttpClient("GET", v, nil, token)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
//获取训练资源算力
|
||||
switch k {
|
||||
case common.Hanwuji:
|
||||
resourceSpec := common.HanwujiResp{}
|
||||
err := json.Unmarshal(body, &resourceSpec)
|
||||
if err != nil {
|
||||
log.Println("Hanwuji json转换失败 : ", err)
|
||||
continue
|
||||
}
|
||||
if !resourceSpec.Success {
|
||||
log.Println("Hanwuji 获取训练资源失败 : ", resourceSpec.Error)
|
||||
continue
|
||||
}
|
||||
for _, spec := range resourceSpec.Payload.MapResourceSpecIdList.Train.ResourceSpecs {
|
||||
cpuInfo, err := strconv.ParseInt(spec.ResourceQuantity.Cpu, 10, 32)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
cpuCoreNum += int32(cpuInfo)
|
||||
|
||||
memoryStr := strings.Replace(spec.ResourceQuantity.Memory, GI, "", -1)
|
||||
memoryInfo, err := strconv.ParseInt(memoryStr, 10, 32)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
memoryInGib += int32(memoryInfo)
|
||||
}
|
||||
case common.Suiyuan:
|
||||
resourceSpec := common.SuiyuanResp{}
|
||||
err := json.Unmarshal(body, &resourceSpec)
|
||||
if err != nil {
|
||||
log.Println("Suiyuan json转换失败 : ", err)
|
||||
continue
|
||||
}
|
||||
if !resourceSpec.Success {
|
||||
log.Println("Suiyuan 获取训练资源失败 : ", resourceSpec.Error)
|
||||
continue
|
||||
}
|
||||
for _, spec := range resourceSpec.Payload.MapResourceSpecIdList.Train.ResourceSpecs {
|
||||
cpuInfo, err := strconv.ParseInt(spec.ResourceQuantity.Cpu, 10, 32)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
cpuCoreNum += int32(cpuInfo)
|
||||
|
||||
memoryStr := strings.Replace(spec.ResourceQuantity.Memory, GI, "", -1)
|
||||
memoryInfo, err := strconv.ParseInt(memoryStr, 10, 32)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
memoryInGib += int32(memoryInfo)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return cpuCoreNum, memoryInGib
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetMyAlgorithmListLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetMyAlgorithmListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMyAlgorithmListLogic {
|
||||
return &GetMyAlgorithmListLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// Algorithm
|
||||
func (l *GetMyAlgorithmListLogic) GetMyAlgorithmList(in *octopus.GetMyAlgorithmListReq) (*octopus.GetMyAlgorithmListResp, error) {
|
||||
resp := &octopus.GetMyAlgorithmListResp{}
|
||||
|
||||
var url_prefix = common.OctopusUrls[in.Platform]
|
||||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetMyAlgorithmList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
SetHeader("Authorization", "Bearer "+token).
|
||||
SetQueryString("pageIndex=" + strconv.Itoa(int(in.PageIndex))).
|
||||
SetQueryString("pageSize=" + strconv.Itoa(int(in.PageSize))).
|
||||
SetResult(resp).
|
||||
Get(reqUrl)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetMyDatasetListLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetMyDatasetListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMyDatasetListLogic {
|
||||
return &GetMyDatasetListLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// DatasetService
|
||||
func (l *GetMyDatasetListLogic) GetMyDatasetList(in *octopus.GetMyDatasetListReq) (*octopus.GetMyDatasetListResp, error) {
|
||||
resp := &octopus.GetMyDatasetListResp{}
|
||||
|
||||
var url_prefix = common.OctopusUrls[in.Platform]
|
||||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetMydatasetList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
SetHeader("Authorization", "Bearer "+token).
|
||||
SetQueryString("pageIndex=" + strconv.Itoa(int(in.PageIndex))).
|
||||
SetQueryString("pageSize=" + strconv.Itoa(int(in.PageSize))).
|
||||
SetResult(resp).
|
||||
Get(reqUrl)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetNotebookListLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetNotebookListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetNotebookListLogic {
|
||||
return &GetNotebookListLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// ModelDeployService
|
||||
func (l *GetNotebookListLogic) GetNotebookList(in *octopus.GetNotebookListReq) (*octopus.GetNotebookListResp, error) {
|
||||
resp := &octopus.GetNotebookListResp{}
|
||||
|
||||
var url_prefix = common.OctopusUrls[in.Platform]
|
||||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetNotebookList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
SetHeader("Authorization", "Bearer "+token).
|
||||
SetQueryString("pageIndex=" + strconv.Itoa(int(in.PageIndex))).
|
||||
SetQueryString("pageSize=" + strconv.Itoa(int(in.PageSize))).
|
||||
SetResult(resp).
|
||||
Get(reqUrl)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &octopus.GetNotebookListResp{}, nil
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetUserImageListLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetUserImageListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserImageListLogic {
|
||||
return &GetUserImageListLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// ImageService
|
||||
func (l *GetUserImageListLogic) GetUserImageList(in *octopus.GetUserImageListReq) (*octopus.GetUserImageListResp, error) {
|
||||
resp := &octopus.GetUserImageListResp{}
|
||||
|
||||
var url_prefix = common.OctopusUrls[in.Platform]
|
||||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetUserImageList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
SetHeader("Authorization", "Bearer "+token).
|
||||
SetQueryString("pageIndex=" + strconv.Itoa(int(in.PageIndex))).
|
||||
SetQueryString("pageSize=" + strconv.Itoa(int(in.PageSize))).
|
||||
SetResult(resp).
|
||||
Get(reqUrl)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
// Code generated by goctl. DO NOT EDIT.
|
||||
// Source: octopus.proto
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/logic"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
)
|
||||
|
||||
type OctopusServer struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
octopus.UnimplementedOctopusServer
|
||||
}
|
||||
|
||||
func NewOctopusServer(svcCtx *svc.ServiceContext) *OctopusServer {
|
||||
return &OctopusServer{
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *OctopusServer) GetComputingPower(ctx context.Context, in *octopus.ResourceReq) (*octopus.CpResp, error) {
|
||||
l := logic.NewGetComputingPowerLogic(ctx, s.svcCtx)
|
||||
return l.GetComputingPower(in)
|
||||
}
|
||||
|
||||
func (s *OctopusServer) GetGeneralInfo(ctx context.Context, in *octopus.ResourceReq) (*octopus.GiResp, error) {
|
||||
l := logic.NewGetGeneralInfoLogic(ctx, s.svcCtx)
|
||||
return l.GetGeneralInfo(in)
|
||||
}
|
||||
|
||||
// Algorithm
|
||||
func (s *OctopusServer) GetMyAlgorithmList(ctx context.Context, in *octopus.GetMyAlgorithmListReq) (*octopus.GetMyAlgorithmListResp, error) {
|
||||
l := logic.NewGetMyAlgorithmListLogic(ctx, s.svcCtx)
|
||||
return l.GetMyAlgorithmList(in)
|
||||
}
|
||||
|
||||
// DatasetService
|
||||
func (s *OctopusServer) GetMyDatasetList(ctx context.Context, in *octopus.GetMyDatasetListReq) (*octopus.GetMyDatasetListResp, error) {
|
||||
l := logic.NewGetMyDatasetListLogic(ctx, s.svcCtx)
|
||||
return l.GetMyDatasetList(in)
|
||||
}
|
||||
|
||||
func (s *OctopusServer) CreateDataSet(ctx context.Context, in *octopus.CreateDataSetReq) (*octopus.CreateDataSetResq, error) {
|
||||
l := logic.NewCreateDataSetLogic(ctx, s.svcCtx)
|
||||
return l.CreateDataSet(in)
|
||||
}
|
||||
|
||||
// ModelDeployService
|
||||
func (s *OctopusServer) GetNotebookList(ctx context.Context, in *octopus.GetNotebookListReq) (*octopus.GetNotebookListResp, error) {
|
||||
l := logic.NewGetNotebookListLogic(ctx, s.svcCtx)
|
||||
return l.GetNotebookList(in)
|
||||
}
|
||||
|
||||
// ImageService
|
||||
func (s *OctopusServer) GetUserImageList(ctx context.Context, in *octopus.GetUserImageListReq) (*octopus.GetUserImageListResp, error) {
|
||||
l := logic.NewGetUserImageListLogic(ctx, s.svcCtx)
|
||||
return l.GetUserImageList(in)
|
||||
}
|
||||
|
||||
func (s *OctopusServer) CreateImage(ctx context.Context, in *octopus.CreateImageReq) (*octopus.CreateImageResp, error) {
|
||||
l := logic.NewCreateImageLogic(ctx, s.svcCtx)
|
||||
return l.CreateImage(in)
|
||||
}
|
||||
|
||||
func (s *OctopusServer) DeleteImage(ctx context.Context, in *octopus.DeleteImageReq) (*octopus.DeleteImageResp, error) {
|
||||
l := logic.NewDeleteImageLogic(ctx, s.svcCtx)
|
||||
return l.DeleteImage(in)
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package svc
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/config"
|
||||
"PCM/adaptor/PCM-CORE/rpc/pcmcoreclient"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
PcmCoreRpc pcmcoreclient.PcmCore
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
PcmCoreRpc: pcmcoreclient.NewPcmCore(zrpc.MustNewClient(c.PcmCoreRpcConf)),
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"PCM/common/interceptor/rpcserver"
|
||||
"flag"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/config"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/server"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/service"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection"
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
c := config.Cfg
|
||||
ctx := svc.NewServiceContext(c)
|
||||
|
||||
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
||||
octopus.RegisterOctopusServer(grpcServer, server.NewOctopusServer(ctx))
|
||||
|
||||
if c.Mode == service.DevMode || c.Mode == service.TestMode {
|
||||
reflection.Register(grpcServer)
|
||||
}
|
||||
})
|
||||
|
||||
//rpc log
|
||||
s.AddUnaryInterceptors(rpcserver.LoggerInterceptor)
|
||||
|
||||
defer s.Stop()
|
||||
logx.Infof("Starting rpc server at %s...\n", c.ListenOn)
|
||||
s.Start()
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,403 +0,0 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.19.4
|
||||
// source: octopus.proto
|
||||
|
||||
package octopus
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// OctopusClient is the client API for Octopus service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type OctopusClient interface {
|
||||
GetComputingPower(ctx context.Context, in *ResourceReq, opts ...grpc.CallOption) (*CpResp, error)
|
||||
GetGeneralInfo(ctx context.Context, in *ResourceReq, opts ...grpc.CallOption) (*GiResp, error)
|
||||
// Algorithm
|
||||
GetMyAlgorithmList(ctx context.Context, in *GetMyAlgorithmListReq, opts ...grpc.CallOption) (*GetMyAlgorithmListResp, error)
|
||||
// DatasetService
|
||||
GetMyDatasetList(ctx context.Context, in *GetMyDatasetListReq, opts ...grpc.CallOption) (*GetMyDatasetListResp, error)
|
||||
CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error)
|
||||
// ModelDeployService
|
||||
// Develop
|
||||
GetNotebookList(ctx context.Context, in *GetNotebookListReq, opts ...grpc.CallOption) (*GetNotebookListResp, error)
|
||||
// ImageService
|
||||
GetUserImageList(ctx context.Context, in *GetUserImageListReq, opts ...grpc.CallOption) (*GetUserImageListResp, error)
|
||||
CreateImage(ctx context.Context, in *CreateImageReq, opts ...grpc.CallOption) (*CreateImageResp, error)
|
||||
DeleteImage(ctx context.Context, in *DeleteImageReq, opts ...grpc.CallOption) (*DeleteImageResp, error)
|
||||
}
|
||||
|
||||
type octopusClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewOctopusClient(cc grpc.ClientConnInterface) OctopusClient {
|
||||
return &octopusClient{cc}
|
||||
}
|
||||
|
||||
func (c *octopusClient) GetComputingPower(ctx context.Context, in *ResourceReq, opts ...grpc.CallOption) (*CpResp, error) {
|
||||
out := new(CpResp)
|
||||
err := c.cc.Invoke(ctx, "/octopus.Octopus/GetComputingPower", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *octopusClient) GetGeneralInfo(ctx context.Context, in *ResourceReq, opts ...grpc.CallOption) (*GiResp, error) {
|
||||
out := new(GiResp)
|
||||
err := c.cc.Invoke(ctx, "/octopus.Octopus/GetGeneralInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *octopusClient) GetMyAlgorithmList(ctx context.Context, in *GetMyAlgorithmListReq, opts ...grpc.CallOption) (*GetMyAlgorithmListResp, error) {
|
||||
out := new(GetMyAlgorithmListResp)
|
||||
err := c.cc.Invoke(ctx, "/octopus.Octopus/GetMyAlgorithmList", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *octopusClient) GetMyDatasetList(ctx context.Context, in *GetMyDatasetListReq, opts ...grpc.CallOption) (*GetMyDatasetListResp, error) {
|
||||
out := new(GetMyDatasetListResp)
|
||||
err := c.cc.Invoke(ctx, "/octopus.Octopus/GetMyDatasetList", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *octopusClient) CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error) {
|
||||
out := new(CreateDataSetResq)
|
||||
err := c.cc.Invoke(ctx, "/octopus.Octopus/CreateDataSet", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *octopusClient) GetNotebookList(ctx context.Context, in *GetNotebookListReq, opts ...grpc.CallOption) (*GetNotebookListResp, error) {
|
||||
out := new(GetNotebookListResp)
|
||||
err := c.cc.Invoke(ctx, "/octopus.Octopus/GetNotebookList", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *octopusClient) GetUserImageList(ctx context.Context, in *GetUserImageListReq, opts ...grpc.CallOption) (*GetUserImageListResp, error) {
|
||||
out := new(GetUserImageListResp)
|
||||
err := c.cc.Invoke(ctx, "/octopus.Octopus/GetUserImageList", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *octopusClient) CreateImage(ctx context.Context, in *CreateImageReq, opts ...grpc.CallOption) (*CreateImageResp, error) {
|
||||
out := new(CreateImageResp)
|
||||
err := c.cc.Invoke(ctx, "/octopus.Octopus/CreateImage", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *octopusClient) DeleteImage(ctx context.Context, in *DeleteImageReq, opts ...grpc.CallOption) (*DeleteImageResp, error) {
|
||||
out := new(DeleteImageResp)
|
||||
err := c.cc.Invoke(ctx, "/octopus.Octopus/DeleteImage", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// OctopusServer is the server API for Octopus service.
|
||||
// All implementations must embed UnimplementedOctopusServer
|
||||
// for forward compatibility
|
||||
type OctopusServer interface {
|
||||
GetComputingPower(context.Context, *ResourceReq) (*CpResp, error)
|
||||
GetGeneralInfo(context.Context, *ResourceReq) (*GiResp, error)
|
||||
// Algorithm
|
||||
GetMyAlgorithmList(context.Context, *GetMyAlgorithmListReq) (*GetMyAlgorithmListResp, error)
|
||||
// DatasetService
|
||||
GetMyDatasetList(context.Context, *GetMyDatasetListReq) (*GetMyDatasetListResp, error)
|
||||
CreateDataSet(context.Context, *CreateDataSetReq) (*CreateDataSetResq, error)
|
||||
// ModelDeployService
|
||||
// Develop
|
||||
GetNotebookList(context.Context, *GetNotebookListReq) (*GetNotebookListResp, error)
|
||||
// ImageService
|
||||
GetUserImageList(context.Context, *GetUserImageListReq) (*GetUserImageListResp, error)
|
||||
CreateImage(context.Context, *CreateImageReq) (*CreateImageResp, error)
|
||||
DeleteImage(context.Context, *DeleteImageReq) (*DeleteImageResp, error)
|
||||
mustEmbedUnimplementedOctopusServer()
|
||||
}
|
||||
|
||||
// UnimplementedOctopusServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedOctopusServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedOctopusServer) GetComputingPower(context.Context, *ResourceReq) (*CpResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetComputingPower not implemented")
|
||||
}
|
||||
func (UnimplementedOctopusServer) GetGeneralInfo(context.Context, *ResourceReq) (*GiResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetGeneralInfo not implemented")
|
||||
}
|
||||
func (UnimplementedOctopusServer) GetMyAlgorithmList(context.Context, *GetMyAlgorithmListReq) (*GetMyAlgorithmListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetMyAlgorithmList not implemented")
|
||||
}
|
||||
func (UnimplementedOctopusServer) GetMyDatasetList(context.Context, *GetMyDatasetListReq) (*GetMyDatasetListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetMyDatasetList not implemented")
|
||||
}
|
||||
func (UnimplementedOctopusServer) CreateDataSet(context.Context, *CreateDataSetReq) (*CreateDataSetResq, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateDataSet not implemented")
|
||||
}
|
||||
func (UnimplementedOctopusServer) GetNotebookList(context.Context, *GetNotebookListReq) (*GetNotebookListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetNotebookList not implemented")
|
||||
}
|
||||
func (UnimplementedOctopusServer) GetUserImageList(context.Context, *GetUserImageListReq) (*GetUserImageListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetUserImageList not implemented")
|
||||
}
|
||||
func (UnimplementedOctopusServer) CreateImage(context.Context, *CreateImageReq) (*CreateImageResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateImage not implemented")
|
||||
}
|
||||
func (UnimplementedOctopusServer) DeleteImage(context.Context, *DeleteImageReq) (*DeleteImageResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteImage not implemented")
|
||||
}
|
||||
func (UnimplementedOctopusServer) mustEmbedUnimplementedOctopusServer() {}
|
||||
|
||||
// UnsafeOctopusServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to OctopusServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeOctopusServer interface {
|
||||
mustEmbedUnimplementedOctopusServer()
|
||||
}
|
||||
|
||||
func RegisterOctopusServer(s grpc.ServiceRegistrar, srv OctopusServer) {
|
||||
s.RegisterService(&Octopus_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Octopus_GetComputingPower_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ResourceReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OctopusServer).GetComputingPower(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/octopus.Octopus/GetComputingPower",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OctopusServer).GetComputingPower(ctx, req.(*ResourceReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Octopus_GetGeneralInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ResourceReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OctopusServer).GetGeneralInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/octopus.Octopus/GetGeneralInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OctopusServer).GetGeneralInfo(ctx, req.(*ResourceReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Octopus_GetMyAlgorithmList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetMyAlgorithmListReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OctopusServer).GetMyAlgorithmList(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/octopus.Octopus/GetMyAlgorithmList",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OctopusServer).GetMyAlgorithmList(ctx, req.(*GetMyAlgorithmListReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Octopus_GetMyDatasetList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetMyDatasetListReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OctopusServer).GetMyDatasetList(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/octopus.Octopus/GetMyDatasetList",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OctopusServer).GetMyDatasetList(ctx, req.(*GetMyDatasetListReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Octopus_CreateDataSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateDataSetReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OctopusServer).CreateDataSet(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/octopus.Octopus/CreateDataSet",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OctopusServer).CreateDataSet(ctx, req.(*CreateDataSetReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Octopus_GetNotebookList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetNotebookListReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OctopusServer).GetNotebookList(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/octopus.Octopus/GetNotebookList",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OctopusServer).GetNotebookList(ctx, req.(*GetNotebookListReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Octopus_GetUserImageList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetUserImageListReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OctopusServer).GetUserImageList(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/octopus.Octopus/GetUserImageList",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OctopusServer).GetUserImageList(ctx, req.(*GetUserImageListReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Octopus_CreateImage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateImageReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OctopusServer).CreateImage(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/octopus.Octopus/CreateImage",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OctopusServer).CreateImage(ctx, req.(*CreateImageReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Octopus_DeleteImage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteImageReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OctopusServer).DeleteImage(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/octopus.Octopus/DeleteImage",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OctopusServer).DeleteImage(ctx, req.(*DeleteImageReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Octopus_ServiceDesc is the grpc.ServiceDesc for Octopus service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Octopus_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "octopus.Octopus",
|
||||
HandlerType: (*OctopusServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetComputingPower",
|
||||
Handler: _Octopus_GetComputingPower_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetGeneralInfo",
|
||||
Handler: _Octopus_GetGeneralInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetMyAlgorithmList",
|
||||
Handler: _Octopus_GetMyAlgorithmList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetMyDatasetList",
|
||||
Handler: _Octopus_GetMyDatasetList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateDataSet",
|
||||
Handler: _Octopus_CreateDataSet_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetNotebookList",
|
||||
Handler: _Octopus_GetNotebookList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetUserImageList",
|
||||
Handler: _Octopus_GetUserImageList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateImage",
|
||||
Handler: _Octopus_CreateImage_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteImage",
|
||||
Handler: _Octopus_DeleteImage_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "octopus.proto",
|
||||
}
|
|
@ -1,123 +0,0 @@
|
|||
// Code generated by goctl. DO NOT EDIT.
|
||||
// Source: octopus.proto
|
||||
|
||||
package octopusclient
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type (
|
||||
Algorithms = octopus.Algorithms
|
||||
Applies = octopus.Applies
|
||||
CpResp = octopus.CpResp
|
||||
CreateDataSetReq = octopus.CreateDataSetReq
|
||||
CreateDataSetResq = octopus.CreateDataSetResq
|
||||
CreateImage = octopus.CreateImage
|
||||
CreateImageReq = octopus.CreateImageReq
|
||||
CreateImageResp = octopus.CreateImageResp
|
||||
Datasets = octopus.Datasets
|
||||
DeleteImageReq = octopus.DeleteImageReq
|
||||
DeleteImageResp = octopus.DeleteImageResp
|
||||
Error = octopus.Error
|
||||
GetMyAlgorithmListReq = octopus.GetMyAlgorithmListReq
|
||||
GetMyAlgorithmListResp = octopus.GetMyAlgorithmListResp
|
||||
GetMyDatasetListReq = octopus.GetMyDatasetListReq
|
||||
GetMyDatasetListResp = octopus.GetMyDatasetListResp
|
||||
GetNotebookListReq = octopus.GetNotebookListReq
|
||||
GetNotebookListResp = octopus.GetNotebookListResp
|
||||
GetUserImageListReq = octopus.GetUserImageListReq
|
||||
GetUserImageListResp = octopus.GetUserImageListResp
|
||||
GiResp = octopus.GiResp
|
||||
Image = octopus.Image
|
||||
Images = octopus.Images
|
||||
Notebooks = octopus.Notebooks
|
||||
PayloadCreateImage = octopus.PayloadCreateImage
|
||||
PayloadDeleteImage = octopus.PayloadDeleteImage
|
||||
PayloadMyAlgorithmList = octopus.PayloadMyAlgorithmList
|
||||
PayloadMyDatasetList = octopus.PayloadMyDatasetList
|
||||
PayloadNotebookList = octopus.PayloadNotebookList
|
||||
PayloadUserImageList = octopus.PayloadUserImageList
|
||||
ResourceReq = octopus.ResourceReq
|
||||
Tasks = octopus.Tasks
|
||||
|
||||
Octopus interface {
|
||||
GetComputingPower(ctx context.Context, in *ResourceReq, opts ...grpc.CallOption) (*CpResp, error)
|
||||
GetGeneralInfo(ctx context.Context, in *ResourceReq, opts ...grpc.CallOption) (*GiResp, error)
|
||||
// Algorithm
|
||||
GetMyAlgorithmList(ctx context.Context, in *GetMyAlgorithmListReq, opts ...grpc.CallOption) (*GetMyAlgorithmListResp, error)
|
||||
// DatasetService
|
||||
GetMyDatasetList(ctx context.Context, in *GetMyDatasetListReq, opts ...grpc.CallOption) (*GetMyDatasetListResp, error)
|
||||
CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error)
|
||||
// ModelDeployService
|
||||
GetNotebookList(ctx context.Context, in *GetNotebookListReq, opts ...grpc.CallOption) (*GetNotebookListResp, error)
|
||||
// ImageService
|
||||
GetUserImageList(ctx context.Context, in *GetUserImageListReq, opts ...grpc.CallOption) (*GetUserImageListResp, error)
|
||||
CreateImage(ctx context.Context, in *CreateImageReq, opts ...grpc.CallOption) (*CreateImageResp, error)
|
||||
DeleteImage(ctx context.Context, in *DeleteImageReq, opts ...grpc.CallOption) (*DeleteImageResp, error)
|
||||
}
|
||||
|
||||
defaultOctopus struct {
|
||||
cli zrpc.Client
|
||||
}
|
||||
)
|
||||
|
||||
func NewOctopus(cli zrpc.Client) Octopus {
|
||||
return &defaultOctopus{
|
||||
cli: cli,
|
||||
}
|
||||
}
|
||||
|
||||
func (m *defaultOctopus) GetComputingPower(ctx context.Context, in *ResourceReq, opts ...grpc.CallOption) (*CpResp, error) {
|
||||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
return client.GetComputingPower(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultOctopus) GetGeneralInfo(ctx context.Context, in *ResourceReq, opts ...grpc.CallOption) (*GiResp, error) {
|
||||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
return client.GetGeneralInfo(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// Algorithm
|
||||
func (m *defaultOctopus) GetMyAlgorithmList(ctx context.Context, in *GetMyAlgorithmListReq, opts ...grpc.CallOption) (*GetMyAlgorithmListResp, error) {
|
||||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
return client.GetMyAlgorithmList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// DatasetService
|
||||
func (m *defaultOctopus) GetMyDatasetList(ctx context.Context, in *GetMyDatasetListReq, opts ...grpc.CallOption) (*GetMyDatasetListResp, error) {
|
||||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
return client.GetMyDatasetList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultOctopus) CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error) {
|
||||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
return client.CreateDataSet(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// ModelDeployService
|
||||
func (m *defaultOctopus) GetNotebookList(ctx context.Context, in *GetNotebookListReq, opts ...grpc.CallOption) (*GetNotebookListResp, error) {
|
||||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
return client.GetNotebookList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// ImageService
|
||||
func (m *defaultOctopus) GetUserImageList(ctx context.Context, in *GetUserImageListReq, opts ...grpc.CallOption) (*GetUserImageListResp, error) {
|
||||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
return client.GetUserImageList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultOctopus) CreateImage(ctx context.Context, in *CreateImageReq, opts ...grpc.CallOption) (*CreateImageResp, error) {
|
||||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
return client.CreateImage(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultOctopus) DeleteImage(ctx context.Context, in *DeleteImageReq, opts ...grpc.CallOption) (*DeleteImageResp, error) {
|
||||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
return client.DeleteImage(ctx, in, opts...)
|
||||
}
|
|
@ -1,289 +0,0 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package octopus;
|
||||
option go_package = "/octopus";
|
||||
|
||||
|
||||
message resourceReq{
|
||||
}
|
||||
|
||||
message cpResp{
|
||||
float pOpsAtFp16 = 1;
|
||||
}
|
||||
|
||||
message giResp{
|
||||
int32 cpuCoreNum = 1;
|
||||
int32 memoryInGib = 2;
|
||||
}
|
||||
|
||||
|
||||
message CreateDataSetReq {
|
||||
repeated string applyIds = 1; // @gotags: copier:"ApplyIds"
|
||||
string desc = 2; // @gotags: copier:"Desc"
|
||||
string name = 3; // @gotags: copier:"Name"
|
||||
string typeId = 4; // @gotags: copier:"TypeId"
|
||||
|
||||
}
|
||||
|
||||
message CreateDataSetResq{
|
||||
string id =1; // @gotags: copier:"Id"
|
||||
string version =2; // @gotags: copier:"Version"
|
||||
}
|
||||
|
||||
/******************Algorithm Start*************************/
|
||||
message GetMyAlgorithmListReq{
|
||||
string platform =1;
|
||||
int32 pageIndex =2;
|
||||
int32 pageSize =3;
|
||||
}
|
||||
|
||||
message GetMyAlgorithmListResp{
|
||||
bool success =1;
|
||||
PayloadMyAlgorithmList payload =2;
|
||||
Error error = 3;
|
||||
}
|
||||
|
||||
message PayloadMyAlgorithmList{
|
||||
int32 totalSize =1;
|
||||
repeated Algorithms algorithms = 2;
|
||||
}
|
||||
|
||||
message Algorithms{
|
||||
string algorithmId =1;
|
||||
string algorithmVersion = 2;
|
||||
string spaceId = 3;
|
||||
string spaceName = 4;
|
||||
string userId = 5;
|
||||
string userName=6;
|
||||
string algorithmName=7;
|
||||
string modelName=8;
|
||||
int32 fileStatus=9;
|
||||
int32 latestCompressed=10;
|
||||
string algorithmDescript=11;
|
||||
string path=12;
|
||||
bool isPrefab=13;
|
||||
int64 createdAt=14;
|
||||
string applyId=15;
|
||||
string applyName=16;
|
||||
string frameworkId=17;
|
||||
string frameworkName=18;
|
||||
}
|
||||
/******************Algorithm End*************************/
|
||||
|
||||
/******************DatasetService Start*************************/
|
||||
message GetMyDatasetListReq{
|
||||
string platform =1;
|
||||
int32 pageIndex =2;
|
||||
int32 pageSize =3;
|
||||
}
|
||||
|
||||
message GetMyDatasetListResp{
|
||||
bool success =1;
|
||||
PayloadMyDatasetList payload =2;
|
||||
Error error = 3;
|
||||
}
|
||||
|
||||
message PayloadMyDatasetList{
|
||||
int32 totalSize =1;
|
||||
repeated Datasets datasets = 2;
|
||||
}
|
||||
|
||||
message Datasets{
|
||||
int64 createdAt =1;
|
||||
int64 updatedAt=2;
|
||||
string id=3;
|
||||
int32 sourceType=4;
|
||||
string name=5;
|
||||
string typeId=6;
|
||||
string typeDesc=7;
|
||||
repeated Applies applies=8;
|
||||
string desc=9;
|
||||
string latestVersion=10;
|
||||
string userName = 11;
|
||||
}
|
||||
message Applies{
|
||||
string id=1;
|
||||
string desc=2;
|
||||
}
|
||||
/******************DatasetService End*************************/
|
||||
|
||||
/******************ModelDeployService Start*************************/
|
||||
/******************ModelDeployService End*************************/
|
||||
|
||||
/******************Develop Start*************************/
|
||||
message GetNotebookListReq{
|
||||
string platform =1;
|
||||
int32 pageIndex =2;
|
||||
int32 pageSize =3;
|
||||
}
|
||||
|
||||
message GetNotebookListResp{
|
||||
bool success =1;
|
||||
PayloadNotebookList payload =2;
|
||||
Error error = 3;
|
||||
}
|
||||
|
||||
message PayloadNotebookList{
|
||||
int32 totalSize =1;
|
||||
repeated Notebooks notebooks = 2;
|
||||
}
|
||||
|
||||
message Notebooks{
|
||||
int64 createdAt =1;
|
||||
int64 updatedAt =2;
|
||||
string id = 3;
|
||||
string userId =4;
|
||||
string workspaceId=5;
|
||||
string name=6;
|
||||
string desc=7;
|
||||
string imageId=8;
|
||||
string imageName=9;
|
||||
string algorithmId=10;
|
||||
string algorithmVersion=11;
|
||||
string algorithmName=12;
|
||||
string resourceSpecId=13;
|
||||
string resourceSpecName=14;
|
||||
string status=15;
|
||||
string datasetId=16;
|
||||
string datasetVersion=17;
|
||||
string datasetName=18;
|
||||
int32 resourceSpecPrice=19;
|
||||
string notebookJobId=20;
|
||||
string imageVersion=21;
|
||||
repeated Tasks tasks=22;
|
||||
string imageUrl=23;
|
||||
}
|
||||
|
||||
message Tasks{
|
||||
string url =1;
|
||||
string name= 2;
|
||||
}
|
||||
/******************Develop End*************************/
|
||||
|
||||
/******************ImageService Start*************************/
|
||||
message GetUserImageListReq{
|
||||
string platform =1;
|
||||
int32 pageIndex =2;
|
||||
int32 pageSize =3;
|
||||
}
|
||||
|
||||
message GetUserImageListResp{
|
||||
bool success =1;
|
||||
PayloadUserImageList payload =2;
|
||||
Error error = 3;
|
||||
}
|
||||
|
||||
message PayloadUserImageList{
|
||||
int32 totalSize =1;
|
||||
repeated Images images =2;
|
||||
}
|
||||
|
||||
message Images{
|
||||
bool isShared =1;
|
||||
Image image =2;
|
||||
}
|
||||
|
||||
message Image{
|
||||
string id =1;
|
||||
string imageName =2;
|
||||
string imageDesc = 3;
|
||||
string imageAddr = 4;
|
||||
int32 sourceType = 5;
|
||||
string spaceId = 6;
|
||||
string userId = 7;
|
||||
int64 createdAt = 8;
|
||||
int64 updatedAt = 9;
|
||||
int32 imageStatus = 10;
|
||||
string username = 11;
|
||||
string imageVersion = 12;
|
||||
string imageFullAddr = 13;
|
||||
}
|
||||
|
||||
message DeleteImageReq{
|
||||
string platform =1;
|
||||
string imageId=2;
|
||||
}
|
||||
|
||||
message DeleteImageResp{
|
||||
bool success =1;
|
||||
PayloadDeleteImage payload =2;
|
||||
Error error = 3;
|
||||
}
|
||||
|
||||
message PayloadDeleteImage{
|
||||
int64 deletedAt=1;
|
||||
}
|
||||
|
||||
message CreateImageReq{
|
||||
string platform =1;
|
||||
CreateImage createImage =2;
|
||||
}
|
||||
|
||||
message CreateImage{
|
||||
string imageAddr=2;
|
||||
string imageDesc=3;
|
||||
string imageName=4;
|
||||
string imageVersion=5;
|
||||
int32 sourceType=6; //1 = 上传, 2 = 远程
|
||||
}
|
||||
|
||||
message CreateImageResp{
|
||||
bool success =1;
|
||||
PayloadCreateImage payload =2;
|
||||
Error error = 3;
|
||||
}
|
||||
|
||||
message PayloadCreateImage{
|
||||
string imageId = 1;
|
||||
int64 createdAt=2;
|
||||
}
|
||||
|
||||
/******************ImageService End*************************/
|
||||
|
||||
/******************Model Start*************************/
|
||||
/******************Model End*************************/
|
||||
|
||||
/******************TrainJobService Start*************************/
|
||||
/******************TrainJobService End*************************/
|
||||
|
||||
message Error{
|
||||
int32 code =1;
|
||||
int32 subcode =2;
|
||||
string message =3;
|
||||
string subMessage =4;
|
||||
}
|
||||
|
||||
|
||||
service Octopus {
|
||||
|
||||
rpc GetComputingPower(resourceReq) returns (cpResp);
|
||||
|
||||
rpc GetGeneralInfo(resourceReq) returns (giResp);
|
||||
|
||||
//Algorithm
|
||||
rpc GetMyAlgorithmList(GetMyAlgorithmListReq) returns (GetMyAlgorithmListResp);
|
||||
|
||||
//DatasetService
|
||||
rpc GetMyDatasetList(GetMyDatasetListReq) returns (GetMyDatasetListResp);
|
||||
|
||||
rpc CreateDataSet(CreateDataSetReq) returns (CreateDataSetResq);
|
||||
|
||||
|
||||
//ModelDeployService
|
||||
//Develop
|
||||
rpc GetNotebookList(GetNotebookListReq) returns (GetNotebookListResp);
|
||||
|
||||
//ImageService
|
||||
rpc GetUserImageList(GetUserImageListReq) returns (GetUserImageListResp);
|
||||
|
||||
rpc CreateImage(CreateImageReq) returns (CreateImageResp);
|
||||
|
||||
rpc DeleteImage(DeleteImageReq) returns (DeleteImageResp);
|
||||
|
||||
|
||||
|
||||
|
||||
//Model
|
||||
//TrainJobService
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
FROM alpine:3.16.2
|
||||
WORKDIR /home
|
||||
|
||||
# 修改alpine源为上海交通大学
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.sjtug.sjtu.edu.cn/g' /etc/apk/repositories && \
|
||||
apk update && \
|
||||
apk upgrade && \
|
||||
apk add --no-cache ca-certificates && update-ca-certificates && \
|
||||
apk add --update tzdata && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
|
||||
COPY pcm-core /home/
|
||||
COPY etc/pcm.yaml /home/
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
EXPOSE 8999
|
||||
|
||||
ENTRYPOINT ./pcm-core -f pcm.yaml
|
|
@ -1,289 +0,0 @@
|
|||
syntax = "v1"
|
||||
|
||||
info(
|
||||
title: "gateway"
|
||||
desc: "gateway端微服务"
|
||||
author: "zhouqj"
|
||||
email: "450705171@qq.com"
|
||||
)
|
||||
|
||||
type (
|
||||
submitJobReq {
|
||||
SlurmVersion string `json:"slurmVersion"`
|
||||
|
||||
/****************parmas from ac********************/
|
||||
Apptype string `json:"apptype,optional"`
|
||||
Appname string `json:"appname,optional"`
|
||||
StrJobManagerID int64 `json:"strJobManagerID,optional"`
|
||||
MapAppJobInfo MapAppJobInfo `json:"mapAppJobInfo,optional"`
|
||||
/****************parmas from ac********************/
|
||||
|
||||
Account string `json:"account,optional"` //
|
||||
Acctg_freq string `json:"acctg_freq,optional"`
|
||||
Alloc_node string `json:"alloc_node,optional"`
|
||||
Alloc_resp_port int32 `json:"alloc_resp_port,optional"`
|
||||
Alloc_sid int32 `json:"alloc_sid,optional"`
|
||||
Argc int32 `json:"argc,optional"`
|
||||
Argv []Argv `json:"Argv,optional"`
|
||||
Array_inx string `json:"array_inx,optional"`
|
||||
Begin_time int64 `json:"begin_time,optional"`
|
||||
Ckpt_interval int32 `json:"ckpt_interval,optional"`
|
||||
Ckpt_dir string `json:"ckpt_dir,optional"`
|
||||
Comment string `json:"comment,optional"`
|
||||
Contiguous int32 `json:"contiguous,optional"`
|
||||
Cpu_bind string `json:"cpu_bind,optional"`
|
||||
Cpu_bind_type int32 `json:"cpu_bind_type,optional"`
|
||||
Dependency string `json:"dependency,optional"`
|
||||
End_time int64 `json:"end_time,optional"`
|
||||
Environment []Environment `json:"Environment,optional"`
|
||||
Env_size int32 `json:"env_size,optional"`
|
||||
Exc_nodes string `json:"exc_nodes,optional"`
|
||||
Features string `json:"features,optional"`
|
||||
Gres string `json:"gres,optional"`
|
||||
Group_id int32 `json:"group_id,optional"`
|
||||
Immediate int32 `json:"immediate,optional"`
|
||||
Job_id int32 `json:"job_id,optional"`
|
||||
Kill_on_node_fail int32 `json:"kill_on_node_fail,optional"`
|
||||
Licenses string `json:"licenses,optional"`
|
||||
Mail_type int32 `json:"mail_type,optional"`
|
||||
Mail_user string `json:"mail_user,optional"`
|
||||
Mem_bind string `json:"mem_bind,optional"`
|
||||
Mem_bind_type int32 `json:"mem_bind_type,optional"`
|
||||
Name string `json:"name,optional"` //
|
||||
Network string `json:"network,optional"`
|
||||
Nice int32 `json:"nice,optional"`
|
||||
Num_tasks int32 `json:"num_tasks,optional"`
|
||||
Open_mode int32 `json:"open_mode,optional"`
|
||||
Other_port int32 `json:"other_port,optional"`
|
||||
Overcommit int32 `json:"overcommit,optional"`
|
||||
Partition string `json:"partition,optional"`
|
||||
Plane_size int32 `json:"plane_size,optional"`
|
||||
Priority int32 `json:"priority,optional"`
|
||||
Profile int32 `json:"profile,optional"`
|
||||
Qos string `json:"qos,optional"`
|
||||
Resp_host string `json:"resp_host,optional"`
|
||||
Req_nodes string `json:"req_nodes,optional"`
|
||||
Requeue int32 `json:"requeue,optional"`
|
||||
Reservation string `json:"reservation,optional"`
|
||||
Script string `json:"script,optional"` //
|
||||
Shared int32 `json:"shared,optional"`
|
||||
Spank_job_env_size int32 `json:"spank_job_env_size,optional"`
|
||||
Task_dist int32 `json:"task_dist,optional"`
|
||||
Time_limit int32 `json:"time_limit,optional"`
|
||||
Time_min int32 `json:"time_min,optional"`
|
||||
User_id int32 `json:"user_id,optional"` //
|
||||
Wait_all_nodes int32 `json:"wait_all_nodes,optional"`
|
||||
Warn_signal int32 `json:"warn_signal,optional"`
|
||||
Warn_time int32 `json:"warn_time,optional"`
|
||||
Work_dir string `json:"work_dir,optional"`
|
||||
Cpus_per_task int32 `json:"cpus_per_task,optional"`
|
||||
Min_cpus int32 `json:"min_cpus,optional"` //
|
||||
Max_cpus int32 `json:"max_cpus,optional"`
|
||||
Min_nodes int32 `json:"min_nodes,optional"`
|
||||
Max_nodes int32 `json:"max_nodes,optional"`
|
||||
Boards_per_node int32 `json:"boards_per_node,optional"`
|
||||
Sockets_per_board int32 `json:"sockets_per_board,optional"`
|
||||
Sockets_per_node int32 `json:"sockets_per_node,optional"`
|
||||
Cores_per_socket int32 `json:"cores_per_socket,optional"`
|
||||
Threads_per_core int32 `json:"threads_per_core,optional"`
|
||||
Ntasks_per_node int32 `json:"ntasks_per_node,optional"`
|
||||
Ntasks_per_socket int32 `json:"ntasks_per_socket,optional"`
|
||||
Ntasks_per_core int32 `json:"ntasks_per_core,optional"`
|
||||
Ntasks_per_board int32 `json:"ntasks_per_board,optional"`
|
||||
Pn_min_cpus int32 `json:"pn_min_cpus,optional"`
|
||||
Pn_min_memory int32 `json:"pn_min_memory,optional"`
|
||||
Pn_min_tmp_disk int32 `json:"pn_min_tmp_disk,optional"`
|
||||
Reboot int32 `json:"reboot,optional"`
|
||||
Rotate int32 `json:"rotate,optional"`
|
||||
Req_switch int32 `json:"req_switch,optional"`
|
||||
Std_err string `json:"std_err,optional"`
|
||||
Std_in string `json:"std_in,optional"`
|
||||
Std_out string `json:"std_out,optional"`
|
||||
Wait4switch int32 `json:"wait4switch,optional"`
|
||||
Wckey string `json:"wckey,optional"`
|
||||
}
|
||||
|
||||
submitJobResp {
|
||||
//Job_id int32 `json:"job_id"`
|
||||
//Step_id int32 `json:"step_id"`
|
||||
//Error_code int32 `json:"error_code"`
|
||||
|
||||
Code string `json:"code"` //Error_code 返回码 in Tianhe
|
||||
Msg string `json:"msg"`
|
||||
Data string `json:"data"` //Job_id 作业id in Tianhe
|
||||
}
|
||||
|
||||
MapAppJobInfo {
|
||||
GAP_CMD_FILE string `json:"GAP_CMD_FILE"` //命令行内容
|
||||
GAP_NNODE string `json:"GAP_NNODE"` //节点个数(当指定该参数时,GAP_NODE_STRING必须为"")
|
||||
GAP_NODE_STRING string `json:"GAP_NODE_STRING,optional"` //指定节点(当指定该参数时,GAP_NNODE必须为"")
|
||||
GAP_SUBMIT_TYPE string `json:"GAP_SUBMIT_TYPE"` //cmd(命令行模式)
|
||||
GAP_JOB_NAME string `json:"GAP_JOB_NAME"` //作业名称
|
||||
GAP_WORK_DIR string `json:"GAP_WORK_DIR"` //工作路径
|
||||
GAP_QUEUE string `json:"GAP_QUEUE"` //队列名称
|
||||
GAP_NPROC string `json:"GAP_NPROC,optional"` //总核心数(GAP_NPROC和GAP_PPN选其一填写)
|
||||
GAP_PPN string `json:"GAP_PPN,optional"` //CPU核心/节点(GAP_NPROC和GAP_PPN选其一填写)
|
||||
GAP_NGPU string `json:"GAP_NGPU,optional"` //GPU卡数/节点
|
||||
GAP_NDCU string `json:"GAP_NDCU,optional"` //DCU卡数/节点
|
||||
GAP_JOB_MEM string `json:"GAP_JOB_MEM,optional"` //每个节点内存值,单位为MB/GB
|
||||
GAP_WALL_TIME string `json:"GAP_WALL_TIME"` //最大运行时长(HH:MM:ss)
|
||||
GAP_EXCLUSIVE string `json:"GAP_EXCLUSIVE,optional"` // 是否独占节点,1为独占,空为非独占
|
||||
GAP_APPNAME string `json:"GAP_APPNAME"` //BASE(基础应用),支持填写具体的应用英文名称
|
||||
GAP_MULTI_SUB string `json:"GAP_MULTI_SUB,optional"` //作业组长度,建议为小于等于50的正整数
|
||||
GAP_STD_OUT_FILE string `json:"GAP_STD_OUT_FILE"` //工作路径/std.out.%j
|
||||
GAP_STD_ERR_FILE string `json:"GAP_STD_ERR_FILE"` //工作路径/std.err.%j
|
||||
}
|
||||
|
||||
Argv {
|
||||
Argv string `json:"argv,optional"`
|
||||
}
|
||||
|
||||
Environment {
|
||||
Environment string `json:"environment,optional"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
getRegionResp {
|
||||
Code string `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data RegionNum `json:"data"`
|
||||
}
|
||||
RegionNum {
|
||||
RegionSum int64 `json:"regionSum"`
|
||||
SoftStackSum int64 `json:"softStackSum"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
listRegionResp {
|
||||
Code string `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data []Region `json:"data"`
|
||||
}
|
||||
Region {
|
||||
RegionName string `json:"RegionName"` // 域名
|
||||
SoftStack string `json:"SoftStack"` // 软件栈
|
||||
SlurmNum int64 `json:"SlurmNum"` // 超算域适配slurm数量
|
||||
AdaptorInterfaceSum int64 `json:"AdaptorInterfaceSum"` // 适配接口数量
|
||||
RunningJobs int64 `json:"runningJobs"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
scheduleTaskReq {
|
||||
|
||||
Name string `yaml:"name"`
|
||||
synergy string `yaml:"synergy"`
|
||||
Description string `yaml:"description"`
|
||||
strategy string `yaml:"strategy"`
|
||||
tasks []TaskInfo `yaml:"tasks"`
|
||||
}
|
||||
TaskInfo {
|
||||
TaskId int64 `yaml:"taskId"`
|
||||
serviceName string `yaml:"serviceName"`
|
||||
metadata interface{} `yaml:"metadata"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
taskListResp {
|
||||
TotalCount int `json:"totalCount"`
|
||||
CardTime float32 `json:"cardTime"`
|
||||
TotalRunTime float32 `json:"totalRunTime"`
|
||||
Tasks []Task `json:"tasks"`
|
||||
}
|
||||
Task {
|
||||
Name string `json:"name"`
|
||||
Status string `json:"status"`
|
||||
Strategy int `json:"strategy"`
|
||||
ServiceName string `json:"serviceName"`
|
||||
SynergyStatus string `json:"synergyStatus"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
listCenterResp {
|
||||
Code int32 `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data CenterData `json:"data"`
|
||||
}
|
||||
CenterData {
|
||||
TotalCount int `json:"totalCount"`
|
||||
Centers []Center `json:"centers"`
|
||||
}
|
||||
Center {
|
||||
Id int64 `json:"id"`
|
||||
CenterSource string `json:"centerSource"`
|
||||
SourceId string `json:"sourceId"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Type string `json:"type"`
|
||||
Area string `json:"area"`
|
||||
City string `json:"city"`
|
||||
Longitude float64 `json:"longitude"`
|
||||
Latitude float64 `json:"latitude"`
|
||||
Status string `json:"status"`
|
||||
UserNum int64 `json:"userNum"`
|
||||
DeletedFlag int64 `json:"deletedFlag"`
|
||||
CloudClusterNum int64 `json:"cloudClusterNum"`
|
||||
CloudNodeNum int64 `json:"cloudNodeNum"`
|
||||
CloudCpuNum int64 `json:"cloudCpuNum"`
|
||||
CloudGpuNum int64 `json:"cloudGpuNum"`
|
||||
CloudMngFlops int64 `json:"cloudMngFlops"`
|
||||
CloudUmngFlops int64 `json:"cloudUmngFlops"`
|
||||
CloudMngStorage int64 `json:"cloudMngStorage"`
|
||||
CloudUmngStorage int64 `json:"cloudUmngStorage"`
|
||||
AiClusterNum int64 `json:"aiClusterNum"`
|
||||
AiNodeNum int64 `json:"aiNodeNum"`
|
||||
AiCpuNum int64 `json:"aiCpuNum"`
|
||||
AiGpuNum int64 `json:"aiGpuNum"`
|
||||
AiMngFlops int64 `json:"aiMngFlops"`
|
||||
AiUmngFlops int64 `json:"aiUmngFlops"`
|
||||
AiMngStorage int64 `json:"aiMngStorage"`
|
||||
AiUmngStorage int64 `json:"aiUmngStorage"`
|
||||
HpcClusterNum int64 `json:"hpcClusterNum"`
|
||||
HpcNodeNum int64 `json:"hpcNodeNum"`
|
||||
HpcCpuNum int64 `json:"hpcCpuNum"`
|
||||
HpcGpuNum int64 `json:"hpcGpuNum"`
|
||||
HpcMngFlops int64 `json:"hpcMngFlops"`
|
||||
HpcUmngFlops int64 `json:"hpcUmngFlops"`
|
||||
HpcMngStorage int64 `json:"hpcMngStorage"`
|
||||
HpcUmngStorage int64 `json:"hpcUmngStorage"`
|
||||
Edwc bool `json:"edwc"`
|
||||
Ydyl bool `json:"ydyl"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
cpResp {
|
||||
POpsAtFp16 float32 `json:"pOpsAtFp16"`
|
||||
}
|
||||
|
||||
GiResp {
|
||||
CpuNum int32 `json:"cpuNum,optional"`
|
||||
MemoryInGib int32 `json:"memoryInGib,optional"`
|
||||
StorageInGib int32 `json:"storageInGib,optional"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
DomainResourceResp {
|
||||
TotalCount int `json:"totalCount"`
|
||||
DomainResourceList []DomainResource `json:"domainResourceList"`
|
||||
}
|
||||
DomainResource {
|
||||
Id int64 `json:"id"` // id
|
||||
DomainId string `json:"domain_id"` // 资源域id
|
||||
DomainName string `json:"domain_name"` // 资源域名称
|
||||
JobCount int64 `json:"job_count"` // 资源域任务数量
|
||||
DomainSource int64 `json:"domain_source"` // 资源域数据来源:0-nudt,1-鹏城
|
||||
Stack string `json:"stack"` // 技术栈
|
||||
ResourceType string `json:"resource_type"` // 资源类型
|
||||
Cpu string `json:"cpu"` // cpu
|
||||
Memory string `json:"memory"` // 内存
|
||||
Disk string `json:"disk"` // 存储
|
||||
NodeCount string `json:"nodeCount"` //节点数量
|
||||
// DeleteFlag int64 `json:"delete_flag"` // 是否删除 0:未删除,1:已经删除
|
||||
}
|
||||
)
|
|
@ -1,179 +0,0 @@
|
|||
syntax = "v1"
|
||||
|
||||
info(
|
||||
title: "type title here"
|
||||
desc: "type desc here"
|
||||
author: "type author here"
|
||||
email: "type email here"
|
||||
version: "type version here"
|
||||
)
|
||||
|
||||
type Job {
|
||||
SlurmVersion string `json:"slurmVersion"`
|
||||
Account string `json:"account"`
|
||||
AllocNode string `json:"allocNode"`
|
||||
AllocSid uint32 `json:"allocSid"`
|
||||
ArrayJobId uint32 `json:"arrayJobId"`
|
||||
ArrayTaskId uint32 `json:"arrayTaskId"`
|
||||
AssocId uint32 `json:"assocId"`
|
||||
BatchFlag uint32 `json:"batchFlag"`
|
||||
BatchHost string `json:"batchHost"`
|
||||
BatchScript string `json:"batchScript"`
|
||||
Command string `json:"command"`
|
||||
Comment string `json:"comment"`
|
||||
Contiguous uint32 `json:"contiguous"`
|
||||
CpusPerTask uint32 `json:"cpusPerTask"`
|
||||
Dependency string `json:"dependency"`
|
||||
DerivedEc uint32 `json:"derivedEc"`
|
||||
EligibleTime int64 `json:"eligibleTime"`
|
||||
EndTime int64 `json:"endTime"`
|
||||
ExcNodes string `json:"excNodes"` //NodeUsed in ac
|
||||
ExcNodeInx int32 `json:"excNodeInx"`
|
||||
ExitCode uint32 `json:"exitCode"`
|
||||
Features string `json:"features"`
|
||||
Gres string `json:"gres"`
|
||||
GroupId uint32 `json:"groupId"`
|
||||
JobId uint32 `json:"jobId"` //JobId in ac
|
||||
JobState uint32 `json:"jobState"` //JobStatus in ac
|
||||
Licenses string `json:"licenses"`
|
||||
MaxCpus uint32 `json:"maxCpus"`
|
||||
MaxNodes uint32 `json:"maxNodes"`
|
||||
BoardsPerNode uint32 `json:"boardsPerNode"`
|
||||
SocketsPerBoard uint32 `json:"socketsPerBoard"`
|
||||
SocketsPerNode uint32 `json:"socketsPerNode"`
|
||||
CoresPerSocket uint32 `json:"coresPerSocket"`
|
||||
ThreadsPerCore uint32 `json:"threadsPerCore"`
|
||||
Name string `json:"name"` //JobName in ac
|
||||
Network string `json:"network"`
|
||||
Nodes string `json:"nodes"`
|
||||
Nice uint32 `json:"nice"`
|
||||
NodeInx int32 `json:"nodeInx"`
|
||||
NtasksPerCore uint32 `json:"ntasksPerCore"`
|
||||
NtasksPerNode uint32 `json:"ntasksPerNode"`
|
||||
NtasksPerSocket uint32 `json:"ntasksPerSocket"`
|
||||
NtasksPerBoard uint32 `json:"ntasksPerBoard"`
|
||||
NumNodes uint32 `json:"numNodes"`
|
||||
NumCpus uint32 `json:"numCpus"` //ProcNumUsed in ac
|
||||
Partition string `json:"partition"` //Queue in ac
|
||||
PnMinMemory uint32 `json:"pnMinMemory"`
|
||||
PnMinCpus uint32 `json:"pnMinCpus"`
|
||||
PnMinTmpDisk uint32 `json:"pnMinTmpDisk"`
|
||||
PreSusTime int64 `json:"preSusTime"`
|
||||
Priority uint32 `json:"priority"`
|
||||
Profile uint32 `json:"profile"`
|
||||
Qos string `json:"qos"`
|
||||
ReqNodes string `json:"reqNodes"`
|
||||
ReqNodeInx int32 `json:"reqNodeInx"`
|
||||
ReqSwitch uint32 `json:"reqSwitch"`
|
||||
Requeue uint32 `json:"requeue"`
|
||||
ResizeTime int64 `json:"resizeTime"`
|
||||
RestartCnt uint32 `json:"restartCnt"`
|
||||
ResvName string `json:"resvName"`
|
||||
Shared uint32 `json:"shared"`
|
||||
ShowFlags uint32 `json:"showFlags"`
|
||||
StartTime int64 `json:"startTime"` //JobStartTime in ac
|
||||
StateDesc string `json:"stateDesc"`
|
||||
StateReason uint32 `json:"stateReason"`
|
||||
SubmitTime int64 `json:"submitTime"`
|
||||
SuspendTime int64 `json:"suspendTime"`
|
||||
TimeLimit uint32 `json:"timeLimit"`
|
||||
TimeMin uint32 `json:"timeMin"`
|
||||
UserId uint32 `json:"userId"` //User in ac
|
||||
PreemptTime int64 `json:"preemptTime"`
|
||||
Wait4Switch uint32 `json:"wait4Switch"`
|
||||
Wckey string `json:"wckey"`
|
||||
WorkDir string `json:"workDir"` //WorkDir in ac
|
||||
|
||||
/****ac****/
|
||||
JobRunTime string `json:"jobRunTime"`
|
||||
JobmanagerId string `json:"jobmanagerId"`
|
||||
JobmanagerName string `json:"jobmanagerName"`
|
||||
JobmanagerType string `json:"jobmanagerType"`
|
||||
ErrorPath string `json:"errorPath"`
|
||||
OutputPath string `json:"outputPath"`
|
||||
Reason string `json:"reason"`
|
||||
AppType string `json:"appType"`
|
||||
/****ac****/
|
||||
}
|
||||
|
||||
type (
|
||||
listJobReq {
|
||||
}
|
||||
listJobResp {
|
||||
Code int32 `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
RecordCount int32 `json:"recordCount"`
|
||||
Jobs []Job `json:"jobs"`
|
||||
}
|
||||
)
|
||||
|
||||
type HistoryJob {
|
||||
SlurmVersion string `json:"slurmVersion"`
|
||||
AllocCPU uint32 `json:"allocCPU"`
|
||||
AllocNodes uint32 `json:"allocNodes"` //Nodect 分配的节点数 in ac
|
||||
Account string `json:"account"`
|
||||
AssocId uint32 `json:"assocId"`
|
||||
BlockId string `json:"blockId"`
|
||||
Cluster string `json:"cluster"`
|
||||
DerivedEc uint32 `json:"derivedEc"`
|
||||
DerivedEs string `json:"derivedEs"`
|
||||
Elapsed uint32 `json:"elapsed"`
|
||||
Eligible int64 `json:"eligible"`
|
||||
End int64 `json:"end"` //JobEndTime 作业结束时间 in ac
|
||||
ExitCode uint32 `json:"exitCode"` //JobExitStatus 作业退出码 in ac
|
||||
Gid uint32 `json:"gid"`
|
||||
JobId uint32 `json:"jobId"` //JobId in ac
|
||||
JobName string `json:"jobName"` //JobName in ac
|
||||
Lft uint32 `json:"lft"`
|
||||
Partition string `json:"partition"` //Queue 队列名 in ac
|
||||
Nodes string `json:"nodes"` //JobExecHost 作业执行节点 in ac
|
||||
Priority uint32 `json:"priority"`
|
||||
Qosid uint32 `json:"qosid"`
|
||||
ReqCpus uint32 `json:"reqCpus"`
|
||||
ReqMem uint32 `json:"reqMem"`
|
||||
Requid uint32 `json:"requid"`
|
||||
Resvid uint32 `json:"resvid"`
|
||||
ShowFull uint32 `json:"showFull"`
|
||||
Start int64 `json:"start"` //JobStartTime 作业启动时间 in ac
|
||||
State uint32 `json:"state"` //JobState 作业状态 in ac
|
||||
Submit int64 `json:"submit"`
|
||||
Suspended uint32 `json:"suspended"`
|
||||
SysCpuSec uint32 `json:"sysCpuSec"`
|
||||
SysCpuUsec uint32 `json:"sysCpuUsec"`
|
||||
Timelimit uint32 `json:"timelimit"`
|
||||
TotCpuSec uint32 `json:"totCpuSec"`
|
||||
TotCpuUsec uint32 `json:"totCpuUsec"`
|
||||
TrackSteps uint32 `json:"trackSteps"`
|
||||
Uid uint32 `json:"uid"`
|
||||
User string `json:"user"` //UserName 用户名 in ac
|
||||
UserCpuSec uint32 `json:"userCpuSec"`
|
||||
UserCpuUsec uint32 `json:"userCpuUsec"`
|
||||
Wckey string `json:"wckey"`
|
||||
Wckeyid uint32 `json:"wckeyid"`
|
||||
WorkDir string `json:"workDir"` //Workdir 工作空间 in ac
|
||||
/****************parmas from ac********************/
|
||||
AcctTime string `json:"acctTime"` // 记账时间
|
||||
AppType string `json:"appType"` // 作业应用类型
|
||||
JobQueueTime string `json:"jobQueueTime"` //作业入队列时间
|
||||
JobWalltimeUsed string `json:"jobWalltimeUsed"` //作业实际使用的Walltime,单位为秒
|
||||
JobManagerId int `json:"jobmanagerId"` //区域id
|
||||
/****************parmas from ac********************/
|
||||
}
|
||||
|
||||
type (
|
||||
listHistoryJobReq {
|
||||
SlurmVersion string `json:"slurmVersion,optional"`
|
||||
StartTime string `json:"startTime,optional"`
|
||||
EndTime string `json:"endTime,optional"`
|
||||
TimeType string `json:"timeType,optional"`
|
||||
Start int32 `json:"start,optional"`
|
||||
Limit int32 `json:"limit,optional"`
|
||||
IsQueryByQueueTime int32 `json:"isQueryByQueueTime,optional"`
|
||||
}
|
||||
listHistoryJobResp {
|
||||
Code int32 `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
RecordCount int32 `json:"recordCount"`
|
||||
HistoryJobs []HistoryJob `json:"historyJobs"`
|
||||
}
|
||||
)
|
|
@ -1,170 +0,0 @@
|
|||
syntax = "v1"
|
||||
|
||||
import (
|
||||
"core/pcm-core.api"
|
||||
"hpc/pcm-hpc.api"
|
||||
"ai/pcm-ai.api"
|
||||
"storage/pcm-storage.api"
|
||||
)
|
||||
|
||||
info(
|
||||
title: "type title here"
|
||||
desc: "type desc here"
|
||||
author: "type author here"
|
||||
email: "type email here"
|
||||
version: "type version here"
|
||||
)
|
||||
|
||||
//core端接口
|
||||
@server(
|
||||
prefix: pcm/v1
|
||||
group : core
|
||||
)
|
||||
service pcm {
|
||||
@handler scheduleTaskHandler
|
||||
post /core/scheduleTask (scheduleTaskReq) returns ()
|
||||
|
||||
@handler TaskListHandler
|
||||
get /core/taskList () returns (taskListResp)
|
||||
|
||||
@handler listCenterHandler
|
||||
get /core/listCenter () returns (listCenterResp)
|
||||
|
||||
@handler submitJobHandler
|
||||
post /core/submitJob (submitJobReq) returns (submitJobResp)
|
||||
|
||||
@handler getRegionHandler
|
||||
get /core/getRegion () returns (getRegionResp)
|
||||
|
||||
@handler listRegionHandler
|
||||
get /core/listRegion () returns (listRegionResp)
|
||||
|
||||
@handler getComputingPowerHandler
|
||||
get /core/getComputingPower returns (cpResp)
|
||||
|
||||
@handler getGeneralInfoHandler
|
||||
get /core/getGeneralInfo () returns (GiResp)
|
||||
|
||||
@handler listDomainResourceHandler
|
||||
get /core/listDomainResource returns (DomainResourceResp)
|
||||
}
|
||||
|
||||
//hpc二级接口
|
||||
@server(
|
||||
prefix: pcm/v1
|
||||
group : hpc
|
||||
)
|
||||
service pcm {
|
||||
@handler listJobHandler
|
||||
get /hpc/listJob (listJobReq) returns (listJobResp)
|
||||
|
||||
@handler listHistoryJobHandler
|
||||
get /hpc/listHistoryJob (listHistoryJobReq) returns (listHistoryJobResp)
|
||||
}
|
||||
|
||||
//hpc二级接口
|
||||
@server(
|
||||
prefix: pcm/v1
|
||||
group : ai
|
||||
)
|
||||
service pcm {
|
||||
@handler listDataSetHandler
|
||||
get /ai/listDataSet/:projectId (DataSetReq) returns (DataSetResp)
|
||||
|
||||
@handler CreateDataSetHandler
|
||||
post /ai/createDataSet/:projectId (CreateDataSetReq) returns (CreateDataSetResp)
|
||||
|
||||
@handler DeleteDataSetHandler
|
||||
delete /ai/deleteDataSet (DeleteDataSetReq) returns (DeleteDataSetResp)
|
||||
// creat task 创建导入任务
|
||||
@handler CreateTaskHandler
|
||||
post /ai/CreateTask/:projectId/:datasetId (ImportTaskDataReq) returns (ImportTaskDataResp)
|
||||
// get taskList 查询数据集导入任务列表
|
||||
@handler ListImportHandler
|
||||
get /ai/ListImport/:projectId/:datasetId (ListImportTasksReq) returns (ListImportTasksResp)
|
||||
// ListTrainingJobs 查询训练作业列表
|
||||
@handler GetListTrainingJobsHandler
|
||||
get /ai/GetListTrainingJobs/:projectId (ListTrainingJobsreq) returns (ListTrainingJobsresp)
|
||||
// DeleteTrainingJob 删除训练作业
|
||||
@handler DeleteTrainingJobHandler
|
||||
delete /ai/DeleteTrainingJob/:projectId/:trainingJobId (DeleteTrainingJobReq) returns (DeleteTrainingJobResp)
|
||||
// CreateAlgorithm 创建算法
|
||||
@handler CreateAlgorithmHandler
|
||||
post /ai/CreateAlgorithm/:projectId (CreateAlgorithmReq) returns (CreateAlgorithmResp)
|
||||
// ListAlgorithms 查询创建算法列表
|
||||
@handler ListAlgorithms
|
||||
get /ai/ListAlgorithms/:projectId (ListAlgorithmsReq) returns (ListAlgorithmsResp)
|
||||
// DeleteAlgorithm 删除算法
|
||||
@handler DeleteAlgorithm
|
||||
delete /ai/DeleteAlgorithm/:projectId/:algorithmId (DeleteAlgorithmReq) returns (DeleteAlgorithmResp)
|
||||
// CreateTrainingJob 创建训练作业
|
||||
@handler CreateTrainingJobHandler
|
||||
post /ai/CreateTrainingJob/:projectId (CreateTrainingJobReq) returns (CreateTrainingJobResp)
|
||||
// ShowAlgorithmByUuid 展示算法详情
|
||||
@handler ShowAlgorithmByUuid
|
||||
get /ai/ShowAlgorithmByUuid/:projectId/:algorithmId (ShowAlgorithmByUuidReq) returns (ShowAlgorithmByUuidResp)
|
||||
|
||||
// creat export task 创建导出任务
|
||||
@handler CreateExportTaskHandler
|
||||
post /ai/CreateExportTask/:projectId/:datasetId (CreateExportTaskReq) returns (ExportTaskDataResp)
|
||||
@handler GetExportTasksOfDatasetHandler
|
||||
get /ai/GetExportTasksOfDataset/:projectId/:datasetId (GetExportTasksOfDatasetReq) returns (GetExportTasksOfDatasetResp)
|
||||
@handler GetExportTaskStatusOfDatasetHandler
|
||||
get /ai/GetExportTaskStatusOfDataset/:projectId/:resourceId/:taskId (GetExportTaskStatusOfDatasetReq) returns (GetExportTaskStatusOfDatasetResp)
|
||||
|
||||
// create processor task 创建处理任务
|
||||
@handler CreateProcessorTaskHandler
|
||||
post /ai/CreateProcessorTask (CreateProcessorTaskReq) returns (CreateProcessorTaskResp)
|
||||
|
||||
// create service 创建服务
|
||||
@handler CreateServiceHandler
|
||||
post /ai/CreateService/:projectId (CreateServiceReq) returns (CreateServiceResp)
|
||||
// list services 展示服务
|
||||
@handler ListServicesHandler
|
||||
get /ai/ListServices/:projectId (ListServicesReq) returns (ListServicesResp)
|
||||
// Show service 展示服务详情
|
||||
@handler ShowServiceHandler
|
||||
get /ai/ShowService/:projectId/:serviceId (ShowServiceReq) returns (ShowServiceResp)
|
||||
// Delete service 删除服务
|
||||
@handler DeleteServiceHandler
|
||||
delete /ai/DeleteService (DeleteServiceReq) returns (DeleteServiceResp)
|
||||
// ListClusters查询专属资源池列表
|
||||
@handler ListClustersHandler
|
||||
get /ai/ListClusters (ListClustersReq) returns (ListClustersResp)
|
||||
|
||||
/******************Notebook Method start*************************/
|
||||
@handler listNotebookHandler
|
||||
get /ai/listNotebook (ListNotebookReq) returns (ListNotebookResp)
|
||||
@handler createNotebookHandler
|
||||
post /ai/createNotebook (CreateNotebookReq) returns (CreateNotebookResp)
|
||||
@handler startNotebookHandler
|
||||
post /ai/startNotebook (StartNotebookReq) returns (StartNotebookResp)
|
||||
@handler stopNotebookHandler
|
||||
post /ai/stopNotebook (StopNotebookReq) returns (StopNotebookResp)
|
||||
@handler getNotebookStorageHandler
|
||||
get /ai/getNotebookStorage (GetNotebookStorageReq) returns (GetNotebookStorageResp)
|
||||
@handler mountNotebookStorageHandler
|
||||
post /ai/mountNotebookStorage (MountNotebookStorageReq) returns (MountNotebookStorageResp)
|
||||
/******************Notebook Method end*************************/
|
||||
|
||||
/******************Visualization Job Method start*************************/
|
||||
@handler getVisualizationJobHandler
|
||||
get /ai/getVisualizationJob (GetVisualizationJobReq) returns (GetVisualizationJobResp)
|
||||
@handler createVisualizationJobHandler
|
||||
post /ai/CreateVisualizationJob (CreateVisualizationJobReq) returns (CreateVisualizationJobResp)
|
||||
/******************Visualization Job Method start*************************/
|
||||
}
|
||||
|
||||
//screen接口
|
||||
@server(
|
||||
prefix: pcm/v1
|
||||
group : storage
|
||||
)
|
||||
service pcm {
|
||||
@handler screenStorageHandler
|
||||
get /storage/screenStorage (StorageScreenReq) returns (StorageScreenResp)
|
||||
@handler dailyPowerScreenHandler
|
||||
get /storage/dailyPowerScreen (DailyPowerScreenReq) returns (DailyPowerScreenResp)
|
||||
@handler perCenterComputerPowersHandler
|
||||
get /storage/perCenterComputerPowers (PerCenterComputerPowersReq) returns (PerCenterComputerPowersResp)
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
syntax = "v1"
|
||||
|
||||
info(
|
||||
title: "AI core"
|
||||
desc: "AI core微服务"
|
||||
author: "wanqgi"
|
||||
email: "1364512070@qq.com"
|
||||
)
|
||||
|
||||
/****************** screen storage start*************************/
|
||||
type(
|
||||
StorageScreenReq {
|
||||
|
||||
}
|
||||
StorageScreenResp {
|
||||
TotalSize int32 `json:"totalSize" copier:"TotalSize"`
|
||||
AiCenterInfos []AiCenterInfos `json:"aiCenterInfos" copier:"AiCenterInfos"`
|
||||
StorageUsed float32 `json:"storageUsed" copier:"StorageUsed"`
|
||||
StorageUsing float32 `json:"storageUsing" copier:"StorageUsing"`
|
||||
UsageRate float32 `json:"usageRate" copier:"UsageRate"`
|
||||
UsingRate float32 `json:"usingRate" copier:"UsingRate"`
|
||||
Code int32 `json:"code,omitempty"`
|
||||
Msg string `json:"msg,omitempty"`
|
||||
ErrorMsg string `json:"ErrorMsg,omitempty"`
|
||||
}
|
||||
AiCenterInfos {
|
||||
Id string `json:"id" copier:"Id"`
|
||||
Name string `json:"name" copier:"Name"`
|
||||
Desc string `json:"desc" copier:"Desc"`
|
||||
Resource string `json:"resource" copier:"Resource"`
|
||||
TrainJob string `json:"trainJob" copier:"TrainJob"`
|
||||
ComputeScale int32 `json:"computeScale" copier:"ComputeScale"`
|
||||
StorageScale int32 `json:"storageScale" copier:"StorageScale"`
|
||||
Province string `json:"path:"province" copier:"Province"`
|
||||
City string `json:"city" copier:"City"`
|
||||
CoordinateX int32 `json:"coordinateX" copier:"CoordinateX"`
|
||||
CoordinateY int32 `json:"coordinateY" copier:"CoordinateY"`
|
||||
Type int32 `json:"type" copier:"Type"`
|
||||
Weight int32 `json:"weight" copier:"Weight"`
|
||||
ConnectionState int32 `json:"connectionState" copier:"ConnectionState"`
|
||||
BusyState int32 `json:"busyState" copier:"BusyState"`
|
||||
ImageUrl string `json:"imageUrl" copier:"ImageUrl"`
|
||||
AccDevices string `json:"accDevices" copier:"AccDevices"`
|
||||
MarketTime int64 `json:"marketTime" copier:"MarketTime"`
|
||||
CreatedAt int64 `json:"createdAt" copier:"CreatedAt"`
|
||||
AccessTime int32 `json:"accessTime" copier:"AccessTime"`
|
||||
CardRunTime int32 `json:"cardRunTime" copier:"CardRunTime"`
|
||||
JobCount int32 `json:"jobCount" copier:"JobCount"`
|
||||
}
|
||||
)
|
||||
/******************screen storage end*************************/
|
||||
|
||||
/******************screen computing power Start*************************/
|
||||
type(
|
||||
DailyPowerScreenReq{
|
||||
|
||||
}
|
||||
|
||||
DailyPowerScreenResp{
|
||||
TotalSize int32 `json:"totalSize" copier:"TotalSize"`
|
||||
DailyComputerPowers []DailyComputerPowers `json:"dailyComputerPowers" copier:"DailyComputerPowers"`
|
||||
Code int32 `json:"code,omitempty"`
|
||||
Msg string `json:"msg,omitempty"`
|
||||
ErrorMsg string `json:"ErrorMsg,omitempty"`
|
||||
}
|
||||
|
||||
DailyComputerPowers{
|
||||
Date string `json:"date" copier:"Date"`
|
||||
ComputerPower float32 `json:"computerPower" copier:"ComputerPower"`
|
||||
}
|
||||
)
|
||||
type(
|
||||
PerCenterComputerPowersReq{
|
||||
|
||||
}
|
||||
PerCenterComputerPowersResp{
|
||||
TotalSize int32 `json:"totalSize" copier:"TotalSize"`
|
||||
PerCenterComputerPowers []PerCenterComputerPowers `json:"perCenterComputerPowers" copier:"PerCenterComputerPowers"`
|
||||
AccOtJobInfo AccOtJobInfo `json:"accOtJobInfo" copier:"AccOtJobInfo"`
|
||||
Code int32 `json:"code,omitempty"`
|
||||
Msg string `json:"msg,omitempty"`
|
||||
ErrorMsg string `json:"ErrorMsg,omitempty"`
|
||||
}
|
||||
|
||||
PerCenterComputerPowers{
|
||||
CenterName string `json:"centerName" copier:"CenterName"`
|
||||
ComputerPower float32`json:"computerPower" copier:"ComputerPower"`
|
||||
JobCount int32 `json:"jobCount" copier:"JobCount"`
|
||||
CenterId string `json:"centerId" copier:"CenterId"`
|
||||
}
|
||||
AccOtJobInfo{
|
||||
AccRunSec int32 `json:"accRunSec" copier:"AccRunSec"`
|
||||
AccCardRunSec float32`json:"accCardRunSec" copier:"AccCardRunSec"`
|
||||
AccOtJobNum int32 `json:"accOtJobNum" copier:"AccOtJobNum"`
|
||||
}
|
||||
|
||||
|
||||
)
|
||||
|
||||
/******************screen computing power End*************************/
|
|
@ -1,15 +0,0 @@
|
|||
NacosConfig:
|
||||
DataId: pcm-core-api.yaml
|
||||
Group: DEFAULT_GROUP
|
||||
ServerConfigs:
|
||||
# - IpAddr: 127.0.0.1
|
||||
# Port: 8848
|
||||
- IpAddr: 10.101.15.7
|
||||
Port: 8848
|
||||
ClientConfig:
|
||||
NamespaceId: test
|
||||
TimeoutMs: 5000
|
||||
NotLoadCacheAtStart: true
|
||||
LogDir:
|
||||
CacheDir:
|
||||
LogLevel: debug
|
|
@ -1,35 +0,0 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-queue/kq"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/zeromicro/go-zero/core/stores/cache"
|
||||
"github.com/zeromicro/go-zero/core/stores/redis"
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
rest.RestConf
|
||||
KqProducerConf struct {
|
||||
Brokers []string
|
||||
HpcTopic string
|
||||
CloudTopic string
|
||||
AiTopic string
|
||||
}
|
||||
DB struct {
|
||||
DataSource string
|
||||
}
|
||||
Redis redis.RedisConf
|
||||
Cache cache.CacheConf
|
||||
LogConf logx.LogConf
|
||||
HpcConsumerConf kq.KqConf
|
||||
CloudConsumerConf kq.KqConf
|
||||
AiConsumerConf kq.KqConf
|
||||
K8sNativeConf zrpc.RpcClientConf
|
||||
ACRpcConf zrpc.RpcClientConf
|
||||
THRpcConf zrpc.RpcClientConf
|
||||
ModelArtsRpcConf zrpc.RpcClientConf
|
||||
CephRpcConf zrpc.RpcClientConf
|
||||
OctopusRpcConf zrpc.RpcClientConf
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"PCM/common/result"
|
||||
|
||||
"PCM/adaptor/PCM-CORE/api/internal/logic/core"
|
||||
"PCM/adaptor/PCM-CORE/api/internal/svc"
|
||||
)
|
||||
|
||||
func ListDomainResourceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
l := core.NewListDomainResourceLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ListDomainResource()
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"PCM/common/result"
|
||||
"PCM/common/tool"
|
||||
"net/http"
|
||||
|
||||
"PCM/adaptor/PCM-CORE/api/internal/logic/core"
|
||||
"PCM/adaptor/PCM-CORE/api/internal/svc"
|
||||
"PCM/adaptor/PCM-CORE/api/internal/types"
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
)
|
||||
|
||||
func ScheduleTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ScheduleTaskReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
// 解析yaml文件
|
||||
_, fileHeader, err := r.FormFile("file")
|
||||
if err != nil {
|
||||
result.HttpResult(r, w, nil, err)
|
||||
return
|
||||
}
|
||||
err = tool.Yaml2struct(fileHeader, &req)
|
||||
if err != nil {
|
||||
result.HttpResult(r, w, nil, err)
|
||||
return
|
||||
}
|
||||
l := core.NewScheduleTaskLogic(r.Context(), svcCtx)
|
||||
err = l.ScheduleTask(&req)
|
||||
result.HttpResult(r, w, nil, err)
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"PCM/common/result"
|
||||
"net/http"
|
||||
|
||||
"PCM/adaptor/PCM-CORE/api/internal/logic/core"
|
||||
"PCM/adaptor/PCM-CORE/api/internal/svc"
|
||||
"PCM/adaptor/PCM-CORE/api/internal/types"
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
)
|
||||
|
||||
func SubmitJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ScheduleTaskReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
l := core.NewScheduleTaskLogic(r.Context(), svcCtx)
|
||||
err := l.ScheduleTask(&req)
|
||||
result.HttpResult(r, w, nil, err)
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"PCM/common/result"
|
||||
"net/http"
|
||||
|
||||
"PCM/adaptor/PCM-CORE/api/internal/logic/core"
|
||||
"PCM/adaptor/PCM-CORE/api/internal/svc"
|
||||
)
|
||||
|
||||
func TaskListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
l := core.NewTaskListLogic(r.Context(), svcCtx)
|
||||
resp, err := l.TaskList()
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
package hpc
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"PCM/adaptor/PCM-CORE/api/internal/logic/hpc"
|
||||
"PCM/adaptor/PCM-CORE/api/internal/svc"
|
||||
"PCM/adaptor/PCM-CORE/api/internal/types"
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
)
|
||||
|
||||
func ListJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ListJobReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := hpc.NewListJobLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ListJob(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,255 +0,0 @@
|
|||
// Code generated by goctl. DO NOT EDIT.
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
ai "PCM/adaptor/PCM-CORE/api/internal/handler/ai"
|
||||
core "PCM/adaptor/PCM-CORE/api/internal/handler/core"
|
||||
hpc "PCM/adaptor/PCM-CORE/api/internal/handler/hpc"
|
||||
storage "PCM/adaptor/PCM-CORE/api/internal/handler/storage"
|
||||
"PCM/adaptor/PCM-CORE/api/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
||||
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/core/scheduleTask",
|
||||
Handler: core.ScheduleTaskHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/core/taskList",
|
||||
Handler: core.TaskListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/core/listCenter",
|
||||
Handler: core.ListCenterHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/core/submitJob",
|
||||
Handler: core.SubmitJobHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/core/getRegion",
|
||||
Handler: core.GetRegionHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/core/listRegion",
|
||||
Handler: core.ListRegionHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/core/getComputingPower",
|
||||
Handler: core.GetComputingPowerHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/core/getGeneralInfo",
|
||||
Handler: core.GetGeneralInfoHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/core/listDomainResource",
|
||||
Handler: core.ListDomainResourceHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/pcm/v1"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/hpc/listJob",
|
||||
Handler: hpc.ListJobHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/hpc/listHistoryJob",
|
||||
Handler: hpc.ListHistoryJobHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/pcm/v1"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/ai/listDataSet/:projectId",
|
||||
Handler: ai.ListDataSetHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/ai/createDataSet/:projectId",
|
||||
Handler: ai.CreateDataSetHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/ai/deleteDataSet",
|
||||
Handler: ai.DeleteDataSetHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/ai/CreateTask/:projectId/:datasetId",
|
||||
Handler: ai.CreateTaskHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/ai/ListImport/:projectId/:datasetId",
|
||||
Handler: ai.ListImportHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/ai/GetListTrainingJobs/:projectId",
|
||||
Handler: ai.GetListTrainingJobsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/ai/DeleteTrainingJob/:projectId/:trainingJobId",
|
||||
Handler: ai.DeleteTrainingJobHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/ai/CreateAlgorithm/:projectId",
|
||||
Handler: ai.CreateAlgorithmHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/ai/ListAlgorithms/:projectId",
|
||||
Handler: ai.ListAlgorithmsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/ai/DeleteAlgorithm/:projectId/:algorithmId",
|
||||
Handler: ai.DeleteAlgorithmHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/ai/CreateTrainingJob/:projectId",
|
||||
Handler: ai.CreateTrainingJobHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/ai/ShowAlgorithmByUuid/:projectId/:algorithmId",
|
||||
Handler: ai.ShowAlgorithmByUuidHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/ai/CreateExportTask/:projectId/:datasetId",
|
||||
Handler: ai.CreateExportTaskHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/ai/GetExportTasksOfDataset/:projectId/:datasetId",
|
||||
Handler: ai.GetExportTasksOfDatasetHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/ai/GetExportTaskStatusOfDataset/:projectId/:resourceId/:taskId",
|
||||
Handler: ai.GetExportTaskStatusOfDatasetHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/ai/CreateProcessorTask",
|
||||
Handler: ai.CreateProcessorTaskHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/ai/CreateService/:projectId",
|
||||
Handler: ai.CreateServiceHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/ai/ListServices/:projectId",
|
||||
Handler: ai.ListServicesHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/ai/ShowService/:projectId/:serviceId",
|
||||
Handler: ai.ShowServiceHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/ai/DeleteService",
|
||||
Handler: ai.DeleteServiceHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/ai/ListClusters",
|
||||
Handler: ai.ListClustersHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/ai/listNotebook",
|
||||
Handler: ai.ListNotebookHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/ai/createNotebook",
|
||||
Handler: ai.CreateNotebookHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/ai/startNotebook",
|
||||
Handler: ai.StartNotebookHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/ai/stopNotebook",
|
||||
Handler: ai.StopNotebookHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/ai/getNotebookStorage",
|
||||
Handler: ai.GetNotebookStorageHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/ai/mountNotebookStorage",
|
||||
Handler: ai.MountNotebookStorageHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/ai/getVisualizationJob",
|
||||
Handler: ai.GetVisualizationJobHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/ai/CreateVisualizationJob",
|
||||
Handler: ai.CreateVisualizationJobHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/pcm/v1"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/storage/screenStorage",
|
||||
Handler: storage.ScreenStorageHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/storage/dailyPowerScreen",
|
||||
Handler: storage.DailyPowerScreenHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/storage/perCenterComputerPowers",
|
||||
Handler: storage.PerCenterComputerPowersHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/pcm/v1"),
|
||||
)
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue