update code
parent
89411ba864
commit
01f1d3c88a
|
@ -1,55 +1,67 @@
|
|||
import request from "@/utils/request";
|
||||
const serverState=()=>{
|
||||
return request({
|
||||
url: "/logs/server_state",
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
//获取用户操作状态通知
|
||||
const userOperationNotice=()=>{
|
||||
return request({
|
||||
url: "/logs/user_operation/notice",
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
const userRunning=()=>{
|
||||
const serverState = () => {
|
||||
return request({
|
||||
url:`/logs/user_operation/running`,
|
||||
method:"get"
|
||||
})
|
||||
}
|
||||
url: "/logs/server_state",
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
//获取用户操作状态通知
|
||||
const userOperationNotice = () => {
|
||||
return request({
|
||||
url: "/logs/user_operation/notice",
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
const userRunning = () => {
|
||||
return request({
|
||||
url: `/logs/user_operation/running`,
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
//获取用户操作详情
|
||||
const userOperation=(operation_id)=>{
|
||||
return request({
|
||||
url: `/logs/user_operation/${operation_id}`,
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
const userOperation = (operation_id) => {
|
||||
return request({
|
||||
url: `/logs/user_operation/${operation_id}`,
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
//获取编译部署日志
|
||||
const compileDeploy=(operation_id)=>{
|
||||
return request({
|
||||
url: `/logs/compile_deploy/${operation_id}`,
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
const compileDeploy = (operation_id, LatestTime) => {
|
||||
let url = `/logs/compile_deploy/${operation_id}`;
|
||||
if (LatestTime) {
|
||||
url += "?latestTime=" + LatestTime;
|
||||
}
|
||||
return request({
|
||||
url: url,
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
//获取推理最新的模型推理日志
|
||||
const inferenceTaskLatest=(task_id,DeviceId)=>{
|
||||
return request({
|
||||
url: `/logs/inference/${task_id}/latest?DeviceId=${DeviceId}&LogCount=50`,
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
const inferenceTask = (task_id, DeviceId, dt) => {
|
||||
return request({
|
||||
url: `/logs/inference/${task_id}?deviceId=${DeviceId}&startTime=${dt}&page_num=1&page_size=100`,
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
//获取推理最新的模型推理日志
|
||||
const inferenceTaskLatest = (task_id, DeviceId) => {
|
||||
return request({
|
||||
url: `/logs/inference/${task_id}/latest?DeviceId=${DeviceId}&LogCount=50`,
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
export default {
|
||||
serverState,
|
||||
userOperationNotice,
|
||||
serverState,
|
||||
userOperationNotice,
|
||||
userOperation,
|
||||
compileDeploy,
|
||||
userRunning,
|
||||
inferenceTaskLatest
|
||||
|
||||
}
|
||||
inferenceTaskLatest,
|
||||
inferenceTask,
|
||||
};
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<addStep1 ref="step1" v-if="active == 1" />
|
||||
<addStep2 ref="step2" v-if="active == 2" />
|
||||
<addStep3 ref="step3" v-if="active==3" :modelInfo="modelInfo"/>
|
||||
<addStep4 ref="step4" v-if="active == 4" :modelInfo="modelInfo" @compile="doCompile" />
|
||||
<addStep4 ref="step4" v-if="active == 4" :modelInfo="modelInfo" @compile="doCompile" @selection="step4Selection" />
|
||||
<addStep5 ref="step5" v-if="active == 5" />
|
||||
</div>
|
||||
<el-card class="card-footer">
|
||||
|
@ -57,14 +57,15 @@ let modelInfo = reactive({});
|
|||
let state = ref(0);
|
||||
|
||||
let info = reactive({
|
||||
devices: [],
|
||||
devices: {},
|
||||
taskInfo: null,
|
||||
optIds: [],
|
||||
logs: [],
|
||||
datas: null,
|
||||
taskId: 0,
|
||||
inferenceId: 0,
|
||||
parameters:''
|
||||
parameters:'',
|
||||
latestTime:'',
|
||||
})
|
||||
//开始推理
|
||||
const doStart = () => {
|
||||
|
@ -86,25 +87,19 @@ const doAddTask = () => {
|
|||
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
|
||||
}
|
||||
})
|
||||
task_params: info.parameters,
|
||||
device_id:info.devices.device_id,
|
||||
tool_params_id:info.devices.tool_params_id,
|
||||
tool_id:info.devices.tool_id
|
||||
}
|
||||
taskApi.addTask(postData).then(d => {
|
||||
info.taskId = d.data?.data?.task_id || 0;
|
||||
startInference()
|
||||
startInference(d)
|
||||
});
|
||||
};
|
||||
//开始推理
|
||||
const startInference = () => {
|
||||
//创建推理任务
|
||||
let postData = {}
|
||||
inferenceApi.startInference(postData).then(d => {
|
||||
const startInference = (d) => {
|
||||
//创建推理任务
|
||||
info.inferenceId = d.data?.data?.operation_id || 0;
|
||||
if (info.inferenceId > 0) {
|
||||
ElMessage.success("创建推理任务成功!");
|
||||
|
@ -112,13 +107,16 @@ const startInference = () => {
|
|||
router.push({ path: "/simulationEvaluation/execution" });
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
const step4Selection=row=>{
|
||||
info.devices=row;
|
||||
state.value=3;
|
||||
}
|
||||
const doCompile = (row) => {
|
||||
let tmp = row;
|
||||
if (tmp) {
|
||||
info.devices = [tmp];
|
||||
info.devices = tmp;
|
||||
state.value = 1;
|
||||
step4.value.updateState(state.value);
|
||||
startComplie();//开始编译
|
||||
|
@ -129,16 +127,13 @@ const doCompile = (row) => {
|
|||
}
|
||||
//开始编译
|
||||
const startComplie = () => {
|
||||
let ajaxs = info.devices.map(d => {
|
||||
return inferenceApi.doCompile({
|
||||
//model_id: modelInfo.model_id,
|
||||
//modl_net_type: modelInfo.modl_net_type,
|
||||
tool_params_id: d.tool_params_id,
|
||||
tool_id: d.tool_id,
|
||||
device_id: d.device_id,
|
||||
let ajaxs =[ inferenceApi.doCompile({
|
||||
tool_params_id: info.devices.tool_params_id,
|
||||
tool_id: info.devices.tool_id,
|
||||
device_id: info.devices.device_id,
|
||||
connection_id: modelInfo.connection_id
|
||||
});
|
||||
})
|
||||
})
|
||||
];
|
||||
addLogs({ msg: "开始编译....", type: "info" })
|
||||
request.all(ajaxs).then(d => {
|
||||
info.optIds = d.map(it => {
|
||||
|
@ -160,10 +155,11 @@ const doGetComplieLogs = () => {
|
|||
let ajaxs = [];
|
||||
info.optIds.filter(d => d.state == 0).forEach(o => {
|
||||
ajaxs.push(logsApi.userOperation(o.id));
|
||||
ajaxs.push(logsApi.compileDeploy(o.id));
|
||||
ajaxs.push(logsApi.compileDeploy(o.id,info.latestTime));
|
||||
})
|
||||
|
||||
request.all(ajaxs).then(d => {
|
||||
info.latestTime=+new Date();//'2023-03-01T12:00:00Z';//new Date().toLocaleString();
|
||||
d.forEach((it, idx) => {
|
||||
let msg = it.data.data;
|
||||
if (msg.operation_result) {
|
||||
|
@ -177,58 +173,13 @@ const doGetComplieLogs = () => {
|
|||
if (info.optIds.filter(d => d.state == 0).length > 0) {
|
||||
setTimeout(doGetComplieLogs, 2000);
|
||||
} else {
|
||||
doDeploy();
|
||||
}
|
||||
});
|
||||
}
|
||||
const doDeploy = () => {
|
||||
state.value = 2;
|
||||
step4.value.updateState(state.value);
|
||||
addLogs({ msg: "开始部署....", type: 'info' })
|
||||
let ajaxs = info.devices.map(d => {
|
||||
return inferenceApi.doDeploy({
|
||||
model_id: modelInfo.model_id,
|
||||
modl_net_type: modelInfo.modl_net_type,
|
||||
device_id: d.device_id
|
||||
});
|
||||
});
|
||||
request.all(ajaxs).then(d => {
|
||||
info.optIds = d.map(it => {
|
||||
return {
|
||||
id: it.data.data.operation_id, //op_id
|
||||
state: 0 //状态 1为完成
|
||||
}
|
||||
});
|
||||
doGetDeployLogs();//获取编译日志
|
||||
})
|
||||
};
|
||||
|
||||
const doGetDeployLogs = () => {
|
||||
let ajaxs = [];
|
||||
info.optIds.filter(d => d.state == 0).forEach(o => {
|
||||
ajaxs.push(logsApi.userOperation(o.id));
|
||||
ajaxs.push(logsApi.compileDeploy(o.id));
|
||||
})
|
||||
request.all(ajaxs).then(d => {
|
||||
d.forEach((it, idx) => {
|
||||
let msg = it.data.data;
|
||||
if (msg.operation_result) {
|
||||
addLogs({ msg: msg.operation_result });
|
||||
info.optIds[idx].state = msg.operation_finished ? 1 : 0;
|
||||
}
|
||||
if (msg.log_msg) {
|
||||
addLogs({ msg: `[${msg.update_time}${msg.logs_level}]${msg.log_msg}` })
|
||||
}
|
||||
});
|
||||
if (info.optIds.filter(d => d.state == 0).length > 0) {
|
||||
setTimeout(doGetDeployLogs, 2000);
|
||||
} else {
|
||||
addLogs({ msg: "编译部署完成", type: 'success' })
|
||||
//doDeploy();
|
||||
state.value = 3;
|
||||
step4.value.updateState(state.value);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
const doPrev = () => {
|
||||
active.value--;
|
||||
|
|
|
@ -34,9 +34,10 @@
|
|||
</template>
|
||||
|
||||
<el-table v-loading="loading" ref="dataTb" :data="info.tableData" stripe @row-click="doRowClick">
|
||||
<el-table-column width="55" v-if="1 == 2">
|
||||
<el-table-column width="55" >
|
||||
<template #default="scope">
|
||||
<el-checkbox v-model="scope.row.checked" :disabled="!scope.row.available" />
|
||||
<el-radio v-model="modelSelection" :label="scope.row.id + ''" :disabled="scope.row.working_state!='idle'"
|
||||
@change="handleChange(scope.row)"> </el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备名称" align="left" prop="device_name" />
|
||||
|
@ -46,7 +47,7 @@
|
|||
<el-table-column label="部署时间" align="left" prop="deployed_time" width="160" />
|
||||
<el-table-column label="量化和编译参数" align="left" prop="tool_params_name" width="160">
|
||||
<template #default="scope">
|
||||
<span class="args-state state-2 command" @click.stop="doChoice(scope.row)" v-if="scope.row.available">{{
|
||||
<span class="args-state state-2 command" @click.stop="doChoice(scope.row)" v-if="scope.row.working_state=='idle'">{{
|
||||
scope.row.tool_params_name ? scope.row.tool_params_name : "请选择" }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -65,7 +66,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="100">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" @click="doCompile(scope.row)" text v-if="scope.row.available"
|
||||
<el-button type="primary" @click="doCompile(scope.row)" text v-if="scope.row.working_state=='idle'"
|
||||
size="default">部署</el-button>
|
||||
<span v-else style="color: #888;">部署</span>
|
||||
</template>
|
||||
|
@ -90,7 +91,8 @@
|
|||
<script setup>
|
||||
import taskApi from "@/api/task";
|
||||
import choiceToolsParamDlg from './choiceToolsParamDlg.vue';
|
||||
const emit = defineEmits(["compile"]);
|
||||
const modelSelection = ref("")//单选id
|
||||
const emit = defineEmits(["compile","selection"]);
|
||||
const props = defineProps({
|
||||
modelInfo: {
|
||||
type: Object,
|
||||
|
@ -109,6 +111,16 @@ const doRowClick = (row, a, b) => {
|
|||
row.checked = !row.checked;
|
||||
}
|
||||
};
|
||||
const handleChange = (row) => {
|
||||
if (!row.tool_params_id) {
|
||||
ElMessage.error("请选择工具链运行参数列表!");
|
||||
modelSelection.value="";
|
||||
return;
|
||||
}
|
||||
modelSelection.value = row.device_id + "";
|
||||
emit("selection", row);
|
||||
}
|
||||
|
||||
const info = reactive({
|
||||
tableData: [],
|
||||
state: 0,
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useDateFormat } from "@vueuse/core";
|
||||
import TaskApi from '@/api/task'
|
||||
import LogsApi from '@/api/log'
|
||||
import request from "axios";
|
||||
|
@ -43,10 +44,7 @@ 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 logList = reactive([])
|
||||
const queryParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
|
@ -59,6 +57,7 @@ function handleQuery(a) {
|
|||
ElMessage.success("查询成功");
|
||||
loading.value = false;
|
||||
}
|
||||
//加载最后日志
|
||||
const loadLogs = () => {
|
||||
let ajaxs = info.dataList.filter(it => it.state == 0).map(it => {
|
||||
return LogsApi.inferenceTaskLatest(it.task_id,it.device_id)
|
||||
|
@ -72,7 +71,24 @@ const loadLogs = () => {
|
|||
});
|
||||
});
|
||||
};
|
||||
|
||||
//首次加载日志
|
||||
const loadFirstLogs=()=>{
|
||||
let dt=useDateFormat(new Date(),"YYYY-MM-DDTHH:mm:ssZ").value
|
||||
let ajaxs = info.dataList.filter(it => it.state == 0).map(it => {
|
||||
return LogsApi.inferenceTask(it.task_id,it.device_id,dt)
|
||||
});
|
||||
request.all(ajaxs).then(d => {
|
||||
d.forEach(res=>{
|
||||
let logs=res.data?.data?.latest_log_list||[];
|
||||
logs.forEach(log=>{
|
||||
logList.push(log);
|
||||
});
|
||||
});
|
||||
setTimeout(()=>{
|
||||
loadLogs();
|
||||
},2000);
|
||||
});
|
||||
};
|
||||
const loadData = () => {
|
||||
loading.value = true;
|
||||
TaskApi.running().then(d => {
|
||||
|
@ -82,11 +98,10 @@ const loadData = () => {
|
|||
it.state = 0;
|
||||
return it;
|
||||
});
|
||||
loadLogs();
|
||||
loadFirstLogs();
|
||||
});
|
||||
}
|
||||
onMounted(loadData);
|
||||
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
.simulation-execution {
|
||||
|
|
Loading…
Reference in New Issue