Skip to content

Commit

Permalink
add aihub
Browse files Browse the repository at this point in the history
  • Loading branch information
FerdinandWard committed Aug 22, 2022
1 parent ed8c9ae commit cab99b5
Show file tree
Hide file tree
Showing 7 changed files with 953 additions and 749 deletions.
731 changes: 731 additions & 0 deletions aihub/init-dataset.csv

Large diffs are not rendered by default.

77 changes: 77 additions & 0 deletions docs/example/service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@

# 内部服务

## 普通服务

### 开发注册

1、开发你的服务化镜像,push到docker仓库内

2、注册你的服务

![image](https://user-images.githubusercontent.com/20157705/169932303-0ec981cc-09ca-423c-96f9-da164ed309da.png)

## mysql web服务

镜像:ccr.ccs.tencentyun.com/cube-studio/phpmyadmin

环境变量:
```
PMA_HOST=xx.xx.xx.xx
PMA_PORT=xx
PMA_USER=xx
PMA_PASSWORD=xx
```
端口:80

## mongo web服务
镜像:mongo-express:0.54.0

环境变量:
```
ME_CONFIG_MONGODB_SERVER=xx.xx.xx.xx
ME_CONFIG_MONGODB_PORT=xx
ME_CONFIG_MONGODB_ENABLE_ADMIN=true
ME_CONFIG_MONGODB_ADMINUSERNAME=xx
ME_CONFIG_MONGODB_ADMINPASSWORD=xx
ME_CONFIG_MONGODB_AUTH_DATABASE=xx
VCAP_APP_HOST=0.0.0.0
VCAP_APP_PORT=8081
ME_CONFIG_OPTIONS_EDITORTHEME=ambiance
```
端口:8081

## redis web
镜像:ccr.ccs.tencentyun.com/cube-studio/patrikx3:latest

环境变量
```
REDIS_NAME=xx
REDIS_HOST=xx
REDIS_PORT=xx
REDIS_PASSWORD=xx
```
端口:7843

## 图数据库neo4j

镜像:ccr.ccs.tencentyun.com/cube-studio/neo4j:4.4

环境变量
```
NEO4J_AUTH=neo4j/admin
```
端口:7474,7687

## jaeger链路追踪

镜像:jaegertracing/all-in-one:1.29

端口:5775,16686


## 服务暴露:

- 1、域名暴露需要平台配置泛域名,SERVICE_DOMAIN
- 2、ip暴露需要平台配置SERVICE_EXTERNAL_IP=[xx.xx.xx.xx],或者项目中配置SERVICE_EXTERNAL_IP=xx.xx.xx.xx ip需为集群中节点的ip或者clb的ip

10 changes: 7 additions & 3 deletions myapp/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ def create_template(repository_id,project_name,image_name,image_describe,job_tem


# 创建demo pipeline
# @pysnooper.snoop()
def create_pipeline(tasks,pipeline):
# 如果项目组或者task的模板不存在就丢失
org_project = db.session.query(Project).filter_by(name=pipeline['project']).filter_by(type='org').first()
Expand Down Expand Up @@ -400,7 +401,8 @@ def create_train_model(name,describe,path,project_name,version,framework,api_typ


# 添加demo 服务
def create_service(project_name,service_name,service_describe,image_name,command,env,resource_memory='2G',resource_cpu='2',resource_gpu='0',ports='80',volume_mount='kubeflow-user-workspace(pvc):/mnt'):
# @pysnooper.snoop()
def create_service(project_name,service_name,service_describe,image_name,command,env,resource_memory='2G',resource_cpu='2',resource_gpu='0',ports='80',volume_mount='kubeflow-user-workspace(pvc):/mnt',expand={}):
service = db.session.query(Service).filter_by(name=service_name).first()
project = db.session.query(Project).filter_by(name=project_name).filter_by(type='org').first()
if service is None and project:
Expand All @@ -419,6 +421,7 @@ def create_service(project_name,service_name,service_describe,image_name,command
service.env='\n'.join([x.strip() for x in env.split('\n') if x.split()])
service.ports = ports
service.volume_mount=volume_mount
service.expand = json.dumps(expand, indent=4, ensure_ascii=False)
db.session.add(service)
db.session.commit()
print('add service %s'%service_name)
Expand All @@ -438,7 +441,8 @@ def create_service(project_name,service_name,service_describe,image_name,command


# 添加 demo 推理 服务
def create_inference(project_name,service_name,service_describe,image_name,command,env,model_name,workdir='',model_version='',model_path='',service_type='serving',resource_memory='2G',resource_cpu='2',resource_gpu='0',ports='80',volume_mount='kubeflow-user-workspace(pvc):/mnt',metrics='',health='',inference_config=''):
# @pysnooper.snoop()
def create_inference(project_name,service_name,service_describe,image_name,command,env,model_name,workdir='',model_version='',model_path='',service_type='serving',resource_memory='2G',resource_cpu='2',resource_gpu='0',ports='80',volume_mount='kubeflow-user-workspace(pvc):/mnt',metrics='',health='',inference_config='',expand={}):
service = db.session.query(InferenceService).filter_by(name=service_name).first()
project = db.session.query(Project).filter_by(name=project_name).filter_by(type='org').first()
if service is None and project:
Expand All @@ -465,7 +469,7 @@ def create_inference(project_name,service_name,service_describe,image_name,comma
service.volume_mount=volume_mount
service.metrics=metrics
service.health=health
service.expand = "{}"
service.expand = json.dumps(expand,indent=4,ensure_ascii=False)

from myapp.views.view_inferenceserving import InferenceService_ModelView_base
inference_class = InferenceService_ModelView_base()
Expand Down
Loading

0 comments on commit cab99b5

Please sign in to comment.