change view to api

This commit is contained in:
cdllp2 2022-08-28 20:24:32 +08:00
parent 299aefb033
commit 172017b9bd
7 changed files with 12 additions and 9 deletions

View File

@ -201,6 +201,11 @@ class InferenceService(Model,AuditMixinNullable,MyappModelBase,service_common):
url = self.project.cluster['K8S_DASHBOARD_CLUSTER'] + '#/search?namespace=%s&q=%s' % (conf.get('SERVICE_NAMESPACE'), self.name.replace('_', '-'))
return Markup(f'<a target=_blank href="{url}">{self.model_name}</a>')
@property
def replicas_html(self):
return "%s~%s"%(self.min_replicas,self.max_replicas)
@property
def resource(self):
return 'cpu:%s,memory:%s,gpu:%s'%(self.resource_cpu,self.resource_memory,self.resource_gpu)

View File

@ -348,7 +348,7 @@ class Docker_ModelView_Base():
class Docker_ModelView(Docker_ModelView_Base,MyappModelView,DeleteMixin):
datamodel = SQLAInterface(Docker)
appbuilder.add_view(Docker_ModelView,"镜像调试",href="/docker_modelview/list/",icon = 'fa-cubes',category = '在线开发',category_icon = 'fa-glass')
appbuilder.add_view_no_menu(Docker_ModelView)
# 添加api
class Docker_ModelView_Api(Docker_ModelView_Base,MyappModelRestApi):

View File

@ -1742,7 +1742,6 @@ class ETL_Pipeline_ModelView(ETL_Pipeline_ModelView_Base,MyappModelView,DeleteMi
# order_columns = ['changed_on']
# appbuilder.add_view(ETL_Pipeline_ModelView,"数据计算",href="/etl_pipeline_modelview/list/",icon = 'fa-usb',category = 'data')
appbuilder.add_view_no_menu(ETL_Pipeline_ModelView)

View File

@ -217,7 +217,7 @@ class Images_ModelView_Base():
class Images_ModelView(Images_ModelView_Base,MyappModelView,DeleteMixin):
datamodel = SQLAInterface(Images)
appbuilder.add_view(Images_ModelView,"模板镜像",href="/images_modelview/list/?_flt_2_name=",icon = 'fa-file-image-o',category = '训练')
appbuilder.add_view_no_menu(Images_ModelView)
class Images_ModelView_Api(Images_ModelView_Base,MyappModelRestApi):

View File

@ -86,8 +86,7 @@ class Metadata_metric_ModelView_base():
label_title='指标'
datamodel = SQLAInterface(Metadata_metric)
base_permissions = ['can_add','can_show','can_edit','can_list','can_delete']
base_order = ("changed_on", "desc")
# order_columns = ['id','changed_on']
base_order = ("id", "desc")
order_columns = ['id']
search_columns=['metric_data_type','metric_responsible','app','name','label','describe','metric_type','metric_level','task_id','caliber']
show_columns=['id','app','metric_data_type','name','label','describe','metric_type','metric_level','metric_dim','metric_responsible','caliber','task_id','public']
@ -188,6 +187,7 @@ class Metadata_metric_ModelView_base():
edit_form_extra_fields = add_form_extra_fields
import_data=True
download_data=True
def pre_upload(self,data):

View File

@ -717,10 +717,9 @@ class NNI_ModelView(NNI_ModelView_Base,MyappModelView):
conv = GeneralModelConverter(datamodel)
appbuilder.add_separator("训练") # 在指定菜单栏下面的每个子菜单中间添加一个分割线的显示。
# 添加视图和菜单
# appbuilder.add_view(NNI_ModelView,"nni超参搜索",icon = 'fa-shopping-basket',category = '超参搜索',category_icon = 'fa-share-alt')
appbuilder.add_view(NNI_ModelView,"nni超参搜索",icon = 'fa-shopping-basket',category = '训练')
appbuilder.add_view_no_menu(NNI_ModelView)
# appbuilder.add_view_no_menu(NNI_ModelView)
# 添加api

View File

@ -267,7 +267,7 @@ class Notebook_ModelView_Base():
db.session.commit()
def post_list(self,items):
flash('注意notebook会定时清理如要运行长期任务请在pipeline中创建任务流进行。个人持久化目录在/mnt/%s/下'%g.user.username,category='warning')
flash('注意notebook会定时清理如要运行长期任务请在pipeline中创建任务流进行。<br>个人持久化目录在/mnt/%s/下'%g.user.username,category='warning')
# items.sort(key=lambda item:item.created_by.username==g.user.username,reverse=True)
return items
@ -549,7 +549,7 @@ class Notebook_ModelView_Base():
class Notebook_ModelView(Notebook_ModelView_Base,MyappModelView,DeleteMixin):
datamodel = SQLAInterface(Notebook)
# 添加视图和菜单
appbuilder.add_view(Notebook_ModelView,"notebook",href="/notebook_modelview/list/?_flt_0_created_by=",icon = 'fa-file-code-o',category = '在线开发',category_icon = 'fa-code')
appbuilder.add_view_no_menu(Notebook_ModelView)
# 添加api