Compare commits

...

440 Commits

Author SHA1 Message Date
tzwang 7d21cf74eb Merge pull request 'Refactor scheduler structure' (#2) from scheduler_restruct into master 2024-01-12 17:06:44 +08:00
zhouqunjie 5ea020ffff approved 2024-01-12 16:59:07 +08:00
jagger 22456e59e1 fix: Interface apps/list returns duplicate data
Closes #4

Signed-off-by: jagger <cossjie@foxmail.com>
2024-01-12 15:30:08 +08:00
zhouqunjie 94e2e5afec fix 2024-01-11 16:05:48 +08:00
zhouqunjie 603574b381 update url of readme_zh 2024-01-11 16:00:08 +08:00
zhouqunjie 2e84df498a readme update 2024-01-11 15:57:44 +08:00
zhouqunjie 2203e780fe readme update 2024-01-11 15:53:26 +08:00
tzwang 2221bb8578 调度结构refactor2 2024-01-10 16:40:49 +08:00
tzwang eb41726104 调度结构refactor1 2024-01-10 11:30:21 +08:00
qiwang 65fdb3d873 fix:增加VmInfoList 2024-01-05 11:46:34 +08:00
qiwang 3288ae6838 fix:增加VmInfoList 2024-01-05 11:19:08 +08:00
qiwang cc686d681f fix:增加VmInfoList 2024-01-04 16:15:52 +08:00
devad 4eee4c12a9 fix bugs
Signed-off-by: devad <cossjie@foxmail.com>
2024-01-03 16:40:25 +08:00
devad d409682046 暂停、启动应用接口实现
Signed-off-by: devad <cossjie@foxmail.com>
2024-01-03 16:01:34 +08:00
devad a1cfa43774 fix bugs
Signed-off-by: devad <cossjie@foxmail.com>
2024-01-03 15:04:26 +08:00
devad 7300f017fa cloud app重启接口实现
Signed-off-by: devad <cossjie@foxmail.com>
2024-01-03 13:05:19 +08:00
devad 3ad235d75e cloud app重启接口实现
Signed-off-by: devad <cossjie@foxmail.com>
2024-01-03 13:01:03 +08:00
devad ab602b43a6 cloud app重启接口实现
Signed-off-by: devad <cossjie@foxmail.com>
2024-01-03 12:51:18 +08:00
devad a899d04925 cloud app删除接口实现
Signed-off-by: devad <cossjie@foxmail.com>
2024-01-03 11:43:36 +08:00
devad f40f21e142 增加删除app接口
Signed-off-by: devad <cossjie@foxmail.com>
2024-01-02 20:03:25 +08:00
zhangwei 3f71c6c2bd 监控添加校验 2024-01-02 17:06:00 +08:00
zhangwei 6546b9888a 监控修改 2023-12-29 17:10:31 +08:00
zhangwei 03494c2361 队列添加done操作 2023-12-27 19:09:45 +08:00
zhangwei f15cf213cd 移除redis 2023-12-27 15:57:13 +08:00
zhangwei ff6e6d46cb Merge remote-tracking branch 'origin/develop-Dec' 2023-12-27 15:50:26 +08:00
zhangwei 57e703c2da 移除 2023-12-27 15:00:53 +08:00
zhangwei ccdecc6eae 监控修改 2023-12-18 18:29:29 +08:00
devad 33a134e92f cloud表namespace取nsID的值
Signed-off-by: devad <cossjie@foxmail.com>
2023-12-18 11:49:21 +08:00
devad 3b2f0899e9 增加应用列表状态判断
Signed-off-by: devad <cossjie@foxmail.com>
2023-12-14 18:42:17 +08:00
devad ac99327ac4 数据库连接判断
Signed-off-by: devad <cossjie@foxmail.com>
2023-12-13 15:37:26 +08:00
devad a083d89102 update Dockerfile
Signed-off-by: devad <cossjie@foxmail.com>
2023-12-12 17:28:11 +08:00
zhangweiii 20b6f0b3eb refactor: .devops/rpc.yml 2023-12-12 15:06:31 +08:00
zhangwei 20896519c2 移除nacos 2023-12-11 18:30:38 +08:00
zhangweiii 2267561841 refactor: .devops/api.yml 2023-12-11 16:11:05 +08:00
zhangwei f77e73db57 p端id返回改成string 2023-12-08 19:17:29 +08:00
tzwang 9c92b5c259 存算联动shuguangHpc调整 2023-12-08 17:25:30 +08:00
zhangwei 8c0a644114 提交任务修复 2023-12-08 15:36:13 +08:00
devad ce056b8d2f 生成代码提交
Signed-off-by: devad <cossjie@foxmail.com>
2023-12-08 15:20:43 +08:00
tzwang f59160f417 存算联动调整5 2023-12-08 11:20:58 +08:00
tzwang 2a1ae75d61 存算联动调整4 2023-12-08 10:56:21 +08:00
tzwang 5fb7b0313b 存算联动调整3 2023-12-07 20:10:04 +08:00
tzwang c4945eaa44 Merge remote-tracking branch 'origin/master' 2023-12-07 18:05:46 +08:00
tzwang 8bdfaa2320 存算联动调整2 2023-12-07 18:05:34 +08:00
devad cad9cccd41 提交任务list时存储yamlString
Signed-off-by: devad <cossjie@foxmail.com>
2023-12-07 15:48:26 +08:00
tzwang eb90e99d47 存算联动调整 2023-12-07 11:36:11 +08:00
zhangwei afa3fa42e1 新增提交任务接口增加非必填 2023-12-06 21:27:41 +08:00
zhangwei 2e52eb0850 新增提交任务接口 2023-12-06 21:03:01 +08:00
zhangwei 6519222177 初始化promeclient 2023-12-06 16:48:20 +08:00
devad 91a3a9d7f8 fix bug
Signed-off-by: devad <cossjie@foxmail.com>
2023-12-06 15:53:10 +08:00
devad 04346b58bc fix bug
Signed-off-by: devad <cossjie@foxmail.com>
2023-12-06 15:22:55 +08:00
zhangwei 96060f7cec 添加执行任务列表接口 2023-12-06 15:15:46 +08:00
zhangwei ae0e533058 添加执行任务列表接口 2023-12-06 14:33:04 +08:00
zhangwei 55e7295cfc 添加执行任务列表接口 2023-12-06 14:32:58 +08:00
zhangwei 2bdcb634ec 添加执行任务列表接口 2023-12-06 14:31:08 +08:00
zhangwei dadb7daf83 添加执行任务列表接口 2023-12-06 14:16:22 +08:00
zhangwei 730d24000a 添加执行任务列表接口 2023-12-06 14:09:20 +08:00
devad 2953905910 修复查询应用列表的bug
Signed-off-by: devad <cossjie@foxmail.com>
2023-12-06 10:59:19 +08:00
zhangwei 1d0546bb3a 方法名称纠正 2023-12-05 09:20:58 +08:00
zhangwei 35eddac8b6 修改配置信息 2023-12-01 16:09:47 +08:00
zhangwei 8acc866e51 修改同步任务信息sql 2023-12-01 16:08:24 +08:00
zhangwei 066007df0d zw 2023-11-29 19:09:33 +08:00
zhangwei 5e7d1dc22a zw 2023-11-29 19:09:07 +08:00
zhouqunjie 8710013a83 提交代码 2023-11-29 17:27:51 +08:00
zhouqunjie 5db33d3353 提交代码 2023-11-29 16:48:16 +08:00
devad a8959f0e07 获取应用分发详情修改
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-28 18:35:06 +08:00
zhangwei d06528b408 将nsid设置到命名空间 2023-11-28 15:24:18 +08:00
zhangwei 9dfd73aad8 p端根据id查询任务列表 2023-11-28 15:13:36 +08:00
devad 027911e82f 依赖升级
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-28 12:08:20 +08:00
zhouqunjie 0c0586081f 修改列表查询入参名称 2023-11-27 18:51:23 +08:00
zhouqunjie f3a7238077 修改列表查询入参名称 2023-11-27 18:48:24 +08:00
Diva123456 e210b3c283 增加sealos处理 2023-11-27 17:37:44 +08:00
devad 990fc0500a 根据应用名称查询pod列表
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-27 17:37:10 +08:00
devad 9bb2c298b0 根据应用名称查询pod列表
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-27 17:33:34 +08:00
zhangwei 9c13fa7882 rpc移除同步任务接口 2023-11-27 15:52:47 +08:00
devad 1657ca7305 依赖升级
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-27 12:19:24 +08:00
zhouqunjie b6a7f7363d Merge remote-tracking branch 'origin/master' 2023-11-25 16:37:56 +08:00
zhouqunjie 8388d26ea8 应用列表中展示子表中的副本数量 2023-11-25 16:37:50 +08:00
devad 4ce1b2956b gorm 连接池配置
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-25 16:20:04 +08:00
zhouqunjie f7cf741b54 Merge remote-tracking branch 'origin/master' 2023-11-25 15:17:28 +08:00
zhouqunjie e9df36b827 屏蔽调度算法,采用随机分发策略 2023-11-25 15:17:20 +08:00
devad 908063d5a4 依赖更新
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-25 12:42:52 +08:00
devad 9c6277828c fix bugs
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-24 16:51:40 +08:00
devad 1263851a58 列表查询
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-24 16:14:02 +08:00
devad f0de1a71a2 列表查询
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-24 15:42:30 +08:00
zhouqunjie 62ca70a4a1 调度部分调整 2023-11-24 14:29:59 +08:00
devad 1e2ca857dd 暂存
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-24 14:22:40 +08:00
zhouqunjie 9c04866bf2 repeat cluster name validate 2023-11-23 20:54:36 +08:00
zhouqunjie 7ea991a272 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	api/internal/logic/cloud/updatetenantlogic.go
2023-11-23 20:24:23 +08:00
zhouqunjie 7dd50995c0 jcos registCluster and deleteCluster 2023-11-23 20:23:49 +08:00
devad cd070699d1 🐛 Fixing a bug.
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-23 20:14:58 +08:00
devad 5fa964122f models更新
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-23 19:45:24 +08:00
devad 85743ac872 models更新
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-23 18:59:40 +08:00
devad b9775efde3 models更新
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-23 18:53:33 +08:00
devad 9c8ef50b78 api新增集群注册接口
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-23 18:36:41 +08:00
zhangwei cfc3d23b49 pod图表接口 2023-11-23 17:51:07 +08:00
zhangwei d11bdf17f5 controller图表接口 2023-11-23 15:26:56 +08:00
zhangwei c4bd96cf4d controller图表接口 2023-11-23 15:20:21 +08:00
zhangwei 035c357c62 controller图表接口 2023-11-23 15:20:15 +08:00
tzwang f19df9d4b1 调度方法修改 2023-11-23 15:09:13 +08:00
tzwang e6103a5cd0 存算联动添加曙光Hpc 2023-11-23 10:50:32 +08:00
zhouqunjie 9905536031 Merge remote-tracking branch 'origin/master' 2023-11-22 18:13:08 +08:00
zhouqunjie c00fb78c92 fix bug remove gotags for listparticipant 2023-11-22 18:12:51 +08:00
tzwang 35dc202d29 调度结构修改 2023-11-22 18:12:15 +08:00
zhangwei a07fd6bad5 配置文件修改 2023-11-22 14:48:20 +08:00
zhangwei 2e7cfdfda5 pod监控图表信息修改 2023-11-22 14:37:26 +08:00
tzwang 3693b853c6 调度结构修改 2023-11-22 11:30:48 +08:00
tzwang a45bd574fe 调度结构修改 2023-11-21 18:56:57 +08:00
zhangwei 9b7d7f3315 表单提交超算任务完成 2023-11-18 18:06:28 +08:00
Jake c10f790469 generate swagger json 2023-11-16 17:14:50 +08:00
qiwang 660eae566c fix:增加VmInfoList 2023-11-14 17:59:49 +08:00
zhouqunjie 7dc14a00ac update License to MulanV2 2023-11-12 20:15:32 +08:00
devad cf8f383aa9 🐛 fix
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-08 16:37:49 +08:00
zhangwei 3673109dda 可用资源信息修改 2023-11-08 15:56:51 +08:00
zhangwei 69cd38ef57 任务详情的指标单位转换 2023-11-08 15:22:19 +08:00
zhouqunjie d675857c82 Participant repo name change 2023-11-08 11:30:59 +08:00
devad a1cc97e48d 🐛 fix
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-08 11:16:57 +08:00
zhouqunjie b7b6952ffc goctl版本升级排除client包名问题 2023-11-08 10:01:08 +08:00
zhouqunjie 2c56af84c8 C端状态与P端同步,slurm任务下发 2023-11-07 20:00:04 +08:00
zhangwei 6d99429548 定时修改任务状态接口 2023-11-07 16:13:18 +08:00
zhangwei ce5d1d940b 任务详情接口修改 2023-11-07 15:37:51 +08:00
zhouqunjie a2fcb44494 ♻ 修改通用方法名称 2023-11-07 09:06:12 +08:00
zhangwei cb227ede52 修改k8s示例 2023-11-03 15:55:54 +08:00
zhangwei 455cee1f2d 添加任务状态常量 2023-11-02 18:37:35 +08:00
devad bfa8281d3b ♻️ modelarts 提交任务参数修改
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-02 10:37:51 +08:00
tzwang 889986361a 存算联动修改 2023-11-01 19:08:35 +08:00
devad 0024d0ddea 生成api代码
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-01 18:58:15 +08:00
tzwang 25abd7a7f4 存算联动修改 2023-11-01 18:55:47 +08:00
tzwang 68915cf43a 存算联动修改 2023-11-01 18:26:47 +08:00
devad a25b621bf5 fix
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-01 17:57:51 +08:00
devad 0b06b3b508 生成api代码
Signed-off-by: devad <cossjie@foxmail.com>
2023-11-01 17:50:08 +08:00
tzwang d9c1cd0261 存算联动修改 2023-11-01 17:37:02 +08:00
zhangwei afd3152161 删除任务接口修改 2023-11-01 17:22:25 +08:00
zhangwei e35c9a5e05 修改任务接口更改 2023-10-31 19:16:00 +08:00
zhangwei 2509f55be2 修改任务接口更改 2023-10-31 18:13:05 +08:00
tzwang 206404d5f3 存算联动修改 2023-10-31 17:13:34 +08:00
tzwang d8b82e03b9 存算联动修改 2023-10-31 16:28:49 +08:00
tzwang 0af7b90c91 存算联动修改 2023-10-31 15:24:05 +08:00
tzwang 4971f83fd5 存算联动修改 2023-10-31 15:16:48 +08:00
tzwang a2705ef6fc 存算联动修改 2023-10-31 11:09:42 +08:00
zhangwei 8696e3cb16 根据p端id获取任务列表接口修改 2023-10-30 16:59:22 +08:00
zhangwei 1c63965ba5 任务列表接口已完成 2023-10-30 16:06:51 +08:00
devad 7b4aa9ed34 🐛 fix modelarts
Signed-off-by: devad <cossjie@foxmail.com>
2023-10-30 14:52:36 +08:00
devad 627e4e0553 📝 update Makefile
Signed-off-by: devad <cossjie@foxmail.com>
2023-10-30 12:16:18 +08:00
devad 8fd52e86fd 🐛 Fixing a bug.
Signed-off-by: devad <cossjie@foxmail.com>
2023-10-30 11:34:52 +08:00
zhangwei f584527e2f 任务详情监控 2023-10-30 10:53:30 +08:00
tzwang e6e7389ce2 存算联动修改 2023-10-30 10:48:46 +08:00
devad 9d851b10e3 modelarts 增加资源规格接口
Signed-off-by: devad <cossjie@foxmail.com>
2023-10-30 10:14:15 +08:00
tzwang a7b9c27d37 存算联动提交接口修改 2023-10-27 17:24:09 +08:00
tzwang 6b5a30defe 存算联动提交接口修改 2023-10-27 17:08:39 +08:00
zhouqunjie 0ad85477e4 Merge remote-tracking branch 'origin/master' 2023-10-27 10:04:23 +08:00
zhouqunjie 2c7cae3311 fix scheduletaskbyyamllogic 2023-10-27 10:04:13 +08:00
tzwang ad11733867 存算联动修改 2023-10-26 20:21:10 +08:00
tzwang a2c53e24d1 Merge remote-tracking branch 'origin/master' 2023-10-26 17:10:23 +08:00
tzwang 3e024424ac 存算联动修改 2023-10-26 17:10:12 +08:00
qiwang 5249571be4 fix:启动,停止,暂停实例修改字段 2023-10-26 16:47:19 +08:00
devad 0c40e5f84c api代码生成
Signed-off-by: devad <cossjie@foxmail.com>
2023-10-26 15:06:16 +08:00
tzwang b5db884b42 存算联动修改 2023-10-26 11:26:23 +08:00
tzwang ca700f1400 存算联动增加曙光Ai接口 2023-10-25 17:40:25 +08:00
devad 0b0b1a5d97 Add modelarts impl
Signed-off-by: devad <cossjie@foxmail.com>
2023-10-24 20:26:32 +08:00
qiwang 4c0b1f8d1d fix:启动,停止,暂停实例修改字段 2023-10-24 20:10:08 +08:00
zhouqunjie 31d1d48b7c api code generate 2023-10-24 11:04:56 +08:00
zhangwei 3e97406e76 监控模块撰写 2023-10-24 10:12:33 +08:00
tzwang 851a19294b 存算联动资源规格查询 2023-10-23 17:28:43 +08:00
qiwang de14cd03fb fix:修改updateserver字段 2023-10-23 16:42:32 +08:00
zhangwei b7bfd3191c 提交任务返回任务id 2023-10-23 14:43:46 +08:00
qiwang d5722a551b fix:增加openstack查询详情接口到C端 2023-10-20 11:57:39 +08:00
qiwang f4108aade2 fix:增加openstack查询详情接口到C端 2023-10-20 11:29:31 +08:00
qiwang 05031382fd fix:增加openstack查询详情接口到C端 2023-10-19 15:16:38 +08:00
zhangwei f0d39e2ff1 hashcat新增字段 2023-10-18 15:41:06 +08:00
zhangwei 6037cb3c85 Merge remote-tracking branch 'origin/zw' 2023-10-16 10:42:49 +08:00
zhangwei 744a11a0d8 redis队列替换kafka 2023-10-16 10:27:49 +08:00
qiwang 5d9fe1bd81 fix:增加openstack到C端 2023-10-13 09:47:52 +08:00
qiwang 6a685fee33 fix:增加openstack到C端 2023-10-13 09:46:25 +08:00
devad e7bc89bc5a go.sum更改
Signed-off-by: devad <cossjie@foxmail.com>
2023-10-12 19:24:45 +08:00
tzwang 85405ae5a4 存算联动接口调整 2023-10-12 11:29:14 +08:00
zhouqunjie 6bdec0b4f8 api code generate 2023-10-12 10:42:56 +08:00
tzwang d480e3510a api调整 2023-10-12 10:23:46 +08:00
tzwang 3c0322fe57 存算联动接口调整 2023-10-11 17:38:35 +08:00
zhangwei d00897a5fb api代码生成 2023-10-11 10:20:37 +08:00
tzwang 9b4ecea826 存算联动参数调整 2023-10-11 10:13:27 +08:00
tzwang 313f3d815c 存算联动修改 2023-10-11 09:20:51 +08:00
tzwang 9983c662e5 存算联动修改 2023-10-11 08:58:29 +08:00
zhangwei ede86dbb7b api代码生成 2023-10-10 17:24:28 +08:00
tzwang 4b548d7cd1 存算联动修改 2023-10-10 17:23:59 +08:00
zhangwei cb6030d4fa redis消息队列替换kafka 2023-10-10 17:20:52 +08:00
tzwang 617e29e56c 存算联动修改 2023-10-10 16:52:56 +08:00
zhangwei 933d2d204f 提交 2023-10-10 08:53:10 +08:00
devad 6ba1ceae48 因grampus.openi.org.cn证书过期,https调整为http
Signed-off-by: devad <cossjie@foxmail.com>
2023-10-07 09:24:04 +08:00
tzwang e4e7b5685f 添加注释 2023-09-28 10:37:28 +08:00
zhangwei 6bf0776d9e rpc client初始化 2023-09-27 14:49:52 +08:00
zhangwei 593a85afef rpc client初始化 2023-09-27 14:48:28 +08:00
zhangwei f496fcbe25 添加任务校验 2023-09-25 17:28:05 +08:00
tzwang 7943b0ac9a 存算联动接口更新 2023-09-25 17:11:13 +08:00
zhangwei 8cf8a3238d 代码目录调整 2023-09-25 15:00:58 +08:00
zhangwei 5a33aba8bf 删除任务信息接口bug修复 2023-09-18 09:40:15 +08:00
zhangwei 9bdb33268b 删除任务信息接口bug修复 2023-09-18 09:16:47 +08:00
tzwang 07fc2e447b 存算联动类型转换更新 2023-09-15 17:56:24 +08:00
zhangwei 0a598defa8 model层添加delete_at 2023-09-15 15:01:35 +08:00
zhangwei ac8a60ae04 goctl生成代码 2023-09-15 10:04:08 +08:00
tzwang 528898e302 pcm api修改 2023-09-15 10:00:11 +08:00
tzwang 1b26a89f15 go mod 修改 2023-09-14 18:24:57 +08:00
tzwang f3cadc5721 存算联动api修改3 2023-09-14 11:30:54 +08:00
zhangwei db3fe6a903 goctl生成代码 2023-09-13 17:16:18 +08:00
tzwang aa7f994446 存算联动api修改2 2023-09-13 17:14:55 +08:00
tzwang 9d4615ff6f 存算联动api修改2 2023-09-13 17:13:37 +08:00
tzwang 3506b3ba89 存算联动api修改 2023-09-13 17:07:21 +08:00
tzwang 5c89390c08 存算联动接口修改 2023-09-13 16:15:31 +08:00
zhangwei 269c3fa7e6 model层部分表删除部分字段 2023-09-13 11:02:50 +08:00
tzwang c6b845f908 存算联动部分接口 2023-09-12 17:43:37 +08:00
zhangwei 7c356c3c5f 存算联动api代码生成 2023-09-08 17:35:25 +08:00
zhangwei 1cc0303d2d 存算联动api代码生成 2023-09-08 17:32:36 +08:00
tzwang a6fc536e56 gozero api 修改 2023-09-08 17:30:43 +08:00
tzwang b911bfbfbf 调度结构修改8 2023-09-07 10:49:27 +08:00
zhouqunjie 0a23e50da2 Update README.md 2023-09-06 19:12:13 +08:00
zhouqunjie 1ab206a821 Update README.md 2023-09-06 19:06:30 +08:00
zhangwei 122ec3afc0 查询p端列表信息 2023-09-06 16:30:27 +08:00
zhangwei 4da76886f5 查询p端列表信息 2023-09-06 16:22:20 +08:00
zhangwei c12b5b9055 p端添加监控信息字段 2023-09-06 09:45:38 +08:00
zhouqunjie cca78dded7 fix: 修复错误提交 2023-09-05 09:52:19 +08:00
qiwang f0224fba84 fix:增加openstack到C端 2023-09-04 16:03:48 +08:00
zhangwei f94e9491c0 hashcat 进度反馈和列表查询接口 2023-09-04 10:41:22 +08:00
tzwang 6719fc5c31 Merge remote-tracking branch 'origin/master' 2023-09-04 08:46:57 +08:00
zhangwei 6b8598fe77 hashcat 进度反馈和列表查询接口 2023-09-01 20:03:02 +08:00
tzwang 2daa2c067f Merge remote-tracking branch 'origin/master'
# Conflicts:
#	deploy/pcm-coordinator-api.Jenkinsfile
#	deploy/pcm-coordinator-rpc.Jenkinsfile
2023-09-01 17:39:25 +08:00
devad b42da439a1 Added Jenkinsfile
Signed-off-by: devad <cossjie@foxmail.com>
2023-09-01 17:14:24 +08:00
devad 1f767f5c79 Added Jenkinsfile
Signed-off-by: devad <cossjie@foxmail.com>
2023-09-01 17:03:18 +08:00
devad f4208088c5 Added Jenkinsfile
Signed-off-by: devad <cossjie@foxmail.com>
2023-09-01 16:52:56 +08:00
devad 458f24c4cd Added tenant registration and list interfaces
Signed-off-by: devad <cossjie@foxmail.com>
2023-09-01 15:15:55 +08:00
zhangwei 1aae5e2d17 数算任务列表删除yamlString字段 2023-09-01 09:28:09 +08:00
zhangwei 230dcb4e51 nacos命名空间修改 2023-08-31 17:36:54 +08:00
zhangwei 1086a71a5f 数算列表接口 2023-08-31 17:32:44 +08:00
zhouqunjie 591b567ea1 fix: 代码规范调整 2023-08-31 17:20:16 +08:00
zhouqunjie aff2077cf0 feature: vm overview api service 2023-08-31 17:08:11 +08:00
zhouqunjie 097000f8d3 feature: cloud api service 2023-08-31 15:30:31 +08:00
zhouqunjie e857a45ca2 fix:restore yaml file 2023-08-31 15:08:43 +08:00
zhouqunjie 1b06963640 openstack C端实现 2023-08-31 12:12:13 +08:00
zhangwei ffb114ca68 查询数据库系节点动态资源信息修改 2023-08-29 17:37:52 +08:00
tzwang 6e473ef1eb 调度结构修改7 2023-08-29 15:12:51 +08:00
devad 0de2982c10 ♻️ fix ci/cd bug
Signed-off-by: devad <cossjie@foxmail.com>
2023-08-28 18:35:31 +08:00
zhangwei 0ca3552e49 查询队列资源信息 2023-08-28 18:26:18 +08:00
tzwang f8bd112caf 调度结构修改6 2023-08-28 17:39:03 +08:00
devad 635cfd7e3a ♻️ fix ci/cd bug
Signed-off-by: devad <cossjie@foxmail.com>
2023-08-28 17:10:55 +08:00
zhangwei 7721b3b6ff 查询资源节点信息 2023-08-28 15:05:33 +08:00
tzwang 89372339e7 调度结构修改5 2023-08-24 17:08:19 +08:00
tzwang 4e6978ce83 调度结构修改4 2023-08-24 16:39:32 +08:00
zhangwei 5f029e5098 taskinfo信息修改 2023-08-24 16:16:59 +08:00
zhangwei 3df2c09c69 调度模块修改 2023-08-24 14:51:56 +08:00
tzwang 31a8f1469b Merge remote-tracking branch 'origin/master'
# Conflicts:
#	.devops/api.yml
#	.devops/rpc.yml
2023-08-24 08:48:32 +08:00
devad 38ae817c82 ♻️ Add ci/cd
Signed-off-by: devad <cossjie@foxmail.com>
2023-08-23 19:47:05 +08:00
devad 4bd1fc8e6c ♻️ Add ci/cd
Signed-off-by: devad <cossjie@foxmail.com>
2023-08-23 17:29:10 +08:00
devad 07bc45a09f ♻️ Add ci/cd
Signed-off-by: devad <cossjie@foxmail.com>
2023-08-23 17:21:58 +08:00
tzwang 8242a201cd 调度结构修改3 2023-08-23 16:57:52 +08:00
devad 7ffc929575 ♻️ fix bug
Signed-off-by: devad <cossjie@foxmail.com>
2023-08-23 15:34:56 +08:00
tzwang 01bea42264 调度结构修改2 2023-08-23 09:08:40 +08:00
tzwang 39acb91436 调度结构修改 2023-08-22 17:46:11 +08:00
zhangwei 5c49999d9c 超算队列新增字段 2023-08-21 19:06:17 +08:00
devad bebf44c3b5 ♻️ fix bug
Signed-off-by: devad <cossjie@foxmail.com>
2023-08-21 18:03:20 +08:00
tzwang 0675883728 调度算法 2023-08-21 11:11:10 +08:00
zhangwei d35faf6ce6 心跳请求字段修改 2023-08-18 18:02:40 +08:00
zhangwei 427b30e6bc p端静态信息字段修改 2023-08-18 16:46:16 +08:00
zhangwei 14d580a742 超算字段修改 2023-08-18 16:09:48 +08:00
devad dcf79c70d7 ♻️ RegisterParticipant add queue info
Signed-off-by: devad <cossjie@foxmail.com>
2023-08-18 10:30:17 +08:00
devad 4e20487446 ♻️ Add redis impl
Signed-off-by: devad <cossjie@foxmail.com>
2023-08-17 18:04:19 +08:00
zhouqunjie 6538b74b87 Update README.md 2023-08-16 16:33:23 +08:00
zhouqunjie 39041886c8 Update README.md 2023-08-16 11:37:03 +08:00
zhouqunjie bfbd7643f7 Update README.md 2023-08-16 11:17:05 +08:00
devad daab8da594 feat listParticipant impl
Signed-off-by: devad <cossjie@foxmail.com>
2023-08-14 17:37:25 +08:00
zhangwei f72f8b9f6f 任务执行结果入库 2023-08-14 15:34:26 +08:00
彭硕 a4c90176ce 监控数据类型修改 2023-07-27 09:55:16 +08:00
devad 9ff3815f56 ♻️ refactor RegisterParticipant impl
Signed-off-by: devad <cossjie@foxmail.com>
2023-07-26 18:28:36 +08:00
zhangwei 4627f81f93 移除service——name 2023-07-26 17:33:29 +08:00
devad 82285d1dba feat reportAvailable impl
Signed-off-by: devad <cossjie@foxmail.com>
2023-07-26 17:23:56 +08:00
zhangwei b346a12f84 提交任务修改参数 2023-07-26 15:47:09 +08:00
zhangwei cf60ab6a9e 根据标签匹配任务 2023-07-26 14:56:22 +08:00
devad 249c900643 feat ReportHeartbeat impl
Signed-off-by: devad <cossjie@foxmail.com>
2023-07-25 20:27:10 +08:00
devad 61f39aa179 ♻️ refactor RegisterParticipant impl
Signed-off-by: devad <cossjie@foxmail.com>
2023-07-25 11:18:42 +08:00
彭硕 b795e3f9be 修改ScNodeAvailInfo 2023-07-24 22:13:58 +08:00
彭硕 0bd56d9534 更新go mod文件 2023-07-24 21:32:50 +08:00
devad c860a80b83 feat: Add registerParticipant impl
Signed-off-by: devad <cossjie@foxmail.com>
2023-07-24 17:33:00 +08:00
zhangwei 44fff7b179 ParticipantId字段修改 2023-07-22 10:34:31 +08:00
zhangwei 047ee6a804 cpu可用率修改 2023-07-22 10:17:04 +08:00
zhangwei d170dc84c6 表关联关系修改 2023-07-21 16:18:37 +08:00
zhangwei e13578349e model 节点表修改 2023-07-21 10:50:04 +08:00
devad b1e010fcf2 feat: Add schedule model
Signed-off-by: devad <cossjie@foxmail.com>
2023-07-21 10:06:44 +08:00
zhouqunjie b82aeac938 fix import cycle 2023-07-14 10:57:12 +08:00
zhouqunjie aad012d1de amend 2023-07-14 10:43:43 +08:00
zhouqunjie 16c284a7ad remove .git suffix 2023-07-14 08:47:26 +08:00
zhouqunjie 8ef454c276 Merge pull request 'init' (#1) from 2.0 into master 2023-07-13 10:58:01 +08:00
zhouqunjie cfd3e17f73 coordinator repo init 2023-07-13 10:56:33 +08:00
liyaojie 9473ef1ab2 Merge branch '2.0' of https://gitlink.org.cn/JCCE/PCM into 2.0 2023-07-11 15:00:58 +08:00
devad 9cfe3e0a5f feat: 对接腾讯云查询函数详情方法
Signed-off-by: devad <cossjie@foxmail.com>
2023-07-11 12:37:16 +08:00
zhangwei 28f048bdfc 外部任务状态枚举修改 2023-07-11 11:21:31 +08:00
zhangwei 9e6d65053c 外部任务状态枚举修改 2023-07-11 10:33:41 +08:00
zhangwei 7ee7b0c5c4 镜像列表开发完成 2023-07-10 17:27:02 +08:00
zhangwei 0df5d171dc 镜像列表接口注释 开发中 2023-07-10 17:05:34 +08:00
tzwang 838077afc7 Merge remote-tracking branch 'origin/2.0' into 2.0 2023-07-10 10:30:44 +08:00
tzwang c6fb5065a6 octopus修改tokenservice代码 2023-07-10 10:28:37 +08:00
zhangwei ec61728338 修改镜像仓库配置 2023-07-07 16:46:16 +08:00
zhangwei fdd81a6b33 修改镜像仓库 2023-07-07 16:29:50 +08:00
zhangwei fba1807a5d 修改挂载配置 2023-07-07 16:02:09 +08:00
zhangwei 9c3325b8f4 修改挂载配置 2023-07-07 15:55:13 +08:00
zhangwei 426cab62ba 修改挂载配置 2023-07-07 15:47:41 +08:00
zhangwei 3a5cf8cbee 修改docker镜像源 2023-07-07 10:24:10 +08:00
zhangwei 6d2088c033 pcm-core-api yaml文件配置修改 2023-07-07 09:45:37 +08:00
zhangwei b65d509bd6 docker client配置连接修改成默认 2023-07-07 09:41:38 +08:00
zhangwei e49440f47f docker client配置连接 2023-07-06 16:07:05 +08:00
zhangwei 474a2bc77b 文件上传增加错误信息返回 2023-07-06 10:40:41 +08:00
zhangwei 64242fd919 文件上传增加错误信息返回 2023-07-06 10:32:44 +08:00
zhangwei bf0e6c6a09 Merge branch 'file2.0' into 2.0 2023-07-06 10:03:43 +08:00
zhangwei 1611ce4e7c 镜像管理完成 2023-07-06 10:03:21 +08:00
devad a0b8934eb3 feat: 新增腾讯云云函数,对接查询函数列表方法
Signed-off-by: devad <cossjie@foxmail.com>
2023-07-05 15:03:18 +08:00
devad bf96ad6646 feat: 新增腾讯云云函数,对接查询函数列表方法
Signed-off-by: devad <cossjie@foxmail.com>
2023-07-05 11:23:54 +08:00
zhangwei e35fb35fe3 推送文件到云集存储完成 2023-07-04 17:11:19 +08:00
zhangwei 4d246847cd 文件上传 2023-07-04 16:30:31 +08:00
zhangwei f7d1f70f11 Merge branch '2.0' into 2.0-zw
# Conflicts:
#	adaptor/PCM-CORE/api/desc/core/pcm-core.api
#	adaptor/PCM-CORE/rpc/pcmcore.go
#	common/config/nacos.go
2023-07-04 15:41:29 +08:00
zhangwei 8f0f03f780 文件上传 2023-07-04 15:36:50 +08:00
zhangwei 72f094fbec 文件上传 2023-07-04 11:47:24 +08:00
zhangwei 088cc41d99 大屏任务列表判空 2023-06-26 09:06:01 +08:00
zhangwei 34cdece43b 代码规范 2023-06-21 16:16:09 +08:00
zhangwei 6800f9a6d5 任务列表信息 2023-06-20 16:48:07 +08:00
devad 15f598faac fix: 域信息查询数算集群监控
Signed-off-by: devad <cossjie@foxmail.com>
2023-06-17 11:29:05 +08:00
zhangwei 43a5062326 对接任务数据增加返回体 2023-06-16 22:34:30 +08:00
zhangwei efcea561a7 对接任务数据 2023-06-16 22:03:17 +08:00
ll15074821352 64c14f9308 modelarts Core端api文件训练作业增加订阅算法参数 2023-06-16 16:08:28 +08:00
devad fa3519fe5c fix: 修复查询域资源信息赋值问题
Signed-off-by: devad <cossjie@foxmail.com>
2023-06-16 11:51:44 +08:00
qiwang d705dd41fe fix:PCM-ceph代码修改 2023-06-16 10:07:44 +08:00
zhouqunjie d6386bb55f add param type for listclusterlogic 2023-06-16 09:50:16 +08:00
ll15074821352 e30cbb370e modelarts Core端api文件训练作业增加订阅算法参数 2023-06-16 08:35:51 +08:00
zhouqunjie 8a9df31afa nacos config amend 2023-06-15 20:07:07 +08:00
zhouqunjie c64c2121c2 Merge remote-tracking branch 'origin/2.0' into 2.0 2023-06-15 18:38:31 +08:00
zhouqunjie e2d56722f5 pcm interface:list cluster for compute center 2023-06-15 18:38:24 +08:00
devad 7ff060d170 fix: nacos地址更改为配置
Signed-off-by: devad <cossjie@foxmail.com>
2023-06-15 18:03:24 +08:00
zhouqunjie 922d169796 Merge remote-tracking branch 'origin/2.0' into 2.0 2023-06-15 17:27:37 +08:00
zhouqunjie 94574bb562 ac list history job& pcm list cluster for compute center 2023-06-15 17:27:30 +08:00
ll15074821352 6acb3cf134 modelarts Core端api文件训练作业增加订阅算法参数 2023-06-15 16:24:09 +08:00
ll15074821352 585099db80 modelarts Core端api文件训练作业增加订阅算法参数 2023-06-15 09:44:45 +08:00
zhouqunjie 1689d52ed9 approved 2023-06-15 09:42:12 +08:00
qiwang d1d24100e3 fix:PCM-CORE代码修改 2023-06-15 08:54:28 +08:00
ll15074821352 9636cf7657 modelarts Core端api文件训练作业增加订阅算法参数 2023-06-14 11:09:19 +08:00
ll15074821352 e72a41ae75 训练作业p端完成 2023-06-13 17:37:28 +08:00
qiwang 5eda47bdef fix:PCM-CORE代码修改 2023-06-13 14:52:14 +08:00
zhangwei 78409c8553 core 命名空间修改 2023-06-13 08:35:57 +08:00
zhangwei 653b972fac 任务列表修改 2023-06-13 08:35:26 +08:00
zhouqunjie 529b1a9a5e Merge remote-tracking branch 'origin/2.0' into 2.0 2023-06-13 08:27:32 +08:00
zhouqunjie aae80f97e2 ac listhitoryjob 2023-06-13 08:27:25 +08:00
zhangwei 8935c877b5 数据集上传代码增加,未调通 2023-06-12 21:20:22 +08:00
zhangwei 6249ae97f9 算网枚举类增加 2023-06-12 21:14:31 +08:00
zhangwei 231524986d 查询运行中的任务列表同步信息添加入参 2023-06-12 20:59:27 +08:00
zhangwei dbd9e04e37 查询运行中的任务列表同步信息添加入参 2023-06-12 20:35:02 +08:00
qiwang ce44f191c5 Merge remote-tracking branch 'origin/2.0' into 2.0 2023-06-12 20:32:26 +08:00
qiwang 934fba1947 fix:PCM-CORE代码修改 2023-06-12 20:32:12 +08:00
zhouqunjie 36ff5278ce start&end time for list history job 2023-06-12 19:55:27 +08:00
devad 8f0ed19d2c fix: pcm-ac-service.yaml 更改为nodePort
Signed-off-by: devad <cossjie@foxmail.com>
2023-06-12 19:50:19 +08:00
zhouqunjie 4dfead74bb Merge remote-tracking branch 'origin/2.0' into 2.0 2023-06-12 19:48:44 +08:00
zhouqunjie cbaa2409c6 start&end time for list history job 2023-06-12 19:48:33 +08:00
devad 44777c3833 fix: pcm-ac-service.yaml 更改为nodePort
Signed-off-by: devad <cossjie@foxmail.com>
2023-06-12 19:41:27 +08:00
zhouqunjie d9bae6d49c listHistoryJob for ac& th job submit fix 2023-06-12 19:35:20 +08:00
qiwang 9596570500 fix:PCM-CORE代码修改 2023-06-12 19:09:20 +08:00
qiwang 46fbd92abc fix:PCM-CORE代码修改 2023-06-09 10:53:25 +08:00
qiwang 15b62d03fd fix:PCM-CORE代码修改 2023-06-08 17:10:45 +08:00
devad c481227cbb fix: pcm kubernetes服务注册地址更改为域名
Signed-off-by: devad <cossjie@foxmail.com>
2023-06-01 15:17:44 +08:00
zhangwei acf6a6b649 文件断点续传已完成 2023-05-31 08:53:33 +08:00
zhangwei 8abc72dc72 文件断点续传已完成 2023-05-31 08:50:49 +08:00
zhangwei bcfeb8fda6 检查文件是否存在handler提交 2023-05-30 09:07:06 +08:00
zhouqunjie 8bea8f8170 core-rpc 同步天河信息字段修改 2023-05-29 03:41:44 -07:00
zhouqunjie 48095a570a pcmcore修改天河字段 2023-05-29 03:20:43 -07:00
zhangwei 66fb94eb65 天河增加返回信息字段 2023-05-29 18:01:42 +08:00
zhouqunjie 37456dca05 commit for zw 2023-05-29 00:28:59 -07:00
tzwang 1ee2df3200 启智章鱼modeldeploy相关接口 2023-05-27 17:13:02 +08:00
zhangwei 1ccf70a342 天河增加返回信息字段 2023-05-27 16:53:49 +08:00
张威 3b1544fedc 断点续传已完成 2023-05-27 14:38:36 +08:00
tzwang 5a7abd6236 启智章鱼trainjob相关接口 2023-05-27 11:28:51 +08:00
tzwang 9aaa4e746a 启智章鱼获取model相关接口 2023-05-26 16:05:21 +08:00
tzwang 1015390cf0 启智章鱼获取训练作业列表接口 2023-05-25 16:39:17 +08:00
zhouqunjie c7b7747f8e Merge remote-tracking branch 'origin/2.0' into 2.0 2023-05-25 15:59:40 +08:00
zhouqunjie 4f24d51275 core-rpc 服务调整为nodePort 2023-05-25 15:59:30 +08:00
qiwang 9b1a448e0a Merge remote-tracking branch 'origin/2.0' into 2.0 2023-05-25 14:40:34 +08:00
qiwang 209d77bab8 fix:修改算法列表bug 2023-05-25 14:40:21 +08:00
张威 38c42d8fac 天河代码修改脚本字段 2023-05-25 14:40:06 +08:00
tzwang 75647ecfb3 Merge remote-tracking branch 'origin/2.0' into 2.0 2023-05-25 11:29:52 +08:00
tzwang 504da056a8 启智章鱼接口参数修改 2023-05-25 11:27:06 +08:00
qiwang c84d288e30 Merge remote-tracking branch 'origin/2.0' into 2.0 2023-05-25 11:01:35 +08:00
qiwang 636a8d6941 fix:修改apigw-go-sdk的引用路径 2023-05-25 11:01:12 +08:00
tzwang dcc77c7b7e 启智章鱼接口logic修改 2023-05-25 10:50:57 +08:00
tzwang b8779f052b 启智章鱼pb修改 2023-05-25 10:44:13 +08:00
tzwang cdf2bffb9a 启智章鱼接口pb修改 2023-05-25 10:39:27 +08:00
tzwang 033716d66a 启智章鱼查询数据集类型列表,用途列表接口 2023-05-25 10:15:16 +08:00
zhangwei 31083cc07b 增加检查镜像文件是否存在的接口 2023-05-24 17:51:57 +08:00
devad 6a45c06961 feat: 资源面板配置接口
Signed-off-by: devad <cossjie@foxmail.com>
2023-05-24 17:20:47 +08:00
devad f60b58c14c feat: pcm-core-deployment.yaml增加镜像卷挂载
Signed-off-by: devad <cossjie@foxmail.com>
2023-05-24 17:16:56 +08:00
zhangwei 54e5eee24c windows和linux路径修改 2023-05-24 16:46:06 +08:00
zhangwei fb304e3e7d 分片上传开发完成 2023-05-24 16:18:40 +08:00
tzwang b0639ee26f 算法版本列表接口调整 2023-05-24 10:52:55 +08:00
tzwang 44b49dc998 接口调整 2023-05-22 17:35:53 +08:00
tzwang e9129ab518 启智章鱼接口调整 2023-05-22 17:30:48 +08:00
tzwang 0fa8da48b7 启智章鱼接口更新 2023-05-22 11:23:47 +08:00
tzwang 11decce9be 更新启智章鱼接口 2023-05-21 22:16:07 +08:00
zhangwei 653a939ef6 任务定时修改状态bug修复
添加cmdScript字段给超算
2023-05-19 16:40:19 +08:00
qiwang 134e81b4a2 fix:显示详情接口修改 2023-05-18 17:14:40 +08:00
qiwang 43d2244641 fix:显示详情接口修改 2023-05-18 17:10:27 +08:00
qiwang 67d4c266a3 fix:显示详情接口修改 2023-05-18 17:08:28 +08:00
qiwang 81391f54c3 fix:显示详情接口修改 2023-05-18 17:06:12 +08:00
qiwang 5a6ed32c20 fix:删除接口修改 2023-05-18 17:01:35 +08:00
qiwang 56be610560 fix:删除接口修改 2023-05-18 16:55:34 +08:00
qiwang 80349a1015 fix:创建接口修改 2023-05-18 16:51:02 +08:00
qiwang 3a39965b54 fix:创建开发环境接口修改 2023-05-18 16:45:22 +08:00
qiwang 58bba95d9f fix:创建模型接口修改 2023-05-18 16:42:18 +08:00
qiwang 77882bc7a0 fix:查询开发环境接口修改 2023-05-18 16:38:52 +08:00
qiwang 444b56c4e3 fix:查询开发环境接口修改 2023-05-18 16:37:05 +08:00
qiwang 271f1e85ef fix:查询开发环境接口修改 2023-05-18 16:04:03 +08:00
qiwang fc517e0e40 fix:查询开发环境接口修改 2023-05-18 16:01:39 +08:00
qiwang 34598e026a fix:查询专属资源池接口修改 2023-05-18 15:55:15 +08:00
qiwang 50846da465 fix:查询模型列表接口修改 2023-05-18 15:33:36 +08:00
qiwang 0304504ef7 fix:查询服务列表接口修改 2023-05-18 15:30:08 +08:00
qiwang 88d78d4dc3 fix:删除数据集接口修改 2023-05-18 11:26:43 +08:00
zhangwei bb55ca1d0a 镜像列表接口拼接地址 2023-05-18 10:15:34 +08:00
zhouqunjie 5fc97d3a61 Merge remote-tracking branch 'origin/2.0' into 2.0 2023-05-18 10:08:34 +08:00
zhouqunjie 66b2b2b936 fix:超算概览 增加正在运行任务数逻辑 2023-05-18 10:08:22 +08:00
zhangwei e502be4a9d 镜像列表接口拼接地址 2023-05-18 10:05:45 +08:00
zhouqunjie de7a69443a fix:超算概览任务接口调整 2023-05-17 20:43:21 +08:00
qiwang 240f0fcfac fix:创建数据集接口修改 2023-05-17 17:30:39 +08:00
qiwang 876fc52281 fix:查询数据集列表接口修改 2023-05-17 17:17:58 +08:00
qiwang 2c03b013c1 fix:查询算法详情接口修改 2023-05-17 15:25:52 +08:00
qiwang 2464333833 fix:查询列表训练作业和算法接口修改 2023-05-17 15:19:24 +08:00
qiwang bb4d627271 fix:删除训练作业和算法接口修改 2023-05-17 15:16:17 +08:00
qiwang 71cbe2c7ce fix:创建训练作业和创建算法接口修改 2023-05-17 11:26:47 +08:00
qiwang b242bc2ed7 Merge remote-tracking branch 'origin/2.0' into 2.0 2023-05-16 17:04:07 +08:00
qiwang 546c6a7db9 fix:获取训练作业支持的AI预置框架 2023-05-16 17:03:50 +08:00
zhouqunjie 95fdd3e217 feature:add column hubCode for centerOverview 2023-05-16 15:30:43 +08:00
qiwang aaf29aa556 fix:查询获取训练作业支持的公共规格接口 2023-05-16 14:46:33 +08:00
qiwang 732d429122 fix:查询获取训练作业支持的公共规格接口 2023-05-16 12:48:24 +08:00
qiwang a6f7ec5a54 fix:创建训练作业(融合南京和华为接口)调试完成 2023-05-16 10:31:26 +08:00
zhangwei f9940003dc core-api端口号修改 2023-05-16 09:57:27 +08:00
devad d999bbc23e fix: pcm-core service改成配置NodePort
Signed-off-by: devad <cossjie@foxmail.com>
2023-05-16 09:49:56 +08:00
zhangwei 8398798a0d 提交任务接口添加json形式 2023-05-16 09:36:49 +08:00
qiwang 26b20d6f99 fix:提交南京和华为融合的modelarts代码 2023-05-15 10:50:30 +08:00
张威 f58ef1f91f 配置上传到nacos 2023-05-14 10:46:55 +08:00
tzwang 024d983ce6 modelarts notebook接口调整 2023-05-13 20:18:17 +08:00
zhangwei 62a00d79d8 镜像管理初步完成 2023-05-13 16:17:56 +08:00
894646498@qq.com 156bfc9f20 nacos集成 2023-04-21 17:19:42 +08:00
718 changed files with 51382 additions and 65397 deletions

107
.devops/api.yml Normal file
View File

@ -0,0 +1,107 @@
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: nacos_host
name: nacos_host
value: '"10.206.0.12"'
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/jcce-pcm/pcm-coordinator.git"'
ref: '"refs/heads/JCOS"'
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
NACOS_HOST: global.nacos_host
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
- sed -i "s#nacos_host#${NACOS_HOST}#" ${PROJECT_NAME}.yaml
- cat ${PROJECT_NAME}.yaml
needs:
- git_clone_0

107
.devops/rpc.yml Normal file
View File

@ -0,0 +1,107 @@
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: nacos_host
name: nacos_host
value: '"10.206.0.12"'
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/jcce-pcm/pcm-coordinator.git"'
ref: '"refs/heads/JCOS"'
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
NACOS_HOST: global.nacos_host
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
- sed -i "s#nacos_host#${NACOS_HOST}#" ${PROJECT_NAME}.yaml
- cat ${PROJECT_NAME}.yaml
needs:
- git_clone_0

6
.gitignore vendored
View File

@ -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
View File

@ -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 LicenseVersion 2
http://www.apache.org/licenses/LICENSE-2.0
Mulan Permissive Software LicenseVersion 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 ITS 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 LicenseVersion 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.

109
README.md
View File

@ -1,43 +1,98 @@
# PCM: Peer Collaboration Mechanism
![PCM](https://www.gitlink.org.cn/images/avatars/Organization/123822?t=1689062058)
<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>
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.
## What is Jointcloud and PCM
![pcm](docs/imges/pcm.png)
&emsp;&emsp;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.
## Requirements
&emsp;&emsp;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.
---
&emsp;&emsp;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.
* Linux amd64
## Real-world Issues Addressed by PCM:
* [Slurm-2-6-9-1](https://github.com/SchedMD/slurm/archive/refs/tags/slurm-2-6-9-1.tar.gz)
- **Performance Improvement**:
* [Go](https://go.dev/) 1.19 or higher
* [GCC](https://gcc.gnu.org/) 4.8.5 or higher
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**:
## Quick Start
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.
---
- **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.
- **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.
## Architecture
&emsp;&emsp;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架构](docs/images/arch-eng.png)
## 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:
```
# clone
git clone https://gitlink.org.cn/JCCE/PCM.git
# get required packages
go mod tidy
# 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 &
git clone https://gitlink.org.cn/jcce-pcm/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.
&emsp;&emsp;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.
```
# get required packages
go mod tidy
# run rpc service
go run pcm-coordinator/rpc/pcmcore.go
```
#### coordinator-api
&emsp;&emsp;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.
```
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
```
&emsp;&emsp;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.
```
# 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
## JoinContribute
&emsp;&emsp;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.

View File

@ -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

View File

@ -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
}

View File

@ -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",
}

View File

@ -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...)
}

View File

@ -1,7 +0,0 @@
package config
import "github.com/zeromicro/go-zero/zrpc"
type Config struct {
zrpc.RpcServerConf
}

View File

@ -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)
}

