From ea2cde2c1db7707dda50dc8f53afeb6416baffe5 Mon Sep 17 00:00:00 2001
From: data-infra <825485697@qq.com>
Date: Wed, 26 Jun 2024 22:10:01 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE=E9=9B=86?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=92=8C=E6=98=BE=E7=A4=BA=E5=88=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
myapp/cli.py | 21 ++++++--
myapp/models/model_dataset.py | 22 +++++++++
myapp/models/model_notebook.py | 2 +-
myapp/models/model_train_model.py | 19 ++++---
myapp/views/view_dataset.py | 82 ++++++++++++++++---------------
5 files changed, 95 insertions(+), 51 deletions(-)
diff --git a/myapp/cli.py b/myapp/cli.py
index 72789a2c..e577a45c 100755
--- a/myapp/cli.py
+++ b/myapp/cli.py
@@ -97,6 +97,10 @@ def add_project(project_type, name, describe, expand={}):
add_project('job-template', __('数据预处理'), __('结构化话数据特征处理'), {"index": 3})
add_project('job-template', __('数据处理工具'), __('数据的单机或分布式处理任务,ray/spark/hadoop/volcanojob'), {"index": 4})
add_project('job-template', __('特征处理'), __('特征处理相关功能'), {"index": 5})
+ add_project('job-template', __('图像处理'), __('图像处理相关功能'), {"index": 5.1})
+ add_project('job-template', __('视频处理'), __('视频处理相关功能'), {"index": 5.2})
+ add_project('job-template', __('音频处理'), __('音频处理相关功能'), {"index": 5.3})
+ add_project('job-template', __('文本处理'), __('文本处理相关功能'), {"index": 5.4})
add_project('job-template', __('机器学习框架'), __('传统机器学习框架,sklearn'), {"index": 6})
add_project('job-template', __('机器学习算法'), __('传统机器学习,lr/决策树/gbdt/xgb/fm等'), {"index": 7})
add_project('job-template', __('深度学习'), __('深度框架训练,tf/pytorch/mxnet/mpi/horovod/kaldi等'), {"index": 8})
@@ -452,7 +456,7 @@ def create_dataset(**kwargs):
dataset = Dataset()
dataset.name = kwargs['name']
dataset.field = kwargs.get('field', '')
- dataset.version = 'latest'
+ dataset.version = kwargs.get('version', 'latest')
dataset.label = kwargs.get('label', '')
dataset.status = kwargs.get('status', '')
dataset.describe = kwargs.get('describe', '')
@@ -472,7 +476,8 @@ def create_dataset(**kwargs):
dataset.storage_class = kwargs.get('storage_class', '')
dataset.storage_size = kwargs.get('storage_size', '')
dataset.download_url = kwargs.get('download_url', '')
- dataset.owner = 'admin'
+ dataset.owner = kwargs.get('owner', 'admin')
+ dataset.features = kwargs.get('features', '{}')
dataset.created_by_fk = 1
dataset.changed_by_fk = 1
db.session.add(dataset)
@@ -631,7 +636,7 @@ def create_inference(project_name, service_name, service_describe, image_name, c
from myapp.views.view_inferenceserving import InferenceService_ModelView_base
inference_class = InferenceService_ModelView_base()
inference_class.src_item_json = {}
- inference_class.pre_add(service)
+ inference_class.use_expand(service)
db.session.add(service)
db.session.commit()
@@ -756,10 +761,13 @@ def add_chat(chat_path):
if not chat.id:
db.session.add(chat)
db.session.commit()
+ print(f'add chat {name} success')
except Exception as e:
print(e)
# traceback.print_exc()
+ # 添加chat
+ # if conf.get('BABEL_DEFAULT_LOCALE','zh')=='zh':
try:
print('begin add chat')
init_file = os.path.join(init_dir, 'init-chat.json')
@@ -768,7 +776,7 @@ def add_chat(chat_path):
except Exception as e:
print(e)
# traceback.print_exc()
- # 添加chat
+
# if conf.get('BABEL_DEFAULT_LOCALE','zh')=='zh':
try:
SQLALCHEMY_DATABASE_URI = os.getenv('MYSQL_SERVICE', '')
@@ -819,6 +827,7 @@ def add_chat(chat_path):
# traceback.print_exc()
# 添加ETL pipeline
try:
+ print('begin add etl pipeline')
from myapp.models.model_etl_pipeline import ETL_Pipeline
tables = db.session.query(ETL_Pipeline).all()
if len(tables) == 0:
@@ -840,6 +849,7 @@ def add_chat(chat_path):
# 添加nni超参搜索
try:
+ print('begin add nni')
from myapp.models.model_nni import NNI
nni = db.session.query(NNI).all()
if len(nni) == 0:
@@ -862,7 +872,7 @@ def add_chat(chat_path):
resource_gpu=nni.get('resource_gpu', '0'),
))
db.session.commit()
- print('添加etl pipeline成功')
+ print('添加nni 超参搜索成功')
except Exception as e:
print(e)
# traceback.print_exc()
@@ -870,6 +880,7 @@ def add_chat(chat_path):
# 添加镜像在线构建
try:
+ print('begin add docker')
from myapp.models.model_docker import Docker
docker = db.session.query(Docker).all()
if len(docker) == 0:
diff --git a/myapp/models/model_dataset.py b/myapp/models/model_dataset.py
index 439958ac..1e29fb45 100644
--- a/myapp/models/model_dataset.py
+++ b/myapp/models/model_dataset.py
@@ -70,15 +70,37 @@ def url_html(self):
html+='%s
'%(url.strip(),url.strip())
return Markup('
' + features_demo + "
")),
default=''
)
@@ -280,13 +283,14 @@ class Dataset_ModelView_base():
def pre_add(self, item):
if not item.owner:
item.owner = g.user.username + ",*"
- if not item.icon:
- item.icon = '/static/assets/images/dataset.png'
+ if item.icon and '' in item.icon:
+ item.icon = re.sub(r'width="\d+(\.\d+)?(px)?"', f'width="50px"', item.icon)
+ item.icon = re.sub(r'height="\d+(\.\d+)?(px)?"', f'height="50px"', item.icon)
if not item.version:
item.version = 'latest'
if not item.subdataset:
item.subdataset = item.name
-
+ item.features = json.dumps(json.loads(item.features),indent=4,ensure_ascii=False) if item.features else "{}"
def pre_update(self, item):
self.pre_add(item)
@@ -405,7 +409,7 @@ def path2url(path):
dataset = db.session.query(Dataset).filter_by(id=int(dataset_id)).first()
try:
download_url = []
- if dataset.path:
+ if dataset.path and dataset.path.strip():
# 如果存储在集群数据集中心
# 如果存储在个人目录
paths = dataset.path.split('\n')
@@ -413,7 +417,7 @@ def path2url(path):
download_url.append(path2url(path))
# 如果存储在外部链接
- elif dataset.download_url:
+ elif dataset.download_url and dataset.download_url.strip():
download_url = dataset.download_url.split('\n')
else:
# 如果存储在对象存储中