Compare commits

..

38 Commits

Author SHA1 Message Date
tzwang e39e2e78ae refactor: delete .devops/xjlab-rpc.yml
Former-commit-id: 8d63eba2f42b916d3be4c87c758ae04a0e58a8c7
2024-07-27 07:10:47 +00:00
zhangweiii c240f48a9b Merge pull request 'hashcat' (#39) from zhangweiii/pcm-coordinator:v0.1.0-xjlab-alpha1 into v0.1.0-xjlab-alpha1
Former-commit-id: 84bf749acf0e04b737605860b35c499761dbab93
2024-03-06 15:22:59 +08:00
zhangwei 94a9154011 hashcat Crack Progress
Former-commit-id: d4ffb11a013d34f2ab9ea2fe8e4b412a58db2f12
2024-03-06 15:20:01 +08:00
zhangwei 7cc3ebdf55 hashcat Crack Progress
Former-commit-id: d3a55c66825a25684102ef5e2361d8ac864f80b1
2024-03-06 15:04:09 +08:00
zhangweiii 01fca333d9 Merge pull request 'hashcat' (#32) from zhangweiii/pcm-coordinator:v0.1.0-xjlab-alpha1 into v0.1.0-xjlab-alpha1
Former-commit-id: 5cccf59c08402261b863dc65c005d0065df02579
2024-02-29 17:39:46 +08:00
zhangwei 72d29eccff hashcat
Former-commit-id: 63709a57586d197b727400ffce74260281d3a246
2024-02-29 17:36:16 +08:00
zhangweiii 16b55c27b8 Merge pull request 'Modify the input parameter information of some interfaces, and some fields are not required.' (#16) from zhangweiii/pcm-coordinator:v0.1.0-xjlab-alpha1 into v0.1.0-xjlab-alpha1
Former-commit-id: b2d328e8f0a858321df8cf3a55f835b54b2daea2
2024-01-30 09:52:09 +08:00
zhangwei 1631dc2042 Modify the input parameter information of some interfaces, and some fields are not required.
Former-commit-id: 1909b103840b716894c8749e5bcbac13d81ecd06
2024-01-30 09:47:41 +08:00
devad ed5be1c6a5 Fix ci/cd bug
Former-commit-id: c71f4288f56c220fcb2096657207570078993f53
2024-01-24 11:22:19 +08:00
zhangweiii 39e8759eab Merge pull request 'Resource Center Data Display' (#9) from zhangweiii/pcm-coordinator:v0.1.0-xjlab-alpha1 into v0.1.0-xjlab-alpha1
Former-commit-id: a7889f9a572557cc238f96fa76693f5f03a95c92
2024-01-24 11:15:12 +08:00
jagger 5d24fffffa fix: ci/cd bug
Closes #10

Signed-off-by: jagger <cossjie@foxmail.com>

Former-commit-id: e6861b1281fba85d818244a26f8e7391ff735a53
2024-01-24 11:10:28 +08:00
zhangwei 373a347ea6 fix bug
Former-commit-id: 9c7262a85ad9248a248fd231adcdcb76bd7283e6
2024-01-24 09:53:05 +08:00
zhangwei e8a9843dd0 Resource Monitoring
Former-commit-id: 77df78146a1f62018fe384a9ae71711b886b7d00
2024-01-23 17:33:15 +08:00
zw b81e3a7c67 task data statistics
Former-commit-id: 452e9c8d48901f5cedb6dd71423a1a8794a38f4a
2024-01-22 23:43:58 +08:00
zhangwei 94bc201d64 数据库连接修改
Former-commit-id: a0f0ba37736c2eb7221e4f693a2ab80b0b4d1187
2024-01-10 09:18:08 +08:00
zhangwei 42dc5c9e78 数据库连接修改
Former-commit-id: 613dff8be7d147969238205b899fd62c57315e75
2024-01-09 12:49:28 +08:00
devad 30398b213f 数据库连接失败终止程序
Signed-off-by: devad <cossjie@foxmail.com>

Former-commit-id: 07434ec796bc7330213f9f06fc506840119c215d
2024-01-09 09:36:28 +08:00
zhangwei 879b35b6a6 分支名称修改
Former-commit-id: a4be0f3f3e58b77e157db862f551b5f3d4f8855c
2024-01-03 16:12:15 +08:00
zhangwei 4d9b7c2083 hashCat展示修改
Former-commit-id: a6ad67b3d6993ab60b8ab62c03a66dc08dd72608
2023-12-14 17:14:43 +08:00
zhangwei 347313fb14 hashCat展示修改
Former-commit-id: 9d8eb73a9398431b66e18415173411b65b6643e0
2023-12-14 17:00:48 +08:00
zhangwei 42fc9e7f39 hashCat保存添加字段
Former-commit-id: 2825ee25444c73b858921076cd5260d2c151608a
2023-12-14 15:06:42 +08:00
zhangwei 28a661dc08 hashCat保存添加字段
Former-commit-id: fd1f09aaf66564d75189a9d12a8750a0192bb4f4
2023-12-14 12:28:59 +08:00
zhangwei 1a022a51a1 Merge remote-tracking branch 'origin/JCOS' into JCOS
Former-commit-id: bcc9e442f8942c4e93add88a630858ba2446ae74
2023-12-13 10:25:44 +08:00
zhangwei 0f6f75b4b5 修改依赖版本
Former-commit-id: 9ee542354384fbb1a4cb63ba95de9060c3469191
2023-12-13 10:25:30 +08:00
devad c452dce02f update Dockerfile
Signed-off-by: devad <cossjie@foxmail.com>

Former-commit-id: 02cd52424377d61eff90a99c7a9508a2214e91df
2023-12-13 08:56:55 +08:00
zw b0282b5bcd 修改配置信息
Former-commit-id: ca562623b920a98997ed6ed85eeec997e51f7c96
2023-12-12 22:54:15 +08:00
zw 7af196767d 修改配置信息
Former-commit-id: 9c748f70a48856f7eec96a58c52f5f6a354c80a4
2023-12-12 22:35:59 +08:00
zhangwei 4425e875d3 添加错误返回
Former-commit-id: a5483133b3006d127cc14c179bf8593389f58a5c
2023-12-12 18:25:24 +08:00
zhangwei 6d6ccd6989 修改配置
Former-commit-id: 35ca35173036f5467f5719a5ab1ae15230db227b
2023-12-12 18:17:35 +08:00
zhangwei 2279a03fe8 修改配置
Former-commit-id: 1a63fdb8a0d001c5e619494c197b1d9f67fafd47
2023-12-12 18:09:40 +08:00
zhangwei d2138044b5 修改配置
Former-commit-id: 97fb1e1ff7eb7010a058392f6f3c028223187136
2023-12-12 17:24:34 +08:00
zhangwei 24b5e02cdd 修改配置
Former-commit-id: 9db37eb26e503c285b24e5cf6ce65d267e1fbcc5
2023-12-12 16:47:58 +08:00
zhangwei 6fa4d198b5 删除无用字段
Former-commit-id: ab05573006b42fec7774c0c1c7bf12b0befed79e
2023-12-12 16:28:37 +08:00
zhangwei 4a1428fa65 删除无用字段
Former-commit-id: 92e6cce35c0193a5d8a6d161ee8391156135667c
2023-12-12 16:20:48 +08:00
zhangwei 767c692a36 sql日志输出
Former-commit-id: eece076749180c55cf5b349ca0fcfd4a1ba8c555
2023-12-12 15:43:25 +08:00
zhangwei 344b8aaf48 修改配置
Former-commit-id: 6c24bf2812d4f15eac35a47056ecc9a2958d81a8
2023-12-12 11:10:23 +08:00
zhangwei febdf409da 移除nacos
Former-commit-id: e14474817f56db006ac29206ac6c9fe7b855d45e
2023-12-12 10:04:50 +08:00
zhangwei 39f5964d40 nacos配置修改
Former-commit-id: aed08e27f6e71a447a6dd2016314695d2d69c574
2023-12-11 16:53:10 +08:00
932 changed files with 20340 additions and 43215 deletions

View File

@ -1,53 +0,0 @@
version: 2
name: aly
description: 发布环境https://comnet.jointcloud.net
global:
concurrent: 1
workflow:
- ref: start
name: 开始
task: start
- ref: end
name: 结束
task: end
needs:
- ssh_cmd_0
- ref: git_clone_0
name: git clone
task: git_clone@1.2.9
input:
remote_url: '"https://gitlink.org.cn/JointCloud/pcm-coordinator.git"'
ref: '"refs/heads/master"'
commit_id: '""'
depth: 1
needs:
- start
- ref: docker_image_build_0
name: docker镜像构建
task: docker_image_build@1.6.0
input:
docker_username: ((aly.docker_user))
docker_password: ((aly.docker_password))
image_name: '"registry.cn-hangzhou.aliyuncs.com/jcce/pcm-core-api"'
image_tag: '"latest"'
registry_address: '"registry.cn-hangzhou.aliyuncs.com"'
docker_file: '"Dockerfile"'
docker_build_path: '"."'
workspace: git_clone_0.git_path
image_clean: true
image_push: true
build_args: '""'
needs:
- git_clone_0
- ref: ssh_cmd_0
name: ssh执行命令
task: ssh_cmd@1.1.1
input:
ssh_private_key: ((aly.ssh_private_key))
ssh_ip: '"47.92.39.128"'
ssh_port: '"22"'
ssh_user: '"root"'
ssh_cmd: '"kubectl rollout restart deployment pcm-core-api -n ns-admin"'
needs:
- docker_image_build_0

99
.devops/xjlab-api.yml Normal file
View File

@ -0,0 +1,99 @@
version: 2
name: xjlab-api
description: ""
global:
concurrent: 1
param:
- ref: deploy_path
name: deploy_path
value: '"pcm-coordinator-api.yaml"'
required: false
type: STRING
hidden: false
- ref: secret_name
name: ""
value: '"jcce-aliyuncs"'
required: false
type: STRING
hidden: false
- ref: project_name
name: ""
value: '"pcm-coordinator-api"'
required: false
type: STRING
hidden: false
trigger:
webhook: gitlink@1.0.0
event:
- ref: create_tag
ruleset:
- param-ref: tag
operator: EQ
value: '""'
ruleset-operator: AND
workflow:
- ref: start
name: 开始
task: start
- ref: git_clone_0
name: git clone
task: git_clone@1.2.6
input:
remote_url: '"https://gitlink.org.cn/JointCloud/pcm-coordinator.git"'
ref: '"refs/heads/v0.1.0-xjlab-alpha1"'
commit_id: '""'
depth: 1
needs:
- start
- ref: docker_image_build_0
name: docker镜像构建
task: docker_image_build@1.6.0
input:
docker_username: ((dev.docker_user))
docker_password: ((dev.docker_password))
image_name: '"registry.cn-hangzhou.aliyuncs.com/jcce/pcm-coordinator-api"'
image_tag: git_clone_0.commit_time
registry_address: '"registry.cn-hangzhou.aliyuncs.com"'
docker_file: git_clone_0.git_path + '/api/Dockerfile'
docker_build_path: git_clone_0.git_path
workspace: git_clone_0.git_path
image_clean: true
image_push: true
build_args: '""'
needs:
- shell_0
- ref: end
name: 结束
task: end
needs:
- kubectl_deploy_0
- ref: kubectl_deploy_0
name: kubectl部署资源
task: kubectl_deploy@1.1.0
input:
command: '"apply"'
resource_file_path: git_clone_0.git_path + '/api'
certificate_authority_data: ((dev.k8s_cad))
server: '"https://119.45.100.73:6443"'
client_certificate_data: ((dev.k8s_ccd))
client_key_data: ((dev.k8s_ckd))
hosts: '""'
needs:
- docker_image_build_0
- ref: shell_0
name: shell
image: docker.jianmuhub.com/library/debian:buster-slim
env:
IMAGE_NAME: '"registry.cn-hangzhou.aliyuncs.com/jcce/pcm-coordinator-api"'
IMAGE_TAG: git_clone_0.commit_time
SECRET_NAME: global.secret_name
PROJECT_NAME: global.project_name
PROJECT_PATH: git_clone_0.git_path
script:
- cd ${PROJECT_PATH}/api
- sed -i "s#image_name#${IMAGE_NAME}:${IMAGE_TAG}#" ${PROJECT_NAME}.yaml
- sed -i "s#secret_name#${SECRET_NAME}#" ${PROJECT_NAME}.yaml
- cat ${PROJECT_NAME}.yaml
needs:
- git_clone_0

View File

@ -1,65 +0,0 @@
version: 2
name: 阿里云
description: ""
global:
concurrent: 1
param:
- ref: ssh_host
name: ""
value: '"47.92.39.128"'
required: false
type: STRING
hidden: true
- ref: ssh_user
name: ""
value: '"root"'
required: false
type: STRING
hidden: true
workflow:
- ref: start
name: 开始
task: start
- ref: end
name: 结束
task: end
needs:
- ssh_cmd_0
- ref: git_clone_0
name: git clone
task: git_clone@1.2.9
input:
remote_url: '"https://gitlink.org.cn/JointCloud/pcm-coordinator.git"'
ref: '"refs/heads/master"'
commit_id: '""'
depth: 1
needs:
- start
- ref: docker_image_build_0
name: docker镜像构建
task: docker_image_build@1.6.0
input:
docker_username: ((aly.docker_user))
docker_password: ((aly.docker_password))
image_name: '"registry.cn-hangzhou.aliyuncs.com/jcce/pcm-core-api"'
image_tag: '"latest"'
registry_address: '"registry.cn-hangzhou.aliyuncs.com"'
docker_file: '"Dockerfile"'
docker_build_path: git_clone_0.git_path
workspace: git_clone_0.git_path
image_push: true
build_args: '""'
needs:
- git_clone_0
- ref: ssh_cmd_0
name: ssh执行命令
task: ssh_cmd@1.1.1
input:
ssh_private_key: ((aly.ssh_private_key))
ssh_ip: global.ssh_host
ssh_port: '"22"'
ssh_user: global.ssh_user
ssh_cmd: '"kubectl rollout restart deployment pcm-core-api -n ns-admin"'
needs:
- docker_image_build_0

View File

@ -1,54 +0,0 @@
name: Docker
on:
push:
branches: [ "master" ]
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "master" ]
workflow_dispatch: # 允许手动触发
env:
REGISTRY: registry.cn-hangzhou.aliyuncs.com # 修改为你的阿里云镜像仓库地址
IMAGE_NAME: jcce/pcm-core-api # 修改为你的阿里云镜像仓库名称
IMAGE_TAG: latest
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.ALIYUN_USERNAME }}
password: ${{ secrets.ALIYUN_PASSWORD }}
- name: Build and push multi-arch image
run: |
docker buildx build --platform linux/amd64,linux/arm64 -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} --push .
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- name: SSH to remote server and restart deployment
if: github.event_name != 'pull_request'
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "kubectl rollout restart deployment ${{ secrets.SSH_DEPLOYMENT }} -n ${{ secrets.SSH_NAMESPACE }}"