View File

@ -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,
}
}

View File

@ -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

View File

@ -1,2 +0,0 @@
rpc-gen:
goctl rpc protoc ./pb/*.proto --go_out=./ --go-grpc_out=./ --zrpc_out=.

View File

@ -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

View File

@ -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
}

View File

@ -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"`
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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)
}

View File

@ -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

View File

@ -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

View File

@ -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()
}

View File

@ -1,2 +0,0 @@
rpc-gen:
goctl rpc protoc ./pb/*.proto --go_out=./ --go-grpc_out=./ --zrpc_out=.

View File

@ -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

View File

@ -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"`
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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)
}

View File

@ -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)),
}
}

View File

@ -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

View File

@ -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",
}

View File

@ -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...)
}

View File

@ -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
}

View File

@ -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

View File

@ -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-nudt1-鹏城
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:已经删除
}
)

View File

@ -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"`
}
)

View File

@ -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)
}

View File

@ -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*************************/

View File

@ -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

View File

@ -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
}

View File

@ -1,28 +0,0 @@
package ai
import (
"net/http"
"PCM/adaptor/PCM-CORE/api/internal/logic/ai"
"PCM/adaptor/PCM-CORE/api/internal/svc"
"PCM/adaptor/PCM-CORE/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func CreateAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateAlgorithmReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewCreateAlgorithmLogic(r.Context(), svcCtx)
resp, err := l.CreateAlgorithm(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -1,28 +0,0 @@
package ai
import (
"net/http"
"PCM/adaptor/PCM-CORE/api/internal/logic/ai"
"PCM/adaptor/PCM-CORE/api/internal/svc"
"PCM/adaptor/PCM-CORE/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func CreateDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateDataSetReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewCreateDataSetLogic(r.Context(), svcCtx)
resp, err := l.CreateDataSet(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -1,28 +0,0 @@
package ai
import (
"net/http"
"PCM/adaptor/PCM-CORE/api/internal/logic/ai"
"PCM/adaptor/PCM-CORE/api/internal/svc"
"PCM/adaptor/PCM-CORE/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func CreateExportTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateExportTaskReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewCreateExportTaskLogic(r.Context(), svcCtx)
resp, err := l.CreateExportTask(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -1,28 +0,0 @@
package ai
import (
"net/http"
"PCM/adaptor/PCM-CORE/api/internal/logic/ai"
"PCM/adaptor/PCM-CORE/api/internal/svc"
"PCM/adaptor/PCM-CORE/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func CreateNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateNotebookReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewCreateNotebookLogic(r.Context(), svcCtx)
resp, err := l.CreateNotebook(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -1,28 +0,0 @@
package ai
import (
"net/http"
"PCM/adaptor/PCM-CORE/api/internal/logic/ai"
"PCM/adaptor/PCM-CORE/api/internal/svc"
"PCM/adaptor/PCM-CORE/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func CreateProcessorTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateProcessorTaskReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewCreateProcessorTaskLogic(r.Context(), svcCtx)
resp, err := l.CreateProcessorTask(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -1,28 +0,0 @@
package ai
import (
"net/http"
"PCM/adaptor/PCM-CORE/api/internal/logic/ai"
"PCM/adaptor/PCM-CORE/api/internal/svc"
"PCM/adaptor/PCM-CORE/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func CreateServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateServiceReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewCreateServiceLogic(r.Context(), svcCtx)
resp, err := l.CreateService(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

Some files were not shown because too many files have changed in this diff Show More