update code

main
haha 2024-07-20 00:34:54 +08:00
parent 0b63423b3b
commit df47cc4124
4 changed files with 140 additions and 71 deletions

View File

@ -16,7 +16,16 @@ const doDeploy=(data)=>{
})
}
const startInference=(data)=>{
return request({
url:'/inference/start',
method:'post',
data:data
})
}
export default{
doCompile,
doDeploy
doDeploy,
startInference
}

View File

@ -1,28 +1,36 @@
import request from "@/utils/request";
//获取任务列表
const tasks=()=>{
return request({
url:'/tasks',
method:'get'
})
}
//获取可用的设备状态
const availableDevices=()=>{
return request({
url:'/tasks/available_devices',
method:'get'
})
}
//获取正在执行的任务
const running=()=>{
return request({
url:'/tasks/running',
method:'get'
})
}
//创建推理任务
const addTask=(data)=>{
return request({
url:'/tasks',
method: 'post',
data:data
})
}
export default{
tasks,
availableDevices,
running
running,
addTask
}

View File

@ -1,81 +1,89 @@
<template>
<el-card style="margin-top:12px;position: relative;" class="simulation-add-add-step4">
<template #header>
<span>数据集列表</span>
<el-form ref="queryFormRef" :model="queryParams" :inline="true" style="flex-grow: 1;text-align: right;position: absolute;top:4px;right:0px;">
<el-form-item label="" prop="keywords">
<el-input v-model="queryParams.keywords" placeholder="请输入数据集名称" clearable style="width: 250px" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery"><i-ep-search />搜索</el-button>
</el-form-item>
</el-form>
</template>
<el-table v-loading="loading" :data="tableData" stripe @row-click="doRowClick">
<el-table-column align="center" width="55" label="选择">
<template #default="scope">
<el-radio v-model="datasSelection" :label="scope.row.id + ''"
@change="handleChange(scope.row)">&nbsp;</el-radio>
</template>
</el-table-column>
<el-table-column label="数据集名称" align="left" prop="datasName" />
<el-table-column label="版本" align="left" prop="ver" width="80"/>
<el-table-column label="数据集说明" align="left" prop="desc" />
<el-card style="margin-top:12px;position: relative;" class="simulation-add-add-step4">
<template #header>
<span>数据集列表</span>
<el-form ref="queryFormRef" :model="queryParams" :inline="true"
style="flex-grow: 1;text-align: right;position: absolute;top:4px;right:0px;">
<el-form-item label="" prop="dataset_name">
<el-input v-model="queryParams.dataset_name" placeholder="请输入数据集名称" clearable style="width: 250px" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery"><i-ep-search />搜索</el-button>
</el-form-item>
</el-form>
</template>
<el-table v-loading="loading" :data="info.tableData" stripe @row-click="doRowClick">
<el-table-column align="center" width="55" label="选择">
<template #default="scope">
<el-radio v-model="datasSelection" :label="scope.row.dataset_id + ''"
@change="handleChange(scope.row)">&nbsp;</el-radio>
</template>
</el-table-column>
<el-table-column label="数据集名称" align="left" prop="dataset_name" />
<el-table-column label="版本" align="left" prop="dataset_version" width="80" />
<el-table-column label="数据集说明" align="left" prop="dataset_desc" show-overflow-tooltip />
<el-table-column label="适用任务类型" align="left" prop="planType" />
<el-table-column label="图片数量" align="left" prop="imgCount" width="120" />
<el-table-column label="图片格式" width="120" align="left" prop="imgFmt" />
<el-table-column label="创建时间" align="left" prop="createTime" />
<el-table-column label="适用任务类型" align="left" prop="modl_sub_type" />
<el-table-column label="图片数量" align="left" prop="frame_count" width="120" />
<el-table-column label="数据集格式" width="120" align="left" prop="dats_dataset_format" />
<el-table-column label="创建时间" align="left" prop="createTime" />
</el-table>
<pagination v-if="total > 0" v-model:total="total" v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize" @pagination="handleQuery" />
</el-card>
</el-table>
<pagination v-if="total > 0" v-model:total="total" v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize" @pagination="handleQuery" />
</el-card>
</template>
<script setup>
import dataSetApi from '@/api/dataSet'
const datasSelection = ref("")//id
const loading=ref(false)
const queryFormRef=ref()
const loading = ref(false)
const queryFormRef = ref()
const queryParams = reactive({
pageNum: 1,
pageSize: 10,
keywords:''
dataset_name: ''
});
const total=ref(100)
const info = reactive({
tableData: []
})
let total = ref(100)
/** 查询 */
function handleQuery(a) {
queryParams.pageSize=a.limit;
ElMessage.success("查询成功");
if (a) {
queryParams.pageSize = a.limit;
queryParams.pageNum = a.page;
}
loading.value = true;
dataSetApi.list(queryParams).then(d => {
loading.value = false;
total.value = d.data?.data?.total || 0;
info.tableData = d.data?.data?.raw_dataset_list || [];
});
}
const handleChange = (row) => {
datasSelection.value = row.id + "";
datasSelection.value = row.dataset_id + "";
}
const doRowClick=(row,col,sel)=>{
datasSelection.value=row.id+"";
const doRowClick = (row, col, sel) => {
datasSelection.value = row.dataset_id + "";
}
let tableData=reactive([
{id:"1",datasName:"人员检测数据集1",ver:'V1',desc:'一些数据集说明',planType:'图像检测',imgCount:435566,imgFmt:'RGB24',createTime:'2024-06-09 18:32:13'},
{id:"2",datasName:"人员检测数据集2",ver:'V1',desc:'一些数据集说明',planType:'图像检测',imgCount:435566,imgFmt:'RGB24',createTime:'2024-06-09 18:32:13'},
{id:"3",datasName:"人员检测数据集3",ver:'V1',desc:'一些数据集说明',planType:'图像检测',imgCount:435566,imgFmt:'RGB24',createTime:'2024-06-09 18:32:13'},
{id:"4",datasName:"人员检测数据集4",ver:'V1',desc:'一些数据集说明',planType:'图像检测',imgCount:435566,imgFmt:'RGB24',createTime:'2024-06-09 18:32:13'},
{id:"5",datasName:"人员检测数据集5",ver:'V1',desc:'一些数据集说明',planType:'图像检测',imgCount:435566,imgFmt:'RGB24',createTime:'2024-06-09 18:32:13'},
])
const checkForm=()=>{
if(datasSelection.value){
let tmps=tableData.filter(d=>d.id==datasSelection.value);
return tmps.length>0?tmps[0]:null;
}
return null;
const checkForm = () => {
if (datasSelection.value) {
let tmps = info.tableData.filter(d => d.dataset_id == datasSelection.value);
return tmps.length > 0 ? tmps[0] : null;
}
return null;
};
onMounted(() => {
handleQuery();
});
defineExpose({
checkForm
checkForm
})
</script>
<style lang='scss'>
</style>
<style lang='scss'></style>

View File

@ -18,9 +18,11 @@
<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"></el-button>
<el-button type="primary" v-if="active > 0 && active <= 4 && active != 3" @click="doPrev"></el-button>
<template v-if="active == 3 && (state == 0 || state == 3)">
<el-button type="primary" v-if="active == 4" @click="doStart" :loading="state > 0" :disabled="state > 0">{{ state
==
0 ? "开始推理" : "推理中..." }}</el-button>
<el-button type="primary" v-if="active > 0 && active < 3 && active != 3" @click="doPrev"></el-button>
<template v-if="(active == 3 && (state == 0 || state == 3)) || (active == 4 && state == 0)">
<el-button type="primary" @click="doPrev"></el-button>
</template>
<template v-if="active == 3 && state == 3">
@ -34,6 +36,7 @@
<script setup>
import inferenceApi from '@/api/inference'
import logsApi from '@/api/log'
import taskApi from '@/api/task'
import request from 'axios'
import addStep1 from './addStep1.vue'
import addStep2 from './addStep2.vue'
@ -53,19 +56,59 @@ let info = reactive({
taskInfo: null,
optIds: [],
logs: [],
datas: null,
taskId: 0,
inferenceId: 0,
})
//
const doStart = () => {
let tmp = step4.value.checkForm();
if (tmp) {
datas = tmp;
ElMessage.success("开始执行!");
setTimeout(() => {
router.push({ path: "/simulationEvaluation/execution" });
}, 1000);
info.datas = tmp;
state.value = 1;
//startInference();
doAddTask();
} else {
ElMessage.error("请选择数据集!");
}
}
const doAddTask = () => {
let postData = {
task_name: info.taskInfo.taskName,
task_desc: info.taskInfo.taskDesc,
infr_task_type: info.taskInfo.taskType,
model_id: modelInfo.model_id,
connection_id: modelInfo.connection_id,
data_set_id: info.datas.dataset_id,
task_params: {},
device_list: info.devices.map(it => {
return {
device_id: it.device_id,
tool_params_id: it.tool_params_id,
tool_id: it.tool_id
}
})
}
taskApi.addTask(postData).then(d => {
info.taskId = d.data?.data?.task_id || 0;
startInference()
});
};
//
const startInference = () => {
//
let postData = {}
inferenceApi.startInference(postData).then(d => {
info.inferenceId = d.data?.data?.operation_id || 0;
if (info.inferenceId > 0) {
ElMessage.success("创建推理任务成功!");
setTimeout(() => {
router.push({ path: "/simulationEvaluation/execution" });
}, 1000);
}
});
}
const doCompile = () => {
let tmp = step3.value.checkForm();
if (tmp) {
@ -208,6 +251,7 @@ const doNext = () => {
}
} else if (active.value == 3) {
active.value++;
state.value = 0;
} else if (active.value == 4) {
} else {