View File

@ -1,26 +0,0 @@
name: Sync Mirror Repository
on:
schedule:
- cron: '0 */8 * * *' # 每小时同步一次
workflow_dispatch: # 允许手动触发
jobs:
mirror:
runs-on: ubuntu-latest
timeout-minutes: 10 # 设置作业的超时时间为10分钟
steps:
- name: Checkout target repository
uses: actions/checkout@v2
with:
fetch-depth: 1 # 获取完整的提交历史
- name: Mirror source repository
uses: wearerequired/git-mirror-action@v1
with:
source-repo: "https://gitlink.org.cn/JointCloud/pcm-coordinator.git" # 源仓库的URL
destination-repo: "git@github.com:${{ github.repository }}.git" # 目标仓库的URL
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}

5
.gitignore vendored
View File

@ -13,6 +13,9 @@ PCM
*.out *.out
coverage.txt coverage.txt
# Dependency directories (remove the comment below to include it)
vendor/
# buf for protobuf # buf for protobuf
buf.lock buf.lock
@ -24,5 +27,5 @@ buf.lock
configs/tenanter.yaml configs/tenanter.yaml
log/ log/
/go_build_gitlink_org_cn_JCCE_PCM
/cache/ /cache/
/vendor/

View File

@ -1,29 +0,0 @@
FROM --platform=$BUILDPLATFORM golang:alpine AS builder
WORKDIR /app
COPY . .
ENV GO111MODULE=on GOPROXY=https://goproxy.cn,direct
RUN go mod download
ARG TARGETOS
ARG TARGETARCH
# 使用 GOOS 和 GOARCH 环境变量来构建不同架构的二进制文件
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="-w -s" -o pcm-core-api
FROM --platform=$TARGETPLATFORM alpine:latest
WORKDIR /app
#修改alpine源为上海交通大学
RUN apk add --no-cache ca-certificates && update-ca-certificates && \
apk add --update tzdata && \
rm -rf /var/cache/apk/*
COPY --from=builder /app/pcm-core-api .
COPY --from=builder /app/etc/pcm.yaml .
ENV TZ=Asia/Shanghai
EXPOSE 8999
ENTRYPOINT ./pcm-core-api --f pcm.yaml

View File

@ -1,8 +1,21 @@
api-gen: pcm-core-api:
goctl api go -api desc/pcm.api -dir . -style gozero --home ../deploy/goctl CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-core-api adaptor/PCM-CORE/api/pcm.go
Generate-AMD64: pcm-core-rpc:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-coordinator-api pcm.go CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-core-rpc adaptor/PCM-CORE/rpc/pcmcore.go
Generate-ARM64: pcm-ac-rpc:
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -o pcm-coordinator-api pcm.go CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-ac adaptor/PCM-HPC/PCM-AC/rpc/hpcac.go
pcm-kubenative-rpc:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-kubenative adaptor/PCM-K8S/PCM-K8S-NATIVE/rpc/pcmkubenative.go
pcm-modelarts-rpc:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-modelarts adaptor/PCM-AI/PCM-MODELARTS/rpc/pcmmodelarts.go
pcm-ceph-rpc:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-ceph adaptor/PCM-STORAGE/PCM-CEPH/rpc/pcmceph.go
all-build: pcm-core-rpc pcm-core-api pcm-ac-rpc pcm-kubenative-rpc pcm-modelarts-rpc pcm-ceph-rpc
.PHONY: pcm-core-rpc pcm-core-api pcm-ac-rpc pcm-kubenative-rpc pcm-modelarts-rpc pcm-ceph-rpc

126
README.md
View File

@ -1,84 +1,94 @@
<div style="text-align:center"> ![PCM](https://www.gitlink.org.cn/images/avatars/Organization/123822?t=1689062058)
<img src="https://www.gitlink.org.cn/images/avatars/Organization/123822?t=1689062058" alt="PCM" style="float:center" /> jointcloud云际团队正式发布PCM对等协作框架框架包含了kubernan核心组件源代码、8个participant协作者组件仓库以及PCM中定义的超算、智算、数算资源操作及信息收集规格。
</div>
<p align="center">
<a href="https://www.gitlink.org.cn/JointCloud/pcm-coordinator/tree/master/docs">Docs</a> |
<a href="https://www.gitlink.org.cn/JointCloud/pcm-coordinator/tree/master/docs">简体中文</a> |
<a href="https://www.gitlink.org.cn/JointCloud/pcm-coordinator/milestones">Milestones</a>
</p>
## What is Jointcloud and PCM ## 什么是Jointcloud和PCM
  云际协作环境 (JointCloud cooperation environment, JCCE), JCCE 包括分布云交易、分布云社区、分布云监管以及基于区块链的分布记账系统, JCCE 中与信息交换尤其是价值交换相关的支撑技术, 利于打破云际协作参与方之间的信息不对称, 为参与各方创造多赢机会, 实现对云际计算商业模式创新的强有力支撑。
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.   对等协作机制(peer cooperation mechanism, PCM)的愿景是在云际环境中构建一套所有服务提供方和需求方能够自主参与协作实现对等交易以非侵入的方式实现各利益主体间便捷高效的连接和调用并在构建云际生态的同时形成行业标准吸引更多云际服务商加入贡献。PCM站在云上视角叠加于云之上关注云之间协作多于云自身。
  对等协作机制建立在一个标准的软件定义框架之上按照这个标准框架拥有物理云资源的云服务提供者可以自主定义PCM规则框架其他遵循该规则框架的实体云即可参与协作交易并进而面向领域应用定制虚拟专用云满足各类云际参与者如中心侧、边缘侧和终端侧等异构基础设施资源直接自主参与协作和交易的需求。
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.
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.
## Real-world Issues Addressed by PCM:
- **Performance Improvement**
Developers in the cloud collaboration environment experience performance enhancement upon joining the PCM framework. They can generate code for the internal functionality structure and most specification definitions using descriptive language, allowing them to focus on business logic development without concerning themselves with underlying management functions. The framework offers features such as microservices management, multi-language code generation, and model bridging, reducing coding workload and entry barriers while improving efficiency.
- **Platform Lock-in Resolution** ## PCM力求解决的现实问题
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.
- **效能提升**:
  云际开发者加入PCM框架后可以通过描述性语言生成框架内部功能结构的代码和大部分规格定义专注于业务逻辑开发无需关心底层管理功能。框架提供微服务管理、多语言代码生成和模型桥接功能可降低编码工作量和入门难度提高能效。
- **解决平台锁定问题**:
  对等协作机制通过多云适配、标准化接口和抽象层等手段,有效解决平台锁定问题,实现跨平台运行、部署和交互。标准化接口简化开发人员工作,降低平台锁定风险。
- **降低代码开发难度**:
  对等协作开发框架降低了开发难度提供了结构化开发模式、现成组件和文档支持不同级别开发人员能更公平地协同工作。框架可节省约50%的开发时间初级程序员用约15人天完成原需1人月的任务。自动生成工具、代码模板和组件复用等功能让开发者更专注于业务逻辑实现。无需再培训高级开发人员可节省时间和人力资源成本提高投入产出比。
- **减少代码开发工作量**:
  PCM框架提供自动化功能和代码生成工具减少手动编写代码提高开发速度和代码质量。使用框架的自动生成工具后整体代码量超过一半由工具生成低代码率达到约63%。开发者主要工作是编写描述语言文件生成基础结构,然后调整和编写逻辑功能的开发。这使团队能更快速敏捷地交付产品并进行业务优化和用户反馈迭代。
- **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. Kubernan是框架的核心组件实现了对不同Participant端技术栈的异构屏蔽。框架面向用户侧主要分为资源变更任务提交和集约展示两大功能。在任务提交后PCM通过架设在云算云、智算云、超算云之上的调度中心来实现任务的动态流转。在集约展示部分PCM主要通过Tracker以及P端主动上报的方式对多个Participant服务的资源、任务等信息进行收集和汇聚向用户提供标准化的统一接口。用户可以在前端页面上查看PCM提供的信息也可以通过接口直接获取数据。
![PCM架构](docs/images/img.png)
## 服务部署
  PCM的开发环境需要安装golang 1.18以上版本参考下文内容将会在本地启动kubernan的相关服务。
  拉取项目的命令如下
  
`git clone https://gitlink.org.cn/jcce-pcm/pcm-coordinator.git`
- **Reduced Code Development Workload** #### nacos
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.   配置管理采用nacos用户需要在本地或服务器上安装部署nacos服务对应教程可以参考[nacos安装](https://nacos.io/en-us/docs/quick-start.html)nacos中添加对应服务的配置文件具体配置内容参考下文。
#### kubernan-rpc
  rpc服务的配置内容模板如下
## Architecture
The Coordinator is the core component of the framework, providing heterogeneous abstraction for different Participant-side technology stacks. The framework, oriented towards the user side, primarily involves two major functionalities: resource changes (task submission) and centralized display. After task submission, PCM achieves dynamic task flow through a scheduling center deployed on cloud computing, intelligent computing, and supercomputing clouds. In the centralized display section, PCM mainly collects and aggregates information about resources and tasks from multiple Participant services through Tracker and actively reported by the Participant side. It provides users with a standardized unified interface. Users can view the information provided by PCM on the frontend page or directly access data through the interface.
![PCM架构](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:
```bash
git clone https://gitlink.org.cn/JointCloud/pcm-coordinator.git
``` ```
Name: pcm.core.rpc
ListenOn: 0.0.0.0:2004
DB:
DataSource: username:password@(x.x.x.x:3306)/pcm?parseTime=true
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. SnowflakeConf:
``` bash MachineId: 1
```
  运行以下命令后将会在本地启动kubernan-rpc服务其具体功能可参考上文架构设计中的描述。
```
# get required packages # get required packages
go mod tidy go mod tidy
# run rpc service # run rpc service
go run pcm-coordinator/rpc/pcmcore.go go run pcm-coordinator/rpc/pcmcore.go
``` ```
#### coordinator-api #### kubernan-api
The template for the configuration content of the API service is as follows, where the config information for each Participant (P-side) can be configured as needed based on the actual situation.   api服务的配置内容模板如下其中各P端的config信息可以根据实际情况按需配置。
``` bash ```
Name: pcm.core.api Name: pcm.core.api
Host: 0.0.0.0 Host: 0.0.0.0
Port: 8999 Port: 8999
DB: DB:
DataSource: username:password@(x.x.x.x:3306)/pcm?parseTime=true Redis: DataSource: username:password@(x.x.x.x:3306)/pcm?parseTime=true
Host: x.x.x.x:portnumber Pass: password
Redis:
Host: x.x.x.x:portnumber
Pass: password
# k8s rpc # k8s rpc
K8sNativeConf: K8sNativeConf:
Endpoints: - 127.0.0.1:2003 NonBlock: true Endpoints:
- 127.0.0.1:2003
NonBlock: true
#slurm rpc #slurm rpc
THRpcConf: THRpcConf:
Endpoints: - 127.0.0.1:2007NonBlock: true Endpoints:
- 127.0.0.1:2007
NonBlock: true
#modelarts rpc #modelarts rpc
ModelArtsRpcConf: ModelArtsRpcConf:
Endpoints: - 127.0.0.1:2002NonBlock: true Endpoints:
- 127.0.0.1:2002
NonBlock: true
```
  运行以下命令后将会在本地启动kubernan-api服务服务启动后用户将可以通过http请求其接口进行各类功能调用。
``` ```
After executing the following command, the Kubernetes API service will be launched locally. Once the service is started, users can make HTTP requests to its interfaces for various functional calls.
``` bash
# get required packages # get required packages
go mod tidy go mod tidy
@ -86,12 +96,12 @@ go mod tidy
go run pcm-coordinator/api/pcm.go 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 ## 加入&贡献
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.   我们期待您的意见和贡献,欢迎所有的朋友对项目进行指正和改进,共同打造一套高效稳定的云际协作机制。

40
api/Dockerfile Normal file
View File

@ -0,0 +1,40 @@
FROM golang:1.21.2-alpine3.18 AS builder
LABEL stage=gobuilder
ENV CGO_ENABLED 0
ENV GOARCH amd64
ENV GOPROXY https://goproxy.cn,direct
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.sjtug.sjtu.edu.cn/g' /etc/apk/repositories && \
apk update --no-cache && apk add --no-cache tzdata
WORKDIR /app
ADD go.mod .
ADD go.sum .
RUN go mod download
COPY . .
COPY api/etc/ /app/
RUN go build -o pcm-coordinator-api /app/api/pcm.go
FROM alpine:3.16.2
WORKDIR /app
#修改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 --from=builder /app/pcm-coordinator-api .
COPY api/etc/pcm.yaml .
ENV TZ=Asia/Shanghai
EXPOSE 8999
ENTRYPOINT ./pcm-coordinator-api -f pcm.yaml

8
api/Makefile Normal file
View File

@ -0,0 +1,8 @@
api-gen:
goctl api go -api desc/pcm.api -dir . -style gozero --home ../deploy/goctl
Generate-AMD64:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-coordinator-api pcm-coordinator-api pcm.go
Generate-ARM64:
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -o pcm-coordinator-api pcm.go

View File

@ -720,7 +720,6 @@ type (
Offset int32 `form:"offSet,optional"` Offset int32 `form:"offSet,optional"`
/****************智算类型 ModelartsType parmas ********************/ /****************智算类型 ModelartsType parmas ********************/
ModelArtsType string `form:"modelArtsType,optional"` ModelArtsType string `form:"modelArtsType,optional"`
Platform string `form:"platform,optional"`
} }
) )
type ListServicesResp { type ListServicesResp {
@ -1150,7 +1149,7 @@ type (
ProjectId string `json:"projectId" copier:"ProjectId"` ProjectId string `json:"projectId" copier:"ProjectId"`
Param ListNotebookParam `json:"param,optional" copier:"Param"` Param ListNotebookParam `json:"param,optional" copier:"Param"`
/****************智算类型 ModelartsType parmas ********************/ /****************智算类型 ModelartsType parmas ********************/
Platform string `json:"platform,optional"` ModelArtsType string `json:"modelArtsType,optional"`
} }
ListNotebookResp { ListNotebookResp {
Current int32 `json:"current,omitempty" copier:"Current"` Current int32 `json:"current,omitempty" copier:"Current"`
@ -1206,7 +1205,7 @@ type (
ProjectId string `json:"projectId" copier:"ProjectId"` ProjectId string `json:"projectId" copier:"ProjectId"`
Param StartNotebookParam `json:"param" copier:"Param"` Param StartNotebookParam `json:"param" copier:"Param"`
/****************智算类型 ModelartsType parmas ********************/ /****************智算类型 ModelartsType parmas ********************/
Platform string `json:"platform,optional"` ModelArtsType string `json:"modelArtsType,optional"`
} }
StartNotebookResp { StartNotebookResp {
NotebookResp NotebookResp `json:"notebookResp" copier:"NotebookResp"` NotebookResp NotebookResp `json:"notebookResp" copier:"NotebookResp"`
@ -1698,51 +1697,6 @@ PayloadCreateTrainJob{
jobId string `json:"jobId,optional"` jobId string `json:"jobId,optional"`
} }
********************/ ********************/
/******************Ai Center overview*************************/
CenterOverviewResp {
CenterNum int32 `json:"totalCenters,optional"`
TaskNum int32 `json:"totalTasks,optional"`
CardNum int32 `json:"totalCards,optional"`
PowerInTops float64 `json:"totalPower,optional"`
}
CenterQueueingResp {
Current []*CenterQueue `json:"current,optional"`
History []*CenterQueue `json:"history,optional"`
}
CenterQueue {
Name string `json:"name,optional"`
QueueingNum int32 `json:"num,optional"`
}
CenterListResp {
List []*AiCenter `json:"centerList,optional"`
}
AiCenter {
Name string `json:"name,optional"`
StackName string `json:"stack,optional"`
Version string `json:"version,optional"`
}
CenterTaskListResp {
List []*AiTask `json:"taskList,optional"`
}
AiTask {
Name string `json:"name,optional"`
status string `json:"status,optional"`
Cluster string `json:"cluster,optional"`
Card string `json:"card,optional"`
TimeElapsed int32 `json:"elapsed,optional"`
}
TrainingTaskStatResp {
Running int32 `json:"running"`
Total int32 `json:"total"`
}
) )
/******************create TrainIngJob end*************************/ /******************create TrainIngJob end*************************/
@ -1824,14 +1778,3 @@ service AICore-api {
@handler createVisualizationJobHandler @handler createVisualizationJobHandler
post /CreateVisualizationJob (CreateVisualizationJobReq) returns (CreateVisualizationJobResp) post /CreateVisualizationJob (CreateVisualizationJobReq) returns (CreateVisualizationJobResp)
}*/ }*/
type (
ChatReq{
id uint `json:"id,string"`
Method string `json:"method,optional"`
ReqData map[string]interface{} `json:"reqData"`
}
ChatResult{
Resuluts string `json:"results,optional"`
}
)

