update code

main
haha 2024-08-20 23:16:55 +08:00
parent 911b92a82c
commit dfa39efef9
7 changed files with 159 additions and 106 deletions

View File

@ -36,11 +36,20 @@ const compileDeploy=(operation_id)=>{
});
}
//获取推理最新的模型推理日志
const inferenceTaskLatest=task_id=>{
return request({
url: `/logs/inference/${task_id}/latest`,
method: "get"
});
}
export default {
serverState,
userOperationNotice,
userOperation,
compileDeploy,
userRunning
userRunning,
inferenceTaskLatest
}

View File

@ -1,9 +1,10 @@
import request from "@/utils/request";
//获取任务列表
const tasks = () => {
const tasks = (data) => {
return request({
url: '/tasks',
method: 'get'
method: 'get',
params:data
})
}
//获取可用的设备状态

View File

@ -34,7 +34,7 @@
</template>
<el-table v-loading="loading" ref="dataTb" :data="info.tableData" stripe @row-click="doRowClick">
<el-table-column width="55">
<el-table-column width="55" v-if="1 == 2">
<template #default="scope">
<el-checkbox v-model="scope.row.checked" :disabled="!scope.row.available" />
</template>
@ -65,7 +65,8 @@
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template #default="scope">
<el-button type="primary" text v-if="scope.row.available" size="default"></el-button>
<el-button type="primary" @click="doCompile(scope.row)" text v-if="scope.row.available"
size="default">部署</el-button>
<span v-else style="color: #888;">部署</span>
</template>
</el-table-column>
@ -89,6 +90,7 @@
<script setup>
import taskApi from "@/api/task";
import choiceToolsParamDlg from './choiceToolsParamDlg.vue';
const emit = defineEmits(["compile"]);
const props = defineProps({
modelInfo: {
type: Object,
@ -113,7 +115,13 @@ const info = reactive({
logs: [],
editItem: null,
});
const doCompile = (row) => {
if (!row.tool_params_id) {
ElMessage.error("请选择工具链运行参数列表!");
return;
}
emit("compile", row);
}
const doChoice = row => {
info.editItem = row;
choiceToolParamDlg.value.showDialog(row);

View File

@ -11,11 +11,12 @@
<div style="margin-bottom:100px;" class="card-content">
<addStep1 ref="step1" v-if="active == 1" />
<addStep2 ref="step2" v-if="active == 2" />
<addStep3 ref="step3" v-if="active == 3" :modelInfo="modelInfo" />
<addStep3 ref="step3" v-if="active == 3" :modelInfo="modelInfo" @compile="doCompile" />
<addStep4 ref="step4" v-if="active == 4" />
</div>
<el-card class="card-footer">
<el-button type="primary" v-if="active == 3 && state == 0" @click="doCompile"></el-button>
<!--
<el-button type="primary" v-if="active == 3 && state == 0" @click="doCompile"></el-button>-->
<el-button type="primary" v-if="active == 3 && state == 1" loading disabled>编译中...</el-button>
<el-button type="primary" v-if="active == 3 && state == 2" loading disabled>部署中...</el-button>
<el-button type="primary" v-if="active == 4" @click="doStart" :loading="state > 0" :disabled="state > 0">{{ state
@ -109,10 +110,11 @@ const startInference = () => {
});
}
const doCompile = () => {
let tmp = step3.value.checkForm();
const doCompile = (row) => {
debugger
let tmp = row;
if (tmp) {
info.devices = tmp;
info.devices = [tmp];
state.value = 1;
step3.value.updateState(state.value);
startComplie();//
@ -125,10 +127,12 @@ const doCompile = () => {
const startComplie = () => {
let ajaxs = info.devices.map(d => {
return inferenceApi.doCompile({
model_id: modelInfo.model_id,
modl_net_type: modelInfo.modl_net_type,
//model_id: modelInfo.model_id,
//modl_net_type: modelInfo.modl_net_type,
tool_params_id: d.tool_params_id,
device_id: d.device_id
tool_id: d.tool_id,
device_id: d.device_id,
connection_id: modelInfo.connection_id
});
})
addLogs({ msg: "开始编译....", type: "info" })

View File

@ -29,7 +29,7 @@
</el-dialog>
<el-dialog v-model="info.showJsonDlg" title="查看工具链运行参数" :close-on-press-escape="false" :close-on-click-modal="false"
align-center append-to-body width="800px" modal-class="show-tool-param-dlg">
<pre v-html="info.showItem.params_content"></pre>
<json-viewer :value="info.showItem.params_content" copyable boxed sort theme="my-json-view jv-light" />
<template #footer>
<div style="text-align: center">
<el-button type="primary" @click="info.showJsonDlg = false">关闭</el-button>
@ -81,7 +81,7 @@ const showDialog = (opt) => {
const loadData = () => {
info.loading = true;
toolApi.paramsList({ page_num: 1, page_size: 100, tool_id: info.data.tool_id }).then(d => {
info.tableData = d.data.data.ParamsList || [];
info.tableData = d.data.data.ToolParamsList || [];
info.loading = false;
});
}

View File

@ -1,82 +1,106 @@
<template>
<div class="app-container simulation-execution">
<div class="app-container simulation-execution">
<el-card>
<el-table v-loading="loading" ref="dataTb" :data="tableData" stripe height="400px" >
<el-table-column label="推理任务名称" align="left" prop="taskName" />
<el-table-column label="模型名称" align="left" prop="modelName" />
<el-table-column label="模型类型" align="left" prop="modelType" />
<el-table-column label="互联名称" align="left" prop="netName" />
<el-table-column label="推理数据集名称" align="left" prop="datasName" />
<el-table-column label="创建用户" width="120" align="left" prop="createUser" />
<el-table-column label="推理设备名称" align="left" prop="devName" />
<el-table-column label="运行状态" fixed="right" align="center" width="120">
<template #default="scope">
<span :class="'run-state state-'+scope.row.state">{{ scope.row.state==1?'完成':'推理中' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="120">
<template #default="scope">
<el-button text type="primary">
<i-ep-circle-close />&nbsp;终止推理</el-button>
</template>
</el-table-column>
<el-table v-loading="loading" ref="dataTb" :data="info.dataList" stripe height="400px">
<el-table-column label="推理任务名称" align="left" prop="task_name" />
<el-table-column label="模型名称" align="left" prop="model_name" />
<el-table-column label="模型类型" align="left" prop="modl_net_type" />
<el-table-column label="互联名称" align="left" prop="connection_name" />
<el-table-column label="推理数据集名称" align="left" prop="data_set_name" />
<el-table-column label="推理设备名称" align="left" prop="device_name" />
<el-table-column label="运行状态" fixed="right" align="center" width="120" v-if="1 == 2">
<template #default="scope">
<span :class="'run-state state-' + scope.row.state">{{ scope.row.state == 1 ? '完成' : '推理中' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="120" v-if="1 == 2">
<template #default="scope">
<el-button text type="primary">
<i-ep-circle-close />&nbsp;终止推理</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-if="total > 0" v-model:total="total" v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize" @pagination="handleQuery" />
</el-table>
<pagination v-model:total="total" v-model:page="queryParams.pageNum" v-if="1 == 2"
v-model:limit="queryParams.pageSize" @pagination="handleQuery" />
</el-card>
<div style="margin-top:30px;font-size:12px;font-weight: bold;margin-left:8px;">推理日志</div>
<el-card class="split-log">
<div v-for="(it,idx) in logList" :key="idx" class="log-item">
<span>{{ it.date }}</span>
<span>{{it.log}}</span>
</div>
</el-card>
<div v-for="(it, idx) in logList" :key="idx" class="log-item">
<span>{{ it.date }}</span>
<span>{{ it.log }}</span>
</div>
</el-card>
</div>
</template>
<script setup>
let loading=ref(false)
const logList=reactive([
{date:'2024-05-06 18:34:36',log:'系统已启动编译'},
{date:'2024-05-06 18:34:36',log:'系统正在分割目标文件'},
{date:'2024-05-06 18:34:36',log:'运行时异常,系统编译已终止'}])
<script setup>
import TaskApi from '@/api/task'
import LogsApi from '@/api/log'
import request from "axios";
let loading = ref(false)
let info = reactive({
dataList: [],
logs: [],
})
const logList = reactive([
{ date: '2024-05-06 18:34:36', log: '系统已启动编译' },
{ date: '2024-05-06 18:34:36', log: '系统正在分割目标文件' },
{ date: '2024-05-06 18:34:36', log: '运行时异常,系统编译已终止' }])
const queryParams = reactive({
pageNum: 1,
pageSize: 10,
keywords:''
keywords: ''
});
const total=ref(100)
const total = ref(100)
/** 查询 */
function handleQuery(a) {
queryParams.pageSize=a.limit;
queryParams.pageSize = a.limit;
ElMessage.success("查询成功");
loading.value = false;
}
const loadLogs = () => {
let ajaxs = info.dataList.filter(it => it.state == 0).map(it => {
return LogsApi.inferenceTaskLatest(it.task_id)
});
request.all(ajaxs).then(d => {
debugger
});
};
const loadData = () => {
loading.value = true;
TaskApi.running().then(d => {
loading.value = false;
info.dataList = (d.data.data.running_task_list || []).map(it => {
it.device_name = (it.device_list || []).map(item => item.device_name).join(",");
it.state = 0;
return it;
});
loadLogs();
});
}
onMounted(loadData);
let tableData=reactive([
{id:"1",taskName:"人脸识别推理1",modelName:'进行人员检测的模型1',modelType:'图像分类',netName:'我的互联名称',datasName:'模型名称模型名称模型名称1',createUser:'User',devName:'Mobile-Vit',state:0},
{id:"2",taskName:"人脸识别推理2",modelName:'进行人员检测的模型2',modelType:'图像分类',netName:'我的互联名称',datasName:'模型名称模型名称模型名称2',createUser:'User',devName:'Mobile-Vit',state:1},
{id:"3",taskName:"人脸识别推理3",modelName:'进行人员检测的模型3',modelType:'图像分类',netName:'我的互联名称',datasName:'模型名称模型名称模型名称3',createUser:'User',devName:'Mobile-Vit',state:0},
{id:"4",taskName:"人脸识别推理4",modelName:'进行人员检测的模型4',modelType:'图像分类',netName:'我的互联名称',datasName:'模型名称模型名称模型名称4',createUser:'User',devName:'Mobile-Vit',state:1}
])
</script>
<style lang='scss'>
.simulation-execution{
.split-log{
font-size: 12px;
.el-card__body{
padding:8px;
}
<style lang='scss'>
.simulation-execution {
.split-log {
font-size: 12px;
.el-card__body {
padding: 8px;
}
.run-state{
&.state-0{
color:var(--el-color-primary);
}
&.state-1{
color:var(--el-color-success);
}
}
.run-state {
&.state-0 {
color: var(--el-color-primary);
}
&.state-1 {
color: var(--el-color-success);
}
}
}
</style>

View File

@ -15,19 +15,18 @@
</el-form>
</div>
<el-card>
<el-table v-loading="loading" :data="tableData" stripe @selection-change="handleSelectionChange">
<el-table-column label="任务名称" align="left" prop="taskName" />
<el-table-column label="任务说明" align="left" prop="desc" />
<el-table-column label="使用数据集" align="left" prop="dataSet" />
<el-table-column label="运行模型" align="left" prop="model" width="120"/>
<el-table-column label="模型网络" align="left" prop="netName" width="120"/>
<el-table-column label="创建时间" align="left" prop="crTime" width="120"/>
<el-table v-loading="loading" :data="info.tableData" stripe @selection-change="handleSelectionChange">
<el-table-column label="任务名称" align="left" prop="task_name" />
<el-table-column label="任务说明" align="left" prop="task_desc" />
<el-table-column label="使用数据集" align="left" prop="data_set_name" />
<el-table-column label="运行模型" align="left" prop="model_name" width="120" />
<el-table-column label="模型网络" align="left" prop="modl_net_type" width="120" />
<el-table-column label="创建时间" align="left" prop="crTime" width="120" />
<el-table-column label="操作" fixed="right" align="center" width="200">
<template #default="scope">
<el-button text type="primary" size="small"
@click="doShowDetail(scope.row)"><i-ep-view />查看报告</el-button>
<el-button text type="primary" size="small"
@click="doDelete(scope.row)"><i-ep-close-bold/>删除</el-button>
<el-button text type="primary" size="small" @click="doShowDetail(scope.row)"><i-ep-view />查看报告</el-button>
<el-button text type="primary" v-if="1 == 2" size="small"
@click="doDelete(scope.row)"><i-ep-close-bold />删除</el-button>
</template>
</el-table-column>
</el-table>
@ -41,48 +40,56 @@
</template>
<script setup>
import TaskApi from '@/api/task'
const queryFormRef = ref(ElForm); //
const router = useRouter();
const loading = ref(false); //
const queryParams = reactive({
pageNum: 1,
pageSize: 10,
keywords: '',
});
const total = ref(100); //
const total = ref(0); //
let info = reactive({
tableData: []
})
/** 查询 */
function handleQuery() {
loading.value = true;
ElMessage.success("查询成功");
loading.value = false;
loadData();
}
let tableData=reactive([
{id:"1",taskName:"模型名称模型名称模型名称1",desc:"进行10种类型 的目标分类模型查看",dataSet:"图像分类",model:"人脸模型",netName:"VIT",crTime:'2024-02-02'},
{id:"2",taskName:"模型名称模型名称模型名称2",desc:"进行10种类型 的目标分类模型查看",dataSet:"图像分类",model:"人脸模型",netName:"VIT",crTime:'2024-02-02'},
{id:"3",taskName:"模型名称模型名称模型名称3",desc:"进行10种类型 的目标分类模型查看",dataSet:"图像分类",model:"人脸模型",netName:"VIT",crTime:'2024-02-02'},
{id:"4",taskName:"模型名称模型名称模型名称4",desc:"进行10种类型 的目标分类模型查看",dataSet:"图像分类",model:"人脸模型",netName:"VIT",crTime:'2024-02-02'},
]);
const doDelete=(row)=>{
const doDelete = (row) => {
ElMessageBox.confirm("确认删除?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(function () {
let idx=tableData.indexOf(row);
if(idx>=0){
tableData.splice(idx,1);
let idx = tableData.indexOf(row);
if (idx >= 0) {
tableData.splice(idx, 1);
ElMessage.success("删除成功");
}
});
}
const doShowDetail=row=>{
router.push({ path: "/simulationEvaluation/taskDesc",query:{...row} });
const doShowDetail = row => {
router.push({ path: "/simulationEvaluation/taskDesc", query: { ...row } });
}
const loadData = () => {
loading.value = true;
TaskApi.tasks(queryParams).then(d => {
loading.value = false;
total.value = d.data.data.total || 0;
info.tableData = (d.data.data.task_list || []).map(it => {
it.device_name = (it.device_list || []).map(item => item.device_name).join(",");
return it;
})
})
}
onMounted(loadData);
</script>
<style lang='scss'>
.simulation-his-task-list {