View File

@ -0,0 +1,55 @@
syntax = "v1"
info(
title: "cloud core"
desc: "cloud core微服务"
author: "zhangwei"
email: ""
)
/******************find datasetList start*************************/
type ApplyReq {
YamlString string `json:"yamlString" copier:"yamlString"`
}
type DeleteReq {
YamlString string `json:"yamlString" copier:"yamlString"`
}
type ApplyResp {
Code int32 `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
DataSet []DataSet `json:"dataSet,omitempty"`
}
type DeleteResp {
Code int32 `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
Data string `json:"data,omitempty"`
}
type DataSet {
ApiVersion int32 `json:"apiVersion,omitempty"`
Kind string `json:"kind,omitempty"`
Name string `json:"name,omitempty"`
NameSpace string `json:"nameSpace,omitempty"`
}
type cloudListResp {
Clouds []Cloud `json:"clouds"`
}
type Cloud {
Id int64 `json:"id"` // id
TaskId int64 `json:"taskId"` // 任务id
ParticipantId int64 `json:"participantId"` // 集群静态信息id
ApiVersion string `json:"apiVersion"`
Name string `json:"name"` // 名称
Namespace string `json:"namespace"` // 命名空间
Kind string `json:"kind"` // 种类
Status string `json:"status"` // 状态
StartTime string `json:"startTime"` // 开始时间
RunningTime int64 `json:"runningTime"` // 运行时长
CreatedBy int64 `json:"createdBy"` // 创建人
CreatedTime string `json:"createdTime"` // 创建时间
Result string `json:"result"`
}

646
api/desc/core/pcm-core.api Normal file
View File

@ -0,0 +1,646 @@
syntax = "v1"
info(
title: "gateway"
desc: "gateway端微服务"
author: "zhouqj"
email: "450705171@qq.com"
)
type (
resourceCenterInfoReq {
participantId int64 `path:"participantId"`
}
resourceCenterInfoResp {
tasksName []string `json:"tasksName"`
runningTasksNum int64 `json:"runningTasksNum"`
resourceUsage ResourceUsage `json:"resourceUsage"`
resourceTotal ResourceTotal `json:"resourceTotal"`
}
ResourceUsage {
cpu float64 `json:"cpu"`
memory float64 `json:"memory"`
storage float64 `json:"storage"`
}
ResourceTotal {
cpu int64 `json:"cpu"`
memory int64 `json:"memory"`
storage int64 `json:"storage"`
}
)
type (
tasksNumReq {
}
tasksNumResp {
totalNum int64 `json:"totalNum"`
runningNum int64 `json:"runningNum"`
completedNum int64 `json:"completedNum"`
}
)
type (
tasksNumReq {
}
tasksNumResp {
totalNum int64 `json:"totalNum"`
runningNum int64 `json:"runningNum"`
completedNum int64 `json:"completedNum"`
}
)
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 int32 `json:"code"`
Msg string `json:"msg"`
Data RegionNum `json:"data"`
}
RegionNum {
RegionSum int64 `json:"regionSum"`
SoftStackSum int64 `json:"softStackSum"`
}
)
type (
listRegionResp {
Code int32 `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 deleteTaskReq {
Id int64 `path:"id"`
}
type (
scheduleTaskByYamlReq {
Name string `yaml:"name"`
Description string `yaml:"description"`
tenantId int64 `yaml:"tenantId"`
tasks []TaskYaml `yaml:"tasks"`
}
TaskYaml {
TaskId int64 `yaml:"taskId"`
taskType string `yaml:"taskType"`
participantId int64 `yaml:"participantId"`
matchLabels map[string]string `yaml:"matchLabels"`
metadata interface{} `yaml:"metadata"`
}
)
type (
commitHpcTaskReq {
Name string `json:"name"`
Description string `json:"description,optional"`
tenantId int64 `json:"tenantId,optional"`
TaskId int64 `json:"taskId,optional"`
participantId int64 `json:"participantId,optional"`
matchLabels map[string]string `json:"matchLabels,optional"`
cardCount int64 `json:"cardCount,optional"`
workDir string `json:"workDir,optional"`
wallTime string `json:"wallTime,optional"`
cmdScript string `json:"cmdScript,optional"`
appType string `json:"appType,optional"`
appName string `json:"appName,optional"`
queue string `json:"queue,optional"`
nNode string `json:"nNode,optional"`
submitType string `json:"submitType,optional"`
stdOutFile string `json:"stdOutFile,optional"`
stdErrFile string `json:"stdErrFile,optional"`
stdInput string `json:"stdInput,optional"`
environment map[string]string `json:"environment,optional"`
}
)
type (
commitHpcTaskResp {
TaskId int64 `json:"taskId"`
}
)
type (
scheduleTaskByYamlResp {
TaskId int64 `json:"taskId"`
}
)
type (
scheduleTaskReq {
Name string `json:"name"`
synergy string `json:"synergy"`
Description string `json:"description"`
strategy string `json:"strategy"`
tasks []TaskInfo `json:"tasks"`
}
TaskInfo {
TaskId int64 `json:"taskId,optional"`
TaskType string `json:"taskType,optional"`
matchLabels map[string]string `json:"matchLabels"`
participantId int64 `json:"participantId"`
metadata interface{} `json:"metadata"`
}
)
type (
jobTotalResp {
AllCardRunTime float64 `json:"allCardRunTime"`
AllJobCount float64 `json:"allJobCount"`
AllJobRunTime float64 `json:"allJobRunTime"`
TrainJobs []TrainJob `json:"trainJobs"`
}
TrainJob {
Name string `json:"name"`
Status string `json:"status"`
ParticipantName string `json:"participantName"`
SynergyStatus string `json:"synergyStatus"`
Strategy int `json:"strategy"`
}
)
// 任务列表参数
type (
taskListReq {
PageNum int `form:"pageNum"`
PageSize int `form:"pageSize"`
}
taskListResp {
TotalCount int64 `json:"totalCount"` // 任务总数
NormalCount int64 `json:"normalCount"` // 正常任务数
AlarmCount int64 `json:"alarmCount"` // 任务告警数
Tasks []Task `json:"tasks"`
}
Task {
Id int64 `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
TaskType string `json:"taskType"`
StartTime string `json:"startTime"`
EndTime string `json:"endTime"`
ParticipantStatus string `json:"participantStatus"`
ParticipantId int64 `json:"participantId"`
ParticipantName string `json:"participantName"`
}
)
// 任务列表参数
type (
taskDetailReq {
TaskId int64 `path:"taskId"`
}
taskDetailResp {
CpuCores float64 `json:"cpuCores"`
CpuRate float64 `json:"cpuRate"`
CpuLimit float64 `json:"cpuLimit"`
GpuCores float64 `json:"gpuCores"`
GpuRate float64 `json:"gpuRate"`
GpuLimit float64 `json:"gpuLimit"`
MemoryTotal float64 `json:"memoryTotal"`
MemoryRate float64 `json:"memoryRate"`
MemoryLimit float64 `json:"memoryLimit"`
}
)
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"`
HubCode int64 `json:"hubCode"`
}
)
type (
listClusterReq {
CenterId int32 `path:"centerId"`
}
listClusterResp {
Code int32 `json:"code"`
Msg string `json:"msg"`
Data ClusterData `json:"data"`
}
ClusterData {
TotalCount int `json:"totalCount"`
Clusters []ComputeCluster `json:"clusters"`
}
ComputeCluster {
Id int64 `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
JcceDomainId int64 `json:"jcceDomainId"`
JcceDomainName string `json:"jcceDomainName"`
Longitude float64 `json:"longitude"`
Latitude float64 `json:"latitude"`
Description string `json:"description"`
}
)
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:"domainId"` // 资源域id
DomainName string `json:"domainName"` // 资源域名称
JobCount int64 `json:"jobCount"` // 资源域任务数量
DomainSource int64 `json:"domainSource"` // 资源域数据来源0-nudt1-鹏城
Stack string `json:"stack"` // 技术栈
ResourceType string `json:"resourceType"` // 资源类型
Cpu float64 `json:"cpu"` // cpu使用率
Memory float64 `json:"memory"` // 内存使用率
Disk float64 `json:"disk"` // 存储使用率
NodeCount float64 `json:"nodeCount"` //节点使用率
// DeleteFlag int64 `json:"delete_flag"` // 是否删除 0:未删除1:已经删除
Description string `json:"description"` //集群描述
ClusterName string `json:"clusterName"` //集群名称
CpuTotal float64 `json:"cpuTotal"` //cpu总核数
MemoryTotal float64 `json:"memoryTotal"` //内存总量Gi
DiskTotal float64 `json:"diskTotal"` //存储总量GB
NodeTotal float64 `json:"nodeTotal"` //容器节点数
CpuUsage float64 `json:"cpuUsage"` //cpu已使用核数
MemoryUsage float64 `json:"memoryUsage"` //内存已使用Gi
DiskUsage float64 `json:"diskUsage"` //存储已使用GB
NodeUsage float64 `json:"nodeUsage"` //容器节点已使用
}
)
type (
ResourcePanelConfigReq {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
TitleColor string `json:"titleColor"` //标题色
MainColor string `json:"mainColor"` //主色调
MainColor2 string `json:"mainColor2"` //次主色调
TextColor string `json:"textColor"` //文字颜色
BackgroundColor string `json:"backgroundColor"` //背景底色
Center string `json:"center"` //中心点
CenterPosition string `json:"centerPosition"` //comment 中心点坐标
ProvinceBgColor string `json:"provinceBgColor"` //三级地图底色
StatusIng string `json:"statusIng"` //接入中图标
StatusUn string `json:"statusUn"` //未接入图标
StatusEnd string `json:"statusEnd"` //已接入图标
TitleIcon string `json:"titleIcon"` //标题底图
SubTitleIcon string `json:"subTitleIcon"` //小标题底图
NumberBg string `json:"numberBg"` //数字底图
TaskBg string `json:"taskBg"` //任务底图
}
ResourcePanelConfigResp {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题,
TitleColor string `json:"titleColor"` //标题色,
MainColor string `json:"mainColor"` //主色调,
MainColor2 string `json:"mainColor2"` //次主色调,
TextColor string `json:"textColor"` //文字颜色,
BackgroundColor string `json:"backgroundColor"` //背景底色,
Center string `json:"center"` //中心点,
CenterPosition string `json:"centerPosition"` //comment 中心点坐标,
ProvinceBgColor string `json:"provinceBgColor"` //三级地图底色,
StatusIng string `json:"statusIng"` //接入中图标,
StatusUn string `json:"statusUn"` //未接入图标,
StatusEnd string `json:"statusEnd"` //已接入图标,
TitleIcon string `json:"titleIcon"` //标题底图,
SubTitleIcon string `json:"subTitleIcon"` //小标题底图,
NumberBg string `json:"numberBg"` //数字底图,
TaskBg string `json:"taskBg"` //任务底图,
CreateTime string `json:"createTime"` //创建时间,
UpdateTime string `json:"updateTime"` //更新时间
}
)
type (
ComputilityStatisticsResp {
Code int32 `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
ErrorMsg string `json:"ErrorMsg,omitempty"`
ComputilityStatistics ComputilityStatistics `json:"data"` //容器节点已使用
}
ComputilityStatistics {
DomainSum int64 `json:"domainSum"` //域总数
TotalComputility float64 `json:"totalComputility"` //算力总和
ClusterNum int64 `json:"clusterNum"` //集群总数
}
)
//jccSchedule容器集群资源监控 > start
type ClusterMetrics struct {
Code int `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
Data []MetricResult `json:"data,omitempty"`
}
type MetricResult struct {
MetricName string `json:"metric_name, omitempty"`
MetricData MetricData `json:"data, omitempty"`
}
type MetricData struct {
Result []map[string]interface{} `json:"result"`
ResultType string `json:"resultType"`
}
type ResultData struct {
Status string `json:"status"`
Data MetricData `json:"data"`
}
type NodeAssetsResp {
NodeAssets []NodeAsset `json:"nodeAssets"`
}
type NodeAsset {
Name string `json:"Name"` //租户名称
NodeName string `json:"NodeName"` // 节点名称
CpuTotal int64 `json:"CpuTotal"` // cpu核数
CpuUsable float64 `json:"CpuUsable"` // cpu可用率
DiskTotal int64 `json:"DiskTotal"` // 磁盘空间
DiskAvail int64 `json:"DiskAvail"` // 磁盘可用空间
MemTotal int64 `json:"MemTotal"` // 内存总数
MemAvail int64 `json:"MemAvail"` // 内存可用数
GpuTotal int64 `json:"GpuTotal"` // gpu总数
GpuAvail int64 `json:"GpuAvail"` // gpu可用数
ParticipantId int64 `json:"ParticipantId"` // 集群动态信息id
}
type crackProgressResp {
crackProgressList []CrackProgress `json:"crackProgressList"`
}
type CrackProgress {
Name string `json:"name"`
Progress string `json:"progress"`
Current string `json:"current"`
Total string `json:"total"`
Speed string `json:"speed"`
}
type SaveHashcatReq {
CrackTaskId string `json:"crackTaskId"` // 任务id
CrackContainerId string `json:"crackContainerId"` // 容器id
CrackStatus string `json:"crackStatus"` // 状态
CrackStartTime string `json:"crackStartTime"` //开始时间
CrackEstimatedTime string `json:"crackEstimatedTime"` // 预计时间
CrackProgress string `json:"crackProgress"` // 进度
CrackResult string `json:"crackResult"` // 结果
Started string `json:"started,optional"` // 开始时间
Stopped string `json:"stopped,optional"` // 结束时间
KernelFeature string `json:"kernelFeature"`
HashMode string `json:"hashMode"`
Rejected string `json:"rejected"`
Session string `json:"session"`
HashTarget string `json:"hashTarget"`
Speed string `json:"speed"`
Candidates string `json:"candidates"`
RestorePoint string `json:"restorePoint"`
Recovered string `json:"recovered"`
GuessQueue string `json:"guessQueue"`
CandidateEngine string `json:"candidateEngine"`
GuessMask string `json:"guessMask"`
RestoreSub string `json:"restoreSub"`
}
type getHashcatHandlerReq {
CrackTaskId string `path:"crackTaskId"` // 任务id
}
type getHashcatHandlerResp {
CrackTaskId string `json:"crackTaskId"` // 任务id
CrackContainerId string `json:"crackContainerId"` // 容器id
CrackStatus string `json:"crackStatus"` // 状态
CrackStartTime string `json:"crackStartTime"` //开始时间
CrackEstimatedTime string `json:"crackEstimatedTime"` // 预计时间
CrackProgress string `json:"crackProgress"` // 进度
CrackResult string `json:"crackResult"` // 结果
Started string `json:"started"` // 开始时间
Stopped string `json:"stopped"` // 结束时间
KernelFeature string `json:"kernelFeature"`
HashMode string `json:"hashMode"`
Rejected string `json:"rejected"`
Session string `json:"session"`
HashTarget string `json:"hashTarget"`
Speed string `json:"speed"`
Candidates string `json:"candidates"`
RestorePoint string `json:"restorePoint"`
Recovered string `json:"recovered"`
GuessQueue string `json:"guessQueue"`
CandidateEngine string `json:"candidateEngine"`
GuessMask string `json:"guessMask"`
RestoreSub string `json:"restoreSub"`
}
type participantListResp {
Participants []Participant `json:"participants"`
}
type Participant {
id int64 `json:"id"`
name string `json:"name"`
address string `json:"address"`
metricsUrl string `json:"metricsUrl"`
tenantName string `json:"tenantName"`
typeName string `json:"typeName"`
}

73
api/desc/hpc/pcm-hpc.api Normal file
View File

@ -0,0 +1,73 @@
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"`
name string `json:"name"`
JobStartTime string `json:"JobStartTime"`
JobRunTime string `json:"JobRunTime"`
StateofJob string `json:"StateofJob"`
}
type (
listJobReq {
}
listJobResp {
Code int32 `json:"code"`
Msg string `json:"msg"`
RecordCount int32 `json:"recordCount"`
Jobs []Job `json:"jobInfos"`
}
)
type HistoryJob {
SlurmVersion string `json:"slurmVersion"`
name string `json:"name"`
JobStartTime string `json:"JobStartTime"`
JobRunTime string `json:"JobRunTime"`
StateofJob string `json:"StateofJob"`
}
type (
listHistoryJobReq {
}
listHistoryJobResp {
Code int32 `json:"code"`
Msg string `json:"msg"`
RecordCount int32 `json:"recordCount"`
HistoryJobs []HistoryJob `json:"jobInfoDbs"`
}
)
type QueueAssetsResp {
QueueAssets []QueueAsset `json:"queueAsset"`
}
type QueueAsset {
TenantName string `json:"tenantName"` //租户名称
ParticipantId int64 `json:"participantId"`
AclHosts string `json:"aclHosts"` // 可用节点,多个节点用逗号隔开
QueNodes string `json:"queNodes"` //队列节点总数
QueMinNodect string `json:"queMinNodect,omitempty"` //队列最小节点数
QueMaxNgpus string `json:"queMaxNgpus,omitempty"` //队列最大GPU卡数
QueMaxPPN string `json:"queMaxPPN,omitempty"` //使用该队列作业最大CPU核心数
QueChargeRate string `json:"queChargeRate,omitempty"` //费率
QueMaxNcpus string `json:"queMaxNcpus,omitempty"` //用户最大可用核心数
QueMaxNdcus string `json:"queMaxNdcus,omitempty"` //队列总DCU卡数
QueueName string `json:"queueName,omitempty"` //队列名称
QueMinNcpus string `json:"queMinNcpus,omitempty"` //队列最小CPU核数
QueFreeNodes string `json:"queFreeNodes,omitempty"` //队列空闲节点数
QueMaxNodect string `json:"queMaxNodect,omitempty"` //队列作业最大节点数
QueMaxGpuPN string `json:"queMaxGpuPN,omitempty"` //队列单作业最大GPU卡数
QueMaxWalltime string `json:"queMaxWalltime,omitempty"` //队列最大运行时间
QueMaxDcuPN string `json:"queMaxDcuPN,omitempty"` //队列单作业最大DCU卡数
QueFreeNcpus string `json:"queFreeNcpus"` //队列空闲cpu数
QueNcpus string `json:"queNcpus"` //队列cpu数
}

519
api/desc/pcm.api Normal file
View File

@ -0,0 +1,519 @@
syntax = "v1"
import (
"core/pcm-core.api"
"hpc/pcm-hpc.api"
"ai/pcm-ai.api"
"storage/pcm-storage.api"
"vm/pcm-vm.api"
"cloud/pcm-cloud.api"
"storelink/pcm-storelink.api"
)
info(
title: "pcm api service"
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 {
@doc "查询P端服务列表"
@handler participantListHandler
get /core/participantList returns (participantListResp)
@doc "yaml提交任务"
@handler scheduleTaskByYamlHandler
post /core/scheduleTaskByYaml (scheduleTaskByYamlReq) returns (scheduleTaskByYamlResp)
@doc "提交超算任务"
@handler commitHpcTaskHandler
post /core/commitHpcTask (commitHpcTaskReq) returns (commitHpcTaskResp)
@doc "删除任务"
@handler deleteTaskHandler
delete /core/deleteTask/:id (deleteTaskReq)
@doc "查询任务列表"
@handler TaskListHandler
get /core/taskList (taskListReq) returns (taskListResp)
@doc "查询任务详情"
@handler TaskDetailHandler
get /core/taskDetail/:taskId (taskDetailReq) returns (taskDetailResp)
@doc "任务概览"
@handler JobTotalHandler
get /core/jobTotal returns (jobTotalResp)
@doc "数据中心概览"
@handler listCenterHandler
get /core/listCenter returns (listCenterResp)
@doc "查询集群列表"
@handler listClusterHandler
get /core/listCluster/:centerId (listClusterReq) returns (listClusterResp)
@doc "提交任务(超算)"
@handler submitJobHandler
post /core/submitJob (submitJobReq) returns (submitJobResp)
@doc "获取region"
@handler getRegionHandler
get /core/getRegion returns (getRegionResp)
@doc "获取region列表"
@handler listRegionHandler
get /core/listRegion returns (listRegionResp)
@doc "查询算力"
@handler getComputingPowerHandler
get /core/getComputingPower returns (cpResp)
@doc "查询通用信息"
@handler getGeneralInfoHandler
get /core/getGeneralInfo returns (GiResp)
@doc "查询各域资源信息"
@handler listDomainResourceHandler
get /core/listDomainResource returns (DomainResourceResp)
@doc "查询控制面板配置信息"
@handler getResourcePanelConfigHandler
get /core/getResourcePanelConfigHandler returns (ResourcePanelConfigResp)
@doc "设置控制面板配置信息"
@handler putResourcePanelConfigHandler
put /core/resourcePanelConfigHandler (ResourcePanelConfigReq)
@doc "获取算力统计信息"
@handler getComputilityStatisticsHandler
get /core/getComputilityStatistics returns (ComputilityStatisticsResp)
@doc "获取节点资产"
@handler nodeAssetsHandler
get /core/assets returns (NodeAssetsResp)
@doc "保存hashcat"
@handler saveHashcatHandler
post /core/saveHashcat (SaveHashcatReq)
@doc "Task Data Statistics"
@handler tasksNumHandler
get /core/tasks/num (tasksNumReq) returns (tasksNumResp)
@doc "获取hashcat"
@handler getHashcatHandler
get /core/getHashcat/:crackTaskId (getHashcatHandlerReq) returns (getHashcatHandlerResp)
@doc "Task Count Statistics"
@handler tasksNumHandler
get /core/tasks/num (tasksNumReq) returns (tasksNumResp)
@doc "Hashcat Crack Progress"
@handler crackProgressHandler
get /core/crack/progress returns (crackProgressResp)
@doc "Resource Center Information"
@handler resourceCenterInfoHandler
get /core/center/resource/:participantId (resourceCenterInfoReq) returns (resourceCenterInfoResp)
}
//hpc二级接口
@server(
prefix: pcm/v1
group : hpc
)
service pcm {
@doc "超算查询任务列表"
@handler listJobHandler
get /hpc/listJob (listJobReq) returns (listJobResp)
@doc "超算查询历史任务列表"
@handler listHistoryJobHandler
get /hpc/listHistoryJob (listHistoryJobReq) returns (listHistoryJobResp)
@doc "超算查询资产列表"
@handler queueAssetsHandler
get /queue/assets returns (QueueAssetsResp)
}
//cloud二级接口
@server(
prefix: pcm/v1
group : cloud
)
service pcm {
@doc "云算任务列表"
@handler cloudListHandler
get /task/list returns (cloudListResp)
@doc "yaml删除"
@handler deleteYamlHandler
get /cloud/DeleteYaml (ApplyReq) returns (DeleteResp)
}
//智算二级接口
@server(
prefix: pcm/v1
group : ai
)
service pcm {
@doc "查询数据集列表"
@handler listDataSetHandler
get /ai/listDataSet/:projectId (DataSetReq) returns (DataSetResp)
@doc "创建数据集"
@handler CreateDataSetHandler
post /ai/createDataSet/:projectId (CreateDataSetReq) returns (CreateDataSetResp)
@doc "删除数据集"
@handler DeleteDataSetHandler
delete /ai/deleteDataSet/:projectId/:datasetId (DeleteDataSetReq) returns (DeleteDataSetResp)
@doc "创建导入任务"
@handler CreateTaskHandler
post /ai/CreateTask/:projectId/:datasetId (ImportTaskDataReq) returns (ImportTaskDataResp)
@doc "查询数据集导入任务列表"
@handler ListImportHandler
get /ai/ListImport/:projectId/:datasetId (ListImportTasksReq) returns (ListImportTasksResp)
@doc "查询训练作业列表"
@handler GetListTrainingJobsHandler
get /ai/GetListTrainingJobs/:projectId (ListTrainingJobsreq) returns (ListTrainingJobsresp)
@doc "删除训练作业"
@handler DeleteTrainingJobHandler
delete /ai/DeleteTrainingJob/:projectId/:trainingJobId (DeleteTrainingJobReq) returns (DeleteTrainingJobResp)
@doc "创建算法"
@handler CreateAlgorithmHandler
post /ai/CreateAlgorithm/:projectId (CreateAlgorithmReq) returns (CreateAlgorithmResp)
@doc "查询创建算法列表"
@handler ListAlgorithms
get /ai/ListAlgorithms/:projectId (ListAlgorithmsReq) returns (ListAlgorithmsResp)
@doc "删除算法"
@handler DeleteAlgorithm
delete /ai/DeleteAlgorithm/:projectId/:algorithmId (DeleteAlgorithmReq) returns (DeleteAlgorithmResp)
@doc "创建训练作业"
@handler CreateTrainingJobHandler
post /ai/CreateTrainingJob/:projectId (CreateTrainingJobReq) returns (CreateTrainingJobResp)
@doc "展示算法详情"
@handler ShowAlgorithmByUuid
get /ai/ShowAlgorithmByUuid/:projectId/:algorithmId (ShowAlgorithmByUuidReq) returns (ShowAlgorithmByUuidResp)
@doc "创建导出任务"
@handler CreateExportTaskHandler
post /ai/CreateExportTask/:projectId/:datasetId (CreateExportTaskReq) returns (ExportTaskDataResp)
@doc "获取导出任务数据集"
@handler GetExportTasksOfDatasetHandler
get /ai/GetExportTasksOfDataset/:projectId/:datasetId (GetExportTasksOfDatasetReq) returns (GetExportTasksOfDatasetResp)
@doc "获取导出任务数据集状态"
@handler GetExportTaskStatusOfDatasetHandler
get /ai/GetExportTaskStatusOfDataset/:projectId/:resourceId/:taskId (GetExportTaskStatusOfDatasetReq) returns (GetExportTaskStatusOfDatasetResp)
@doc "创建处理任务"
@handler CreateProcessorTaskHandler
post /ai/CreateProcessorTask (CreateProcessorTaskReq) returns (CreateProcessorTaskResp)
@doc "创建服务"
@handler CreateServiceHandler
post /ai/CreateService/:projectId (CreateServiceReq) returns (CreateServiceResp)
@doc "展示服务"
@handler ListServicesHandler
get /ai/ListServices/:projectId (ListServicesReq) returns (ListServicesResp)
@doc "展示服务详情"
@handler ShowServiceHandler
get /ai/ShowService/:projectId/:serviceId (ShowServiceReq) returns (ShowServiceResp)
@doc "删除服务"
@handler DeleteServiceHandler
delete /ai/DeleteService/:projectId/:serviceId (DeleteServiceReq) returns (DeleteServiceResp)
@doc "查询专属资源池列表"
@handler ListClustersHandler
get /ai/ListClusters (ListClustersReq) returns (ListClustersResp)
/******************Notebook Method start*************************/
@doc "查询notebook列表"
@handler listNotebookHandler
get /ai/listNotebook (ListNotebookReq) returns (ListNotebookResp)
@doc "创建notebook"
@handler createNotebookHandler
post /ai/createNotebook (CreateNotebookReq) returns (CreateNotebookResp)
@doc "启动notebook"
@handler startNotebookHandler
post /ai/startNotebook (StartNotebookReq) returns (StartNotebookResp)
@doc "停止notebook"
@handler stopNotebookHandler
post /ai/stopNotebook (StopNotebookReq) returns (StopNotebookResp)
@doc "查询notebook存储"
@handler getNotebookStorageHandler
get /ai/getNotebookStorage (GetNotebookStorageReq) returns (GetNotebookStorageResp)
@doc "挂载notebook存储"
@handler mountNotebookStorageHandler
post /ai/mountNotebookStorage (MountNotebookStorageReq) returns (MountNotebookStorageResp)
/******************Notebook Method end*************************/
/******************Visualization Job Method start*************************/
@doc "获取虚拟化任务"
@handler getVisualizationJobHandler
get /ai/getVisualizationJob (GetVisualizationJobReq) returns (GetVisualizationJobResp)
@doc "创建虚拟化任务"
@handler createVisualizationJobHandler
post /ai/CreateVisualizationJob (CreateVisualizationJobReq) returns (CreateVisualizationJobResp)
/******************Visualization Job Method start*************************/
}
//screen接口
@server(
prefix: pcm/v1
group : storage
)
service pcm {
@doc "存储概览"
@handler screenStorageHandler
get /storage/screenStorage (StorageScreenReq) returns (StorageScreenResp)
@doc "日常算力查询"
@handler dailyPowerScreenHandler
get /storage/dailyPowerScreen (DailyPowerScreenReq) returns (DailyPowerScreenResp)
@doc "算力中心算力情况"
@handler perCenterComputerPowersHandler
get /storage/perCenterComputerPowers (PerCenterComputerPowersReq) returns (PerCenterComputerPowersResp)
}
//镜像接口
@server(
prefix: pcm/v1
group : image
)
service pcm {
@doc "镜像上传"
@handler uploadHandler
post /upload
@doc "镜像分块"
@handler chunkHandler
post /chunk
@doc "查询镜像列表"
@handler imageListHandler
get /image/list returns (imageListResp)
@doc "数据集检查"
@handler dataSetCheckHandler
get /dataSet/check/:fileMd5 (checkReq) returns (checkResp)
@doc "上传数据集"
@handler uploadDataSetHandler
post /dataSet/upload
}
//openstack 接口
@server(
prefix: pcm/v1
group : vm
)
service pcm {
@doc "openstack计算中心概览"
@handler GetComputeLimitsHandler
get /vm/getComputeLimits (GetComputeLimitsReq) returns (GetComputeLimitsResp)
@doc "查询卷列表"
@handler GetVolumeLimitsHandler
get /vm/getVolumeLimits (GetVolumeLimitsReq) returns (GetVolumeLimitsResp)
@doc "查询虚拟机列表"
@handler ListServerHandler
get /vm/listServer (ListServersReq) returns (ListServersResp)
@doc "查询虚拟机详情列表"
@handler ListServersDetailedHandler
get /vm/listServersDetailed (ListServersDetailedReq) returns (ListServersDetailedResp)
@doc "删除虚拟机"
@handler DeleteServerHandler
delete /vm/deleteServer (DeleteServerReq) returns (DeleteServerResp)
@doc "创建虚拟机"
@handler CreateServerHandler
post /vm/createServer (CreateServerReq) returns (CreateServerResp)
@doc "根据ID查询虚拟机详情"
@handler GetServersDetailedByIdHandler
get /vm/getServersDetailedById (GetServersDetailedByIdReq) returns (GetServersDetailedByIdResp)
@doc "更新虚拟机"
@handler UpdateServerHandler
put /vm/updateServer (UpdateServerReq) returns (UpdateServerResp)
@doc "启动虚拟机"
@handler StartServerHandler
post /vm/startServer (StartServerReq) returns (StartServerResp)
@doc "停止虚拟机"
@handler StopServerHandler
post /vm/stopServer (StopServerReq) returns (StopServerResp)
@doc "重启虚拟机"
@handler RebootServerHandler
post /vm/rebootServer (RebootServerReq) returns (RebootServerResp)
@doc "暂停虚拟机"
@handler PauseServerHandler
post /vm/pauseServer (PauseServerReq) returns (PauseServerResp)
@doc "查询镜像列表"
@handler ListImagesHandler
get /vm/listImages (ListImagesReq) returns (ListImagesResp)
@doc "删除镜像"
@handler DeleteImageHandler
delete /vm/deleteImage (DeleteImageReq) returns (DeleteImageResp)
@doc "创建镜像"
@handler CreateImageHandler
post /vm/createImage (CreateImageReq) returns (CreateImageResp)
@doc "上传镜像"
@handler UploadImageHandler
put /vm/uploadImage (UploadOsImageReq) returns (UploadOsImageResp)
@doc "查询网络列表"
@handler ListNetworksHandler
get /vm/listNetworks (ListNetworksReq) returns (ListNetworksResp)
@doc "删除网络"
@handler DeleteNetworkHandler
delete /vm/deleteNetwork (DeleteNetworkReq) returns (DeleteNetworkResp)
@doc "创建网络"
@handler CreateNetworkHandler
post /vm/createNetwork (CreateNetworkReq) returns (CreateNetworkResp)
@doc "创建子网"
@handler CreateSubnetHandler
post /vm/createSubnet (CreateSubnetReq) returns (CreateSubnetResp)
@doc "查询网络详情"
@handler ShowNetworkDetailsHandler
get /vm/showNetworkDetails (ShowNetworkDetailsReq) returns (ShowNetworkDetailsResp)
@doc "更新网络"
@handler UpdateNetworkHandler
put /vm/updateNetwork (UpdateNetworkReq) returns (UpdateNetworkResp)
@doc "批量创建网络"
@handler BulkCreateNetworksHandler
post /vm/bulkCreateNetworks (BulkCreateNetworksReq) returns (BulkCreateNetworksResp)
@doc "查询卷详情列表"
@handler ListVolumesDetailHandler
get /vm/listVolumesDetail (ListVolumesDetailReq) returns (ListVolumesDetailResp)
@doc "删除卷"
@handler DeleteVolumeHandler
delete /vm/deleteVolume (DeleteVolumeReq) returns (DeleteVolumeResp)
@doc "创建卷"
@handler CreateVolumeHandler
post /vm/createVolume (CreateVolumeReq) returns (CreateVolumeResp)
@doc "查询规格详情列表"
@handler ListFlavorsDetailHandler
get /vm/listFlavorsDetail (ListFlavorsDetailReq) returns (ListFlavorsDetailResp)
@doc "查询规格类型列表"
@handler ListVolumeTypesHandler
get /vm/listVolumeTypes (ListVolumeTypesReq) returns (ListVolumeTypesResp)
@doc "更新卷"
@handler UpdateVolumeHandler
put /vm/updateVolume (UpdateVolumeReq) returns (UpdateVolumeResp)
@doc "创建卷类型"
@handler CreateVolumeTypesHandler
post /vm/createVolumeTypes (CreateVolumeTypeReq) returns (CreateVolumeTypeResp)
@doc "删除卷类型"
@handler DeleteVolumeTypeHandler
delete /vm/deleteVolumeType (DeleteVolumeTypeReq) returns (DeleteVolumeTypeResp)
@doc "查询卷列表"
@handler ListVolumesHandler
get /vm/listVolumes (ListVolumesReq) returns (ListVolumesResp)
@doc "根据ID获取卷详情"
@handler GetVolumeDetailedByIdHandler
get /vm/getVolumeDetailedById (GetVolumeDetailedByIdReq) returns (GetVolumeDetailedByIdResp)
@doc "查询节点列表"
@handler ListNodesHandler
get /vm/listNodes (ListNodesReq) returns (ListNodesResp)
@doc "创建节点"
@handler CreateNodeHandler
post /vm/createNode (CreateNodeReq) returns (CreateNodeResp)
@doc "删除节点"
@handler DeleteNodeHandler
delete /vm/deleteNode (DeleteNodeReq) returns (DeleteNodeResp)
@doc "查询节点详情"
@handler ShowNodeDetailsHandler
get /vm/showNodeDetails (ShowNodeDetailsReq) returns (ShowNodeDetailsResp)
}
//存算联动 接口
@server(
prefix: pcm/v1
group : storelink
)
service pcm {
@handler UploadLinkImageHandler
post /storelink/uploadImage (UploadLinkImageReq) returns (UploadLinkImageResp)
@handler GetLinkImageListHandler
get /storelink/getImageList (GetLinkImageListReq) returns (GetLinkImageListResp)
@handler DeleteLinkImageHandler
delete /storelink/deleteImage (DeleteLinkImageReq) returns (DeleteLinkImageResp)
@handler SubmitLinkTaskHandler
post /storelink/submitTask (SubmitLinkTaskReq) returns (SubmitLinkTaskResp)
@handler GetLinkTaskHandler
get /storelink/getTask (GetLinkTaskReq) returns (GetLinkTaskResp)
@handler DeleteLinkTaskHandler
delete /storelink/deleteTask (DeleteLinkTaskReq) returns (DeleteLinkTaskResp)
@handler GetParticipantsHandler
get /storelink/getParticipants (GetParticipantsReq) returns (GetParticipantsResp)
@handler GetAISpecsHandler
get /storelink/getResourceSpecs (GetResourceSpecsReq) returns (GetResourceSpecsResp)
}

View File

@ -15102,7 +15102,7 @@
"taskName": { "taskName": {
"type": "string" "type": "string"
}, },
"TaskStatus": { "taskStatus": {
"type": "string" "type": "string"
}, },
"startedAt": { "startedAt": {
@ -15118,7 +15118,7 @@
"required": [ "required": [
"taskId", "taskId",
"taskName", "taskName",
"TaskStatus", "taskStatus",
"startedAt", "startedAt",
"completedAt" "completedAt"
] ]

View File

@ -52,14 +52,46 @@ type (
/******************screen computing power Start*************************/ /******************screen computing power Start*************************/
type ( type (
DailyPowerScreenReq {
}
DailyPowerScreenResp { DailyPowerScreenResp {
// DailyComputerPowers []DailyComputerPowers `json:"dailyComputerPowers" copier:"DailyComputerPowers"` TotalSize int32 `json:"totalSize" copier:"TotalSize"`
chart interface{} `json:"chart"` 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 ( type (
PerCenterComputerPowersReq {
}
PerCenterComputerPowersResp { PerCenterComputerPowersResp {
chart interface{} `json:"chart"` 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"`
} }
) )

View File

@ -47,11 +47,11 @@ type (
SubmitLinkTaskReq { SubmitLinkTaskReq {
PartId int64 `json:"partId"` PartId int64 `json:"partId"`
ImageId string `json:"imageId,optional"` ImageId string `json:"imageId"`
Cmd string `json:"cmd,optional"` Cmd string `json:"cmd"`
Params []*ParamSl `json:"params,optional"` Params []*ParamSl `json:"params"`
Envs []*EnvSl `json:"envs,optional"` Envs []*EnvSl `json:"envs"`
ResourceId string `json:"resourceId,optional"` ResourceId string `json:"resourceId"`
} }
EnvSl { EnvSl {
@ -94,7 +94,7 @@ type (
TaskSl { TaskSl {
TaskId string `json:"taskId"` TaskId string `json:"taskId"`
TaskName string `json:"taskName"` TaskName string `json:"taskName"`
TaskStatus string `json:"TaskStatus"` TaskStatus string `json:"taskStatus"`
StartedAt int64 `json:"startedAt"` StartedAt int64 `json:"startedAt"`
CompletedAt int64 `json:"completedAt"` CompletedAt int64 `json:"completedAt"`
} }

1146
api/desc/vm/pcm-vm.api Normal file

File diff suppressed because it is too large Load Diff

97
api/etc/pcm.yaml Normal file
View File

@ -0,0 +1,97 @@
Name: pcm.core.api
Host: 0.0.0.0
Port: 8999
Timeout: 50000
DB:
DataSource: root:uJpLd6u-J?HC1@(10.206.0.7:3306)/pcm?parseTime=true&loc=Local
Redis:
Host: 10.206.0.7:6379
Pass: redisPW123
Cache:
- Host: 10.206.0.7:6379
Pass: redisPW123
# k8s rpc
K8sNativeConf:
# target: nacos://10.206.0.12:8848/pcm.kubenative.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api
Endpoints:
- pcm-participant-kubernetes-service:2003
NonBlock: true
#rpc
THRpcConf:
target: nacos://10.206.0.12:8848/pcm.th.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api
# Endpoints:
# - 127.0.0.1:8888
NonBlock: true
#rpc
ModelArtsRpcConf:
target: nacos://10.206.0.12:8848/pcm.modelarts.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api
# Endpoints:
# - 127.0.0.1:8888
NonBlock: true
#rpc
ModelArtsImgRpcConf:
target: nacos://10.206.0.12:8848/pcm.modelarts.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api
# Endpoints:
# - 127.0.0.1:8888
NonBlock: true
#rpc
ACRpcConf:
target: nacos://10.206.0.12:8848/pcm.ac.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api
# Endpoints:
# - 127.0.0.1:8888
NonBlock: true
Timeout: 20000
#rpc
CephRpcConf:
# target: nacos://10.206.0.12:8848/pcm.ceph.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api
Endpoints:
- pcm-participant-ceph-service:2008
NonBlock: true
Timeout: 50000
OctopusRpcConf:
target: nacos://10.206.0.12:8848/pcm.octopus.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api
# Endpoints:
# - 127.0.0.1:8888
NonBlock: true
Timeout: 20000
OpenstackRpcConf:
target: nacos://10.206.0.12:8848/pcm.openstack.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api
# Endpoints:
# - 127.0.0.1:8888
NonBlock: true
Timeout: 20000
# core rpc
PcmCoreRpcConf:
target: nacos://10.206.0.12:8848/pcm.core.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api
# Endpoints:
# - 127.0.0.1:8888
NonBlock: true
Timeout: 20000
JccScheduleUrl: http://jcce-schedule-service:8082
MinioConf:
Secret: minio_xnu122@_
AccessKey: minioadmin
Endpoint: http://121.89.220.60:9000
RegistryConf:
Username: jointcloudNudt
Password: Nudt@123
SnowflakeConf:
MachineId: 1

View File

@ -33,22 +33,22 @@ type Config struct {
THRpcConf zrpc.RpcClientConf THRpcConf zrpc.RpcClientConf
ModelArtsRpcConf zrpc.RpcClientConf ModelArtsRpcConf zrpc.RpcClientConf
ModelArtsImgRpcConf zrpc.RpcClientConf ModelArtsImgRpcConf zrpc.RpcClientConf
CephRpcConf zrpc.RpcClientConf
OpenstackRpcConf zrpc.RpcClientConf OpenstackRpcConf zrpc.RpcClientConf
OctopusRpcConf zrpc.RpcClientConf OctopusRpcConf zrpc.RpcClientConf
PcmCoreRpcConf zrpc.RpcClientConf PcmCoreRpcConf zrpc.RpcClientConf
JccScheduleUrl string
MinioConf struct { MinioConf struct {
Secret string Secret string
AccessKey string AccessKey string
Endpoint string Endpoint string
} }
RegistryConf struct {
Username string
Password string
}
SnowflakeConf SnowflakeConf SnowflakeConf SnowflakeConf
Monitoring Monitoring
}
type Monitoring struct {
PromUrl string
AlertUrl string
} }
// SnowflakeConf 雪花算法机器id配置 // SnowflakeConf 雪花算法机器id配置

31
api/internal/cron/cron.go Normal file
View File

@ -0,0 +1,31 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package cron
import (
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
)
func AddCronGroup(svc *svc.ServiceContext) {
// 同步任务信息到core端
svc.Cron.AddFunc("*/5 * * * * ?", func() {
SyncParticipantRpc(svc)
})
// 删除三天前的监控信息
svc.Cron.AddFunc("*/5 * * * * ?", func() {
ClearMetricsData(svc)
})
}

View File

@ -0,0 +1,28 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package cron
import (
"github.com/rs/zerolog/log"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models"
)
func ClearMetricsData(svc *svc.ServiceContext) {
tx := svc.DbEngin.Where("DATE(created_time) <= DATE(DATE_SUB(NOW(),INTERVAL 3 DAY))").Delete(&models.ScNodeAvailInfo{})
if tx.Error != nil {
log.Err(tx.Error)
}
}

View File

@ -0,0 +1,45 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package cron
import (
"github.com/zeromicro/go-zero/zrpc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/constants"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models"
"gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes/kubernetesclient"
)
func SyncParticipantRpc(svc *svc.ServiceContext) {
// 查询出所有p端信息
var participants []*models.ScParticipantPhyInfo
tx := svc.DbEngin.Find(&participants)
if tx.Error != nil {
}
for _, participant := range participants {
// 初始化p端rpc客户端
if len(participant.RpcAddress) != 0 && svc.K8sRpc[participant.Id] == nil {
switch participant.Type {
case constants.CLOUD:
svc.K8sRpc[participant.Id] = kubernetesclient.NewKubernetes(zrpc.MustNewClient(zrpc.RpcClientConf{
Endpoints: []string{participant.RpcAddress},
NonBlock: true,
}))
}
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
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

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
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

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
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

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
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

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
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

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
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)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func CreateTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ImportTaskDataReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewCreateTaskLogic(r.Context(), svcCtx)
resp, err := l.CreateTask(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func CreateTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateTrainingJobReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewCreateTrainingJobLogic(r.Context(), svcCtx)
resp, err := l.CreateTrainingJob(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func CreateVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateVisualizationJobReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewCreateVisualizationJobLogic(r.Context(), svcCtx)
resp, err := l.CreateVisualizationJob(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func DeleteAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteAlgorithmReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewDeleteAlgorithmLogic(r.Context(), svcCtx)
resp, err := l.DeleteAlgorithm(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func DeleteDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteDataSetReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewDeleteDataSetLogic(r.Context(), svcCtx)
resp, err := l.DeleteDataSet(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func DeleteServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteServiceReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewDeleteServiceLogic(r.Context(), svcCtx)
resp, err := l.DeleteService(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func DeleteTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteTrainingJobReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewDeleteTrainingJobLogic(r.Context(), svcCtx)
resp, err := l.DeleteTrainingJob(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func GetExportTasksOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetExportTasksOfDatasetReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewGetExportTasksOfDatasetLogic(r.Context(), svcCtx)
resp, err := l.GetExportTasksOfDataset(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func GetExportTaskStatusOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetExportTaskStatusOfDatasetReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewGetExportTaskStatusOfDatasetLogic(r.Context(), svcCtx)
resp, err := l.GetExportTaskStatusOfDataset(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func GetListTrainingJobsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ListTrainingJobsreq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewGetListTrainingJobsLogic(r.Context(), svcCtx)
resp, err := l.GetListTrainingJobs(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func GetNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetNotebookStorageReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewGetNotebookStorageLogic(r.Context(), svcCtx)
resp, err := l.GetNotebookStorage(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func GetVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetVisualizationJobReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewGetVisualizationJobLogic(r.Context(), svcCtx)
resp, err := l.GetVisualizationJob(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func ListAlgorithmsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ListAlgorithmsReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewListAlgorithmsLogic(r.Context(), svcCtx)
resp, err := l.ListAlgorithms(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func ListClustersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ListClustersReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewListClustersLogic(r.Context(), svcCtx)
resp, err := l.ListClusters(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func ListDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DataSetReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewListDataSetLogic(r.Context(), svcCtx)
resp, err := l.ListDataSet(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func ListImportHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ListImportTasksReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewListImportLogic(r.Context(), svcCtx)
resp, err := l.ListImport(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func ListNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ListNotebookReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewListNotebookLogic(r.Context(), svcCtx)
resp, err := l.ListNotebook(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func ListServicesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ListServicesReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewListServicesLogic(r.Context(), svcCtx)
resp, err := l.ListServices(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func MountNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MountNotebookStorageReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewMountNotebookStorageLogic(r.Context(), svcCtx)
resp, err := l.MountNotebookStorage(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func ShowAlgorithmByUuidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ShowAlgorithmByUuidReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewShowAlgorithmByUuidLogic(r.Context(), svcCtx)
resp, err := l.ShowAlgorithmByUuid(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func ShowServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ShowServiceReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewShowServiceLogic(r.Context(), svcCtx)
resp, err := l.ShowService(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func StartNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.StartNotebookReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewStartNotebookLogic(r.Context(), svcCtx)
resp, err := l.StartNotebook(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package ai
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/ai"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func StopNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.StopNotebookReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ai.NewStopNotebookLogic(r.Context(), svcCtx)
resp, err := l.StopNotebook(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,31 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package cloud
import (
"gitlink.org.cn/jcce-pcm/utils/result"
"net/http"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/cloud"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
)
func CloudListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := cloud.NewCloudListLogic(r.Context(), svcCtx)
resp, err := l.CloudList()
result.HttpResult(r, w, resp, err)
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package cloud
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/cloud"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func DeleteYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ApplyReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := cloud.NewDeleteYamlLogic(r.Context(), svcCtx)
resp, err := l.DeleteYaml(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,28 @@
package core
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func CommitHpcTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CommitHpcTaskReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := core.NewCommitHpcTaskLogic(r.Context(), svcCtx)
resp, err := l.CommitHpcTask(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,17 @@
package core
import (
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result"
"net/http"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
)
func CrackProgressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewCrackProgressLogic(r.Context(), svcCtx)
resp, err := l.CrackProgress()
result.HttpResult(r, w, resp, err)
}
}

View File

@ -0,0 +1,39 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"gitlink.org.cn/jcce-pcm/utils/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func DeleteTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteTaskReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := core.NewDeleteTaskLogic(r.Context(), svcCtx)
err := l.DeleteTask(&req)
result.HttpResult(r, w, nil, err)
}
}

View File

@ -0,0 +1,35 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
)
func GetComputilityStatisticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewGetComputilityStatisticsLogic(r.Context(), svcCtx)
resp, err := l.GetComputilityStatistics()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,35 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
)
func GetComputingPowerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewGetComputingPowerLogic(r.Context(), svcCtx)
resp, err := l.GetComputingPower()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,35 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
)
func GetGeneralInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewGetGeneralInfoLogic(r.Context(), svcCtx)
resp, err := l.GetGeneralInfo()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,39 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"gitlink.org.cn/jcce-pcm/utils/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func GetHashcatHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetHashcatHandlerReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := core.NewGetHashcatLogic(r.Context(), svcCtx)
resp, err := l.GetHashcat(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@ -0,0 +1,35 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
)
func GetRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewGetRegionLogic(r.Context(), svcCtx)
resp, err := l.GetRegion()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,32 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"net/http"
"gitlink.org.cn/jcce-pcm/utils/result"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
)
func GetResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewGetResourcePanelConfigLogic(r.Context(), svcCtx)
resp, err := l.GetResourcePanelConfig()
result.HttpResult(r, w, resp, err)
}
}

View File

@ -0,0 +1,31 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"gitlink.org.cn/jcce-pcm/utils/result"
"net/http"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
)
func JobTotalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewJobTotalLogic(r.Context(), svcCtx)
resp, err := l.JobTotal()
result.HttpResult(r, w, resp, err)
}
}

View File

@ -0,0 +1,35 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
)
func ListCenterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewListCenterLogic(r.Context(), svcCtx)
resp, err := l.ListCenter()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func ListClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ListClusterReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := core.NewListClusterLogic(r.Context(), svcCtx)
resp, err := l.ListCluster(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,32 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"net/http"
"gitlink.org.cn/jcce-pcm/utils/result"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
)
func ListDomainResourceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewListDomainResourceLogic(r.Context(), svcCtx)
resp, err := l.ListDomainResource()
result.HttpResult(r, w, resp, err)
}
}

View File

@ -0,0 +1,35 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
)
func ListRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewListRegionLogic(r.Context(), svcCtx)
resp, err := l.ListRegion()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,31 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"gitlink.org.cn/jcce-pcm/utils/result"
"net/http"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
)
func NodeAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewNodeAssetsLogic(r.Context(), svcCtx)
resp, err := l.NodeAssets()
result.HttpResult(r, w, resp, err)
}
}

View File

@ -0,0 +1,31 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"gitlink.org.cn/jcce-pcm/utils/result"
"net/http"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
)
func ParticipantListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewParticipantListLogic(r.Context(), svcCtx)
resp, err := l.ParticipantList()
result.HttpResult(r, w, resp, err)
}
}

View File

@ -0,0 +1,40 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"net/http"
"gitlink.org.cn/jcce-pcm/utils/result"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func PutResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ResourcePanelConfigReq
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
l := core.NewPutResourcePanelConfigLogic(r.Context(), svcCtx)
err := l.PutResourcePanelConfig(&req)
result.HttpResult(r, w, nil, err)
}
}

View File

@ -0,0 +1,25 @@
package core
import (
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func ResourceCenterInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ResourceCenterInfoReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := core.NewResourceCenterInfoLogic(r.Context(), svcCtx)
resp, err := l.ResourceCenterInfo(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@ -0,0 +1,39 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"gitlink.org.cn/jcce-pcm/utils/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func SaveHashcatHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SaveHashcatReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := core.NewSaveHashcatLogic(r.Context(), svcCtx)
err := l.SaveHashcat(&req)
result.HttpResult(r, w, nil, err)
}
}

View File

@ -0,0 +1,50 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/utils"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func ScheduleTaskByYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ScheduleTaskByYamlReq
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
// 解析yaml文件
_, fileHeader, err := r.FormFile("file")
if err != nil {
result.HttpResult(r, w, nil, err)
return
}
err = utils.Yaml2struct(fileHeader, &req)
if err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := core.NewScheduleTaskByYamlLogic(r.Context(), svcCtx)
resp, err := l.ScheduleTaskByYaml(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func SubmitJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SubmitJobReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := core.NewSubmitJobLogic(r.Context(), svcCtx)
resp, err := l.SubmitJob(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,39 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func TaskDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.TaskDetailReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := core.NewTaskDetailLogic(r.Context(), svcCtx)
resp, err := l.TaskDetail(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package core
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func TaskListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.TaskListReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := core.NewTaskListLogic(r.Context(), svcCtx)
resp, err := l.TaskList(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,25 @@
package core
import (
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func TasksNumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.TasksNumReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := core.NewTasksNumLogic(r.Context(), svcCtx)
resp, err := l.TasksNum(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package hpc
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/hpc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func ListHistoryJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ListHistoryJobReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := hpc.NewListHistoryJobLogic(r.Context(), svcCtx)
resp, err := l.ListHistoryJob(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package hpc
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/hpc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func ListJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ListJobReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := hpc.NewListJobLogic(r.Context(), svcCtx)
resp, err := l.ListJob(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,31 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package hpc
import (
"gitlink.org.cn/jcce-pcm/utils/result"
"net/http"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/hpc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
)
func QueueAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := hpc.NewQueueAssetsLogic(r.Context(), svcCtx)
resp, err := l.QueueAssets()
result.HttpResult(r, w, resp, err)
}
}

View File

@ -0,0 +1,208 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package image
import (
"bufio"
"context"
"encoding/base64"
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
types2 "github.com/docker/docker/api/types"
"github.com/zeromicro/go-zero/core/logx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/utils/fileutils"
"io/ioutil"
"k8s.io/apimachinery/pkg/util/json"
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
"sync"
"time"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
)
var dir, _ = os.Getwd()
var uploadPath = filepath.Join(dir, "uploads")
func ChunkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
size, _ := strconv.ParseInt(r.PostFormValue("size"), 10, 64)
hash := r.PostFormValue("hash")
name := r.PostFormValue("name")
dataType := r.PostFormValue("dataType")
kind := r.PostFormValue("kind")
// 对比合并请求的文件大小和已上传文件夹大小
toSize, err := fileutils.GetDirSize(filepath.Join(uploadTempPath, hash))
if err != nil {
logx.Error(err)
result.HttpResult(r, w, nil, err)
return
}
if size != toSize {
fmt.Fprintf(w, "文件上传错误")
}
chunksPath := filepath.Join(uploadTempPath, hash)
files, _ := ioutil.ReadDir(chunksPath)
// 将文件根据索引序号排序
filesSort := make(map[string]string)
for _, f := range files {
nameArr := strings.Split(f.Name(), "-")
filesSort[nameArr[1]] = f.Name()
}
saveFile := filepath.Join(uploadPath, name)
if exists, _ := fileutils.PathExists(saveFile); exists {
os.Remove(saveFile)
}
fs, _ := os.OpenFile(saveFile, os.O_CREATE|os.O_RDWR|os.O_APPEND, os.ModeAppend|os.ModePerm)
var wg sync.WaitGroup
filesCount := len(files)
if filesCount != len(filesSort) {
fmt.Fprintf(w, "文件上传错误2")
}
wg.Add(filesCount)
for i := 0; i < filesCount; i++ {
// 这里一定要注意按顺序读取不然文件就会损坏
fileName := filepath.Join(chunksPath, filesSort[strconv.Itoa(i)])
data, err := ioutil.ReadFile(fileName)
fmt.Println(err)
fs.Write(data)
wg.Done()
}
wg.Wait()
os.RemoveAll(chunksPath)
// 保存到数据库表里
svcCtx.DbEngin.Create(&models.File{
Name: name,
Hash: hash,
DataType: dataType,
Status: "local",
Kind: kind,
Bucket: "pcm"})
// 根据数据类型按需上传镜像推送到nexus 数据集和算法推送到云际存储)
switch kind {
case "image":
err = pushImage(svcCtx, hash, name)
case "dataSet", "algorithm":
err = uploadStorage(svcCtx, hash, name)
}
// 删除本地文件 避免占用本地存储资源
defer os.Remove(filepath.Join(uploadPath, name))
defer fs.Close()
result.HttpResult(r, w, nil, err)
}
}
// 同步数据集到modelArts
func syncDataSet() {
}
// 上传文件到云集存储
func uploadStorage(svcCtx *svc.ServiceContext, hash string, name string) error {
fileInfo, err := os.Open(filepath.Join(uploadPath, name))
if err != nil {
logx.Error(err)
return err
}
_, err = svcCtx.Uploader.Upload(&s3manager.UploadInput{
Bucket: aws.String("pcm"),
Key: aws.String(name),
Body: fileInfo,
})
if err != nil {
logx.Error(err)
return err
}
// 更新数据状态
svcCtx.DbEngin.Model(&models.File{}).Where("hash = ?", hash).Update("status", "cloud")
return nil
}
// 推送镜像到nexus仓库
func pushImage(svcCtx *svc.ServiceContext, hash string, name string) error {
// 加载镜像文件到docker
fileInfo, err := os.Open(filepath.Join(uploadPath, name))
if err != nil {
logx.Error(err)
return err
}
defer fileInfo.Close()
reader := bufio.NewReader(fileInfo)
body, err := svcCtx.DockerClient.ImageLoad(context.Background(), reader, false)
if err != nil {
logx.Error(err)
return err
}
bytes, err := ioutil.ReadAll(body.Body)
println(string(bytes))
if err != nil {
logx.Error(err)
return err
}
//time.Sleep(12 * 100 * time.Millisecond)
privateImageName := "registry.cn-hangzhou.aliyuncs.com/jointcloud/pcm:" + name
// 给镜像打上私有仓库的tag
err = svcCtx.DockerClient.ImageTag(context.Background(), name, privateImageName)
if err != nil {
logx.Error(err)
return err
}
// 删除原镜像
_, err = svcCtx.DockerClient.ImageRemove(context.Background(), name, types2.ImageRemoveOptions{})
if err != nil {
logx.Error(err)
return err
}
// 推送镜像到registry
authConfig := types2.AuthConfig{
Username: svcCtx.Config.RegistryConf.Username,
Password: svcCtx.Config.RegistryConf.Password,
}
authConfigBytes, err := json.Marshal(authConfig)
if err != nil {
logx.Error(err)
return err
}
logx.Infof(fmt.Sprintln("传输开始", time.Now()))
authStr := base64.URLEncoding.EncodeToString(authConfigBytes)
pushBody, err := svcCtx.DockerClient.ImagePush(context.Background(), privateImageName, types2.ImagePushOptions{RegistryAuth: authStr})
pushBytes, _ := ioutil.ReadAll(pushBody)
println(string(pushBytes))
if err != nil {
logx.Error(err)
return err
}
logx.Infof(fmt.Sprintln("传输完成", time.Now()))
// 删除本地镜像 避免存储资源浪费
_, err = svcCtx.DockerClient.ImageRemove(context.Background(), privateImageName, types2.ImageRemoveOptions{})
if err != nil {
logx.Error(err)
return err
}
// 更新数据状态
svcCtx.DbEngin.Model(&models.File{}).Where("hash = ?", hash).Update("status", "cloud")
return nil
}

View File

@ -0,0 +1,39 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package image
import (
result2 "gitlink.org.cn/jcce-pcm/utils/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/image"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func DataSetCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CheckReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := image.NewDataSetCheckLogic(r.Context(), svcCtx)
resp, err := l.DataSetCheck(&req)
result2.HttpResult(r, w, resp, err)
}
}

View File

@ -0,0 +1,31 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package image
import (
"gitlink.org.cn/jcce-pcm/utils/result"
"net/http"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/image"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
)
func ImageListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := image.NewImageListLogic(r.Context(), svcCtx)
resp, err := l.ImageList()
result.HttpResult(r, w, resp, err)
}
}

View File

@ -0,0 +1,72 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package image
import (
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"net/http"
)
func UploadDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
////file, fileHeader, err := r.FormFile("file")
////if err != nil {
//// return
////}
//AK := "your_access_key"
//SK := "your_secret_key"
//cred := aws.Credentials{AccessKeyID: AK, SecretAccessKey: SK}
//
//uploader := manager.NewUploader(client)
//endpointURL := "http://10.105.24.4:7480"
//
//customResolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) {
// return aws.Endpoint{
// URL: endpointURL,
// }, nil
//})
//
//client := s3.NewFromConfig(aws.Config{Credentials: credentials.NewAccessKeyCredential()})
//cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithEndpointResolverWithOptions(customResolver))
//if err != nil {
// panic(err)
//}
//
//s3Client := s3.NewFromConfig(cfg, func(options *s3.Options) {
// options.UsePathStyle = true
//})
// 上传文件
//uploader := manager.NewUploader(s3Client)
//bucket := "pcm"
//key := fileHeader.Filename
//result, err := uploader.Upload(context.TODO(), &s3.PutObjectInput{
// Bucket: &bucket,
// Key: &key,
// Body: file,
//})
//println(result)
//output, err := s3Client.ListObjectsV2(context.TODO(), &s3.ListObjectsV2Input{
// Bucket: aws.String("my-bucket"),
//})
//if err != nil {
// log.Fatal(err)
//}
//
//log.Println("first page results:")
//for _, object := range output.Contents {
// log.Printf("key=%s size=%d", aws.ToString(object.Key), object.Size)
//}
}
}

View File

@ -0,0 +1,118 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package image
import (
"bufio"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/utils/fileutils"
"io"
"net/http"
"os"
"path/filepath"
"strconv"
"syscall"
)
type LoadBody struct {
Stream string `json:"stream"`
}
var uploadTempPath = filepath.Join(uploadPath, "temp")
func UploadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
file, fileHeader, err := r.FormFile("file")
if err != nil {
logx.Error(err)
result.HttpResult(r, w, nil, err)
return
}
index := r.PostFormValue("index")
hash := r.PostFormValue("hash")
defer file.Close()
// 合并路径
chunksPath := filepath.Join(uploadTempPath, hash)
// 文件路径
filePath := filepath.Join(chunksPath, hash+"-"+index)
// 检查临时文件夹是否存在 不存在则创建文件夹
isPathExists, err := fileutils.PathExists(chunksPath)
if !isPathExists {
err = os.MkdirAll(chunksPath, os.ModePerm)
if err != nil {
logx.Error(err)
result.HttpResult(r, w, nil, err)
return
}
}
// 检查文件是否存在
exists, err := fileutils.PathExists(filePath)
if err != nil {
logx.Error(err)
result.HttpResult(r, w, nil, err)
return
}
// 文件存在 进行断点续传
if exists {
fileInfo, _ := os.Stat(filePath)
if fileInfo.Size() == fileHeader.Size {
result.HttpResult(r, w, nil, err)
return
}
start := strconv.Itoa(int(fileInfo.Size()))
oldFile, _ := os.OpenFile(filePath, os.O_CREATE|os.O_WRONLY, os.ModePerm)
defer oldFile.Close()
count, _ := strconv.ParseInt(start, 10, 64)
fmt.Println("已上传:", count)
// 设置读,写的偏移量
file.Seek(count, 0)
oldFile.Seek(count, 0)
data := make([]byte, 1024, 1024)
for {
total, err := file.Read(data)
if err == io.EOF {
fmt.Println("文件复制完毕")
break
}
oldFile.Write(data[:total])
}
// 文件不存在 直接上传
} else {
destFile, _ := os.OpenFile(filepath.Join(chunksPath, hash+"-"+index), syscall.O_CREAT|syscall.O_WRONLY, 0777)
reader := bufio.NewReader(file)
writer := bufio.NewWriter(destFile)
buf := make([]byte, 1024*1024) // 1M buf
for {
n, err := reader.Read(buf)
if err == io.EOF {
writer.Flush()
break
} else if err != nil {
return
} else {
writer.Write(buf[:n])
}
}
defer file.Close()
defer destFile.Close()
}
result.HttpResult(r, w, nil, err)
}
}

View File

@ -0,0 +1,623 @@
// Code generated by goctl. DO NOT EDIT.
package handler
import (
"net/http"
ai "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/handler/ai"
cloud "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/handler/cloud"
core "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/handler/core"
hpc "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/handler/hpc"
image "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/handler/image"
storage "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/handler/storage"
storelink "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/handler/storelink"
vm "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/handler/vm"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"github.com/zeromicro/go-zero/rest"
)
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/core/participantList",
Handler: core.ParticipantListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/core/scheduleTaskByYaml",
Handler: core.ScheduleTaskByYamlHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/core/commitHpcTask",
Handler: core.CommitHpcTaskHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/core/deleteTask/:id",
Handler: core.DeleteTaskHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/taskList",
Handler: core.TaskListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/taskDetail/:taskId",
Handler: core.TaskDetailHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/jobTotal",
Handler: core.JobTotalHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/listCenter",
Handler: core.ListCenterHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/listCluster/:centerId",
Handler: core.ListClusterHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/core/submitJob",
Handler: core.SubmitJobHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/getRegion",
Handler: core.GetRegionHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/listRegion",
Handler: core.ListRegionHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/getComputingPower",
Handler: core.GetComputingPowerHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/getGeneralInfo",
Handler: core.GetGeneralInfoHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/listDomainResource",
Handler: core.ListDomainResourceHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/getResourcePanelConfigHandler",
Handler: core.GetResourcePanelConfigHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/core/resourcePanelConfigHandler",
Handler: core.PutResourcePanelConfigHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/getComputilityStatistics",
Handler: core.GetComputilityStatisticsHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/assets",
Handler: core.NodeAssetsHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/core/saveHashcat",
Handler: core.SaveHashcatHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/getHashcat/:crackTaskId",
Handler: core.GetHashcatHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/tasks/num",
Handler: core.TasksNumHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/crack/progress",
Handler: core.CrackProgressHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/center/resource/:participantId",
Handler: core.ResourceCenterInfoHandler(serverCtx),
},
},
rest.WithPrefix("/pcm/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/hpc/listJob",
Handler: hpc.ListJobHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/hpc/listHistoryJob",
Handler: hpc.ListHistoryJobHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/queue/assets",
Handler: hpc.QueueAssetsHandler(serverCtx),
},
},
rest.WithPrefix("/pcm/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/task/list",
Handler: cloud.CloudListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/cloud/DeleteYaml",
Handler: cloud.DeleteYamlHandler(serverCtx),
},
},
rest.WithPrefix("/pcm/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/ai/listDataSet/:projectId",
Handler: ai.ListDataSetHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/ai/createDataSet/:projectId",
Handler: ai.CreateDataSetHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/ai/deleteDataSet/:projectId/:datasetId",
Handler: ai.DeleteDataSetHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/ai/CreateTask/:projectId/:datasetId",
Handler: ai.CreateTaskHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/ai/ListImport/:projectId/:datasetId",
Handler: ai.ListImportHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/ai/GetListTrainingJobs/:projectId",
Handler: ai.GetListTrainingJobsHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/ai/DeleteTrainingJob/:projectId/:trainingJobId",
Handler: ai.DeleteTrainingJobHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/ai/CreateAlgorithm/:projectId",
Handler: ai.CreateAlgorithmHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/ai/ListAlgorithms/:projectId",
Handler: ai.ListAlgorithmsHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/ai/DeleteAlgorithm/:projectId/:algorithmId",
Handler: ai.DeleteAlgorithmHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/ai/CreateTrainingJob/:projectId",
Handler: ai.CreateTrainingJobHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/ai/ShowAlgorithmByUuid/:projectId/:algorithmId",
Handler: ai.ShowAlgorithmByUuidHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/ai/CreateExportTask/:projectId/:datasetId",
Handler: ai.CreateExportTaskHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/ai/GetExportTasksOfDataset/:projectId/:datasetId",
Handler: ai.GetExportTasksOfDatasetHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/ai/GetExportTaskStatusOfDataset/:projectId/:resourceId/:taskId",
Handler: ai.GetExportTaskStatusOfDatasetHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/ai/CreateProcessorTask",
Handler: ai.CreateProcessorTaskHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/ai/CreateService/:projectId",
Handler: ai.CreateServiceHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/ai/ListServices/:projectId",
Handler: ai.ListServicesHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/ai/ShowService/:projectId/:serviceId",
Handler: ai.ShowServiceHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/ai/DeleteService/:projectId/:serviceId",
Handler: ai.DeleteServiceHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/ai/ListClusters",
Handler: ai.ListClustersHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/ai/listNotebook",
Handler: ai.ListNotebookHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/ai/createNotebook",
Handler: ai.CreateNotebookHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/ai/startNotebook",
Handler: ai.StartNotebookHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/ai/stopNotebook",
Handler: ai.StopNotebookHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/ai/getNotebookStorage",
Handler: ai.GetNotebookStorageHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/ai/mountNotebookStorage",
Handler: ai.MountNotebookStorageHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/ai/getVisualizationJob",
Handler: ai.GetVisualizationJobHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/ai/CreateVisualizationJob",
Handler: ai.CreateVisualizationJobHandler(serverCtx),
},
},
rest.WithPrefix("/pcm/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/storage/screenStorage",
Handler: storage.ScreenStorageHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/storage/dailyPowerScreen",
Handler: storage.DailyPowerScreenHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/storage/perCenterComputerPowers",
Handler: storage.PerCenterComputerPowersHandler(serverCtx),
},
},
rest.WithPrefix("/pcm/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/upload",
Handler: image.UploadHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/chunk",
Handler: image.ChunkHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/image/list",
Handler: image.ImageListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/dataSet/check/:fileMd5",
Handler: image.DataSetCheckHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/dataSet/upload",
Handler: image.UploadDataSetHandler(serverCtx),
},
},
rest.WithPrefix("/pcm/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/vm/getComputeLimits",
Handler: vm.GetComputeLimitsHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/vm/getVolumeLimits",
Handler: vm.GetVolumeLimitsHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/vm/listServer",
Handler: vm.ListServerHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/vm/listServersDetailed",
Handler: vm.ListServersDetailedHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/vm/deleteServer",
Handler: vm.DeleteServerHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/vm/createServer",
Handler: vm.CreateServerHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/vm/getServersDetailedById",
Handler: vm.GetServersDetailedByIdHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/vm/updateServer",
Handler: vm.UpdateServerHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/vm/startServer",
Handler: vm.StartServerHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/vm/stopServer",
Handler: vm.StopServerHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/vm/rebootServer",
Handler: vm.RebootServerHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/vm/pauseServer",
Handler: vm.PauseServerHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/vm/listImages",
Handler: vm.ListImagesHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/vm/deleteImage",
Handler: vm.DeleteImageHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/vm/createImage",
Handler: vm.CreateImageHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/vm/uploadImage",
Handler: vm.UploadImageHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/vm/listNetworks",
Handler: vm.ListNetworksHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/vm/deleteNetwork",
Handler: vm.DeleteNetworkHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/vm/createNetwork",
Handler: vm.CreateNetworkHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/vm/createSubnet",
Handler: vm.CreateSubnetHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/vm/showNetworkDetails",
Handler: vm.ShowNetworkDetailsHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/vm/updateNetwork",
Handler: vm.UpdateNetworkHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/vm/bulkCreateNetworks",
Handler: vm.BulkCreateNetworksHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/vm/listVolumesDetail",
Handler: vm.ListVolumesDetailHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/vm/deleteVolume",
Handler: vm.DeleteVolumeHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/vm/createVolume",
Handler: vm.CreateVolumeHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/vm/listFlavorsDetail",
Handler: vm.ListFlavorsDetailHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/vm/listVolumeTypes",
Handler: vm.ListVolumeTypesHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/vm/updateVolume",
Handler: vm.UpdateVolumeHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/vm/createVolumeTypes",
Handler: vm.CreateVolumeTypesHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/vm/deleteVolumeType",
Handler: vm.DeleteVolumeTypeHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/vm/listVolumes",
Handler: vm.ListVolumesHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/vm/getVolumeDetailedById",
Handler: vm.GetVolumeDetailedByIdHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/vm/listNodes",
Handler: vm.ListNodesHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/vm/createNode",
Handler: vm.CreateNodeHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/vm/deleteNode",
Handler: vm.DeleteNodeHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/vm/showNodeDetails",
Handler: vm.ShowNodeDetailsHandler(serverCtx),
},
},
rest.WithPrefix("/pcm/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/storelink/uploadImage",
Handler: storelink.UploadLinkImageHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/storelink/getImageList",
Handler: storelink.GetLinkImageListHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/storelink/deleteImage",
Handler: storelink.DeleteLinkImageHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/storelink/submitTask",
Handler: storelink.SubmitLinkTaskHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/storelink/getTask",
Handler: storelink.GetLinkTaskHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/storelink/deleteTask",
Handler: storelink.DeleteLinkTaskHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/storelink/getParticipants",
Handler: storelink.GetParticipantsHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/storelink/getResourceSpecs",
Handler: storelink.GetAISpecsHandler(serverCtx),
},
},
rest.WithPrefix("/pcm/v1"),
)
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package storage
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/storage"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func DailyPowerScreenHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DailyPowerScreenReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := storage.NewDailyPowerScreenLogic(r.Context(), svcCtx)
resp, err := l.DailyPowerScreen(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package storage
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/storage"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func PerCenterComputerPowersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.PerCenterComputerPowersReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := storage.NewPerCenterComputerPowersLogic(r.Context(), svcCtx)
resp, err := l.PerCenterComputerPowers(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package storage
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/storage"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func ScreenStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.StorageScreenReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := storage.NewScreenStorageLogic(r.Context(), svcCtx)
resp, err := l.ScreenStorage(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package storelink
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/storelink"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func DeleteLinkImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteLinkImageReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := storelink.NewDeleteLinkImageLogic(r.Context(), svcCtx)
resp, err := l.DeleteLinkImage(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package storelink
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/storelink"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func DeleteLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteLinkTaskReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := storelink.NewDeleteLinkTaskLogic(r.Context(), svcCtx)
resp, err := l.DeleteLinkTask(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package storelink
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/storelink"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func GetAISpecsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetResourceSpecsReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := storelink.NewGetAISpecsLogic(r.Context(), svcCtx)
resp, err := l.GetAISpecs(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package storelink
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/storelink"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func GetLinkImageListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetLinkImageListReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := storelink.NewGetLinkImageListLogic(r.Context(), svcCtx)
resp, err := l.GetLinkImageList(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package storelink
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/storelink"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func GetLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetLinkTaskReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := storelink.NewGetLinkTaskLogic(r.Context(), svcCtx)
resp, err := l.GetLinkTask(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package storelink
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/storelink"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func GetParticipantsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetParticipantsReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := storelink.NewGetParticipantsLogic(r.Context(), svcCtx)
resp, err := l.GetParticipants(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package storelink
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/storelink"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func SubmitLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SubmitLinkTaskReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := storelink.NewSubmitLinkTaskLogic(r.Context(), svcCtx)
resp, err := l.SubmitLinkTask(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,42 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package storelink
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/storelink"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
)
func UploadLinkImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UploadLinkImageReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := storelink.NewUploadLinkImageLogic(r.Context(), svcCtx)
resp, err := l.UploadLinkImage(&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