|
@@ -10,39 +10,27 @@
|
|
|
|
|
|
|
|
|
<el-tabs v-model="activeName" @tab-click="handleClick">
|
|
|
-
|
|
|
<el-tab-pane label="日志" name="first">
|
|
|
-
|
|
|
<div class="codemirrorContainer"
|
|
|
v-loading="loading"
|
|
|
element-loading-text="拼命加载中"
|
|
|
element-loading-spinner="el-icon-loading"
|
|
|
element-loading-background="rgba(0, 0, 0, 0.8)">
|
|
|
-
|
|
|
-
|
|
|
<codemirror
|
|
|
ref="cm"
|
|
|
v-model="output"
|
|
|
:options="cmOptions"
|
|
|
></codemirror>
|
|
|
-
|
|
|
</div>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
</el-tab-pane>
|
|
|
|
|
|
<el-tab-pane label="算法监控" name="second">
|
|
|
<iframe class="iframe" v-bind:src="url" scrolling="no" frameborder="0">
|
|
|
-
|
|
|
</iframe>
|
|
|
-
|
|
|
- <!-- <img class="iframe" src="./tensorboard.png"> -->
|
|
|
-
|
|
|
</el-tab-pane>
|
|
|
|
|
|
<el-tab-pane label="算法代码" name="third">
|
|
|
- <el-table :data="pythonFiles" border v-loading="dataListLoading" @selection-change="selectionChangeHandle"
|
|
|
+ <el-table :data="pythonFiles" border v-loading="dataListLoading"
|
|
|
style="width: 100%;">
|
|
|
<el-table-column type="selection" header-align="center" align="center" width="50">
|
|
|
</el-table-column>
|
|
@@ -63,7 +51,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
|
|
|
+ <el-pagination :current-page="pageIndex"
|
|
|
:page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="pythonFilesTotalPage"
|
|
|
layout="total, sizes, prev, pager, next, jumper">
|
|
|
</el-pagination>
|
|
@@ -71,7 +59,7 @@
|
|
|
|
|
|
|
|
|
<el-tab-pane label="数据集" name="forth">
|
|
|
- <el-table :data="datasetFiles" border v-loading="dataListLoading" @selection-change="selectionChangeHandle"
|
|
|
+ <el-table :data="datasetFiles" border v-loading="dataListLoading"
|
|
|
style="width: 100%;">
|
|
|
<el-table-column type="selection" header-align="center" align="center" width="50">
|
|
|
</el-table-column>
|
|
@@ -92,13 +80,13 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
|
|
|
+ <el-pagination :current-page="pageIndex"
|
|
|
:page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="datasetFilesTotalPage"
|
|
|
layout="total, sizes, prev, pager, next, jumper">
|
|
|
</el-pagination>
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
- <TrainFileWatch v-if="trainFileWatchVisible" ref="trainFileWatch"></TrainFileWatch>
|
|
|
+ <TrainFileWatch ref="trainFileWatch"></TrainFileWatch>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -175,7 +163,6 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- trainFileWatchVisible:false,
|
|
|
dataList: [],
|
|
|
pythonFiles:[],
|
|
|
datasetFiles:[],
|
|
@@ -183,7 +170,6 @@ export default {
|
|
|
pageSize: 10,
|
|
|
pythonFilesTotalPage: 0,
|
|
|
datasetFilesTotalPage: 0,
|
|
|
-
|
|
|
algorithmNameToVersion: null,
|
|
|
verisionToFile:null,
|
|
|
loading:true,
|
|
@@ -192,7 +178,8 @@ export default {
|
|
|
algorithmTrainingId:null,
|
|
|
missStatus:null,
|
|
|
output:"",
|
|
|
- url:"",
|
|
|
+ url: undefined,
|
|
|
+ dataListLoading: false,
|
|
|
cmOptions: {
|
|
|
// 语言及语法模式
|
|
|
//mode: 'text/x-python',
|
|
@@ -219,158 +206,197 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
activated() {
|
|
|
- let algorithmTrainingId=this.$route.query.algorithmTrainingId;
|
|
|
- let missStatus=this.$route.query.missStatus;
|
|
|
- this.init(algorithmTrainingId,missStatus);
|
|
|
+ this.init(this.$route.query.algorithmTrainingId, this.$route.query.missStatus);
|
|
|
//如果状态不是待开始或者暂停中,就去轮询访问日志
|
|
|
- if(missStatus!=1&&missStatus!=7){
|
|
|
- this.timer=window.setInterval(()=>{
|
|
|
- setTimeout(()=>{
|
|
|
- console.log("执行定时任务");
|
|
|
- this.getOutput();
|
|
|
- },0)
|
|
|
- },1000);
|
|
|
- }
|
|
|
+ // if(missStatus!=1&&missStatus!=7){
|
|
|
+ // this.timer=window.setInterval(()=>{
|
|
|
+ // setTimeout(()=>{
|
|
|
+ // console.log("执行定时任务");
|
|
|
+ // this.getOutput();
|
|
|
+ // },0)
|
|
|
+ // },1000);
|
|
|
+ // }
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
- init(id,missStatus){
|
|
|
- this.loading=true;
|
|
|
- this.activeName="first";
|
|
|
- this.algorithmTrainingId=id;
|
|
|
- this.missStatus=missStatus;
|
|
|
- this.output="";
|
|
|
- this.pythonFiles=[];
|
|
|
- this.datasetFiles=[];
|
|
|
- if(missStatus!=1)
|
|
|
- this.getOutput();
|
|
|
- else{
|
|
|
- this.output="该训练任务未运行";
|
|
|
- this.loading=false;
|
|
|
- };
|
|
|
- //根据algorithmTrainingId获得algId及versionId
|
|
|
- this.$http({
|
|
|
- url:this.$http.adornUrl('/algstrain/getAlgIdVersionId'),
|
|
|
- method:'get',
|
|
|
- params:this.$http.adornParams({
|
|
|
- algorithmTrainingId:this.algorithmTrainingId
|
|
|
- }),
|
|
|
- }).then(({data})=>{
|
|
|
- this.algorithmNameToVersion=data.algorithmNameToVersion;
|
|
|
- this.verisionToFile=data.verisionToFile;
|
|
|
- this.getDataList();
|
|
|
- });
|
|
|
- //this.getDataList();
|
|
|
+ // 初始化方法
|
|
|
+ init(id, missStatus) {
|
|
|
+ this.loading = true;
|
|
|
+ this.activeName = "first";
|
|
|
+ this.algorithmTrainingId = id;
|
|
|
+ this.missStatus = missStatus;
|
|
|
+ this.output = "";
|
|
|
+ this.pythonFiles = [];
|
|
|
+ this.datasetFiles = [];
|
|
|
+ if (missStatus != 1) {
|
|
|
+ this.getOutput();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.output = "该训练任务未运行";
|
|
|
+ this.loading = false;
|
|
|
+ };
|
|
|
+ // // 根据algorithmTrainingId获得algId及versionId
|
|
|
+ // this.$http({
|
|
|
+ // url:this.$http.adornUrl('/algstrain/getAlgIdVersionId'),
|
|
|
+ // method:'get',
|
|
|
+ // params:this.$http.adornParams({
|
|
|
+ // algorithmTrainingId:this.algorithmTrainingId
|
|
|
+ // }),
|
|
|
+ // }).then(({data})=>{
|
|
|
+ // console.log('data :>> ', data);
|
|
|
+ // this.algorithmNameToVersion=data.algorithmNameToVersion;
|
|
|
+ // this.verisionToFile=data.verisionToFile;
|
|
|
+ // // this.getDataList();
|
|
|
+ // });
|
|
|
+ // //this.getDataList();
|
|
|
},
|
|
|
|
|
|
redirectHandle() {
|
|
|
this.$router.replace({ path: "/alg-algs" });
|
|
|
},
|
|
|
- getOutput(){
|
|
|
+ // 获取输出日志
|
|
|
+ getOutput() {
|
|
|
this.$http({
|
|
|
- url:this.$http.adornUrl('/algstrain/getOutput'),
|
|
|
- method:'get',
|
|
|
- params:this.$http.adornParams({
|
|
|
- algorithmTrainingId:this.algorithmTrainingId
|
|
|
- }),
|
|
|
- }).then(({data})=>{
|
|
|
- this.$nextTick(()=>{
|
|
|
- this.output=data.output;
|
|
|
- this.loading=false;
|
|
|
- });
|
|
|
- });
|
|
|
+ url:this.$http.adornUrl('/algstrain/getOutput'),
|
|
|
+ method:'get',
|
|
|
+ params:this.$http.adornParams({
|
|
|
+ algorithmTrainingId:this.algorithmTrainingId
|
|
|
+ }),
|
|
|
+ }).then(({data})=>{
|
|
|
+ this.output=data.output;
|
|
|
+ this.loading=false;
|
|
|
+ });
|
|
|
},
|
|
|
-
|
|
|
handleClick(tab, event) {
|
|
|
- console.log(tab, event);
|
|
|
- if(tab.name == 'second'){
|
|
|
- console.log("切换到算法监控")
|
|
|
+ if (tab.name === "first") {
|
|
|
+ this.getOutput();
|
|
|
+ } else if (tab.name === "second") {
|
|
|
+ if (this.url == undefined || this.url == null) {
|
|
|
this.$http({
|
|
|
url: this.$http.adornUrl("/algstrain/info/" + this.algorithmTrainingId),
|
|
|
method: "get",
|
|
|
params: this.$http.adornParams(),
|
|
|
}).then(({ data }) => {
|
|
|
if (data && data.code === 0) {
|
|
|
- this.url=data.algTrain.ipAddress;
|
|
|
-
|
|
|
+ this.url = data.algTrain.ipAddress;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ } else {
|
|
|
+ if (this.pythonFiles.length == 0 || this.pythonFiles == null) {
|
|
|
+ this.getDataList();
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
// 获取代码文件列表
|
|
|
- getDataList() {
|
|
|
- this.dataListLoading = true;
|
|
|
- this.$http({
|
|
|
- url: this.$http.adornUrl("/algstrain/listFiles/"),
|
|
|
- method: "get",
|
|
|
- params: this.$http.adornParams({
|
|
|
- page: this.pageIndex,
|
|
|
- limit: this.pageSize,
|
|
|
- algorithmNameToVersion:this.algorithmNameToVersion,
|
|
|
- verisionToFile:this.verisionToFile
|
|
|
- }),
|
|
|
- }).then(({ data }) => {
|
|
|
- if (data && data.code === 0) {
|
|
|
- this.pythonFiles = data.pythonFiles;
|
|
|
- this.datasetFiles = data.datasetFiles;
|
|
|
- this.pythonFilesTotalPage = data.pythonFiles.length;
|
|
|
- } else {
|
|
|
- this.pythonFiles = [];
|
|
|
- this.datasetFiles = [];
|
|
|
- this.pythonFilesTotalPage = 0;
|
|
|
- this.datasetFilesTotalPage = 0;
|
|
|
- }
|
|
|
- this.dataListLoading = false;
|
|
|
- });
|
|
|
+ async getDataList() {
|
|
|
+ this.dataListLoading = true;
|
|
|
+ const { data } = await this.$http({
|
|
|
+ url:this.$http.adornUrl('/algstrain/getAlgIdVersionId'),
|
|
|
+ method:'get',
|
|
|
+ params:this.$http.adornParams({
|
|
|
+ algorithmTrainingId: this.algorithmTrainingId
|
|
|
+ }),
|
|
|
+ });
|
|
|
+
|
|
|
+ if (data.code != 0) {
|
|
|
+ this.dataListLoading = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // console.log('data :>> ', data);
|
|
|
+ this.algorithmNameToVersion = data.algTrain.algorithmId;
|
|
|
+ this.verisionToFile = data.algTrain.versionId;
|
|
|
+ this.algFrameId = data.algTrain.algFrameId;
|
|
|
+ this.categoryName = data.category.categoryName;
|
|
|
+ const res = await this.$http({
|
|
|
+ url: this.$http.adornUrl("/algstrain/listFiles/"),
|
|
|
+ method: "get",
|
|
|
+ params: this.$http.adornParams({
|
|
|
+ page: this.pageIndex,
|
|
|
+ limit: this.pageSize,
|
|
|
+ algorithmNameToVersion: this.algorithmNameToVersion,
|
|
|
+ verisionToFile: this.verisionToFile,
|
|
|
+ algFrameId: this.algFrameId
|
|
|
+ }),
|
|
|
+ })
|
|
|
+ if (res.data.code != 0) {
|
|
|
+ this.dataListLoading = false;
|
|
|
+ this.pythonFiles = [];
|
|
|
+ this.datasetFiles = [];
|
|
|
+ this.pythonFilesTotalPage = 0;
|
|
|
+ this.datasetFilesTotalPage = 0;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.pythonFiles = res.data.pythonFiles;
|
|
|
+ this.datasetFiles = res.data.datasetFiles;
|
|
|
+ this.pythonFilesTotalPage = res.data.pythonFiles.length;
|
|
|
+ this.dataListLoading = false;
|
|
|
+ // this.dataListLoading = true;
|
|
|
+ // this.$http({
|
|
|
+ // url: this.$http.adornUrl("/algstrain/listFiles/"),
|
|
|
+ // method: "get",
|
|
|
+ // params: this.$http.adornParams({
|
|
|
+ // page: this.pageIndex,
|
|
|
+ // limit: this.pageSize,
|
|
|
+ // algorithmNameToVersion:this.algorithmNameToVersion,
|
|
|
+ // verisionToFile:this.verisionToFile
|
|
|
+ // }),
|
|
|
+ // }).then(({ data }) => {
|
|
|
+ // if (data && data.code === 0) {
|
|
|
+ // this.pythonFiles = data.pythonFiles;
|
|
|
+ // this.datasetFiles = data.datasetFiles;
|
|
|
+ // this.pythonFilesTotalPage = data.pythonFiles.length;
|
|
|
+ // } else {
|
|
|
+ // this.pythonFiles = [];
|
|
|
+ // this.datasetFiles = [];
|
|
|
+ // this.pythonFilesTotalPage = 0;
|
|
|
+ // this.datasetFilesTotalPage = 0;
|
|
|
+ // }
|
|
|
+ // this.dataListLoading = false;
|
|
|
+ // });
|
|
|
},
|
|
|
|
|
|
//查看代码文件
|
|
|
- watchFile(fileName){
|
|
|
- this.trainFileWatchVisible=true;
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.trainFileWatch.init(this.algorithmNameToVersion,this.verisionToFile,fileName);
|
|
|
- });
|
|
|
+ watchFile(fileName) {
|
|
|
+ this.$refs.trainFileWatch.init(this.algorithmNameToVersion, this.verisionToFile, this.algFrameId, fileName);
|
|
|
},
|
|
|
//下载数据集
|
|
|
- downloadDataset(filename){
|
|
|
+ downloadDataset(filename) {
|
|
|
this.$http({
|
|
|
- url:this.$http.adornUrl('/dataset/downloadDataset'),
|
|
|
- method:'get',
|
|
|
- params:this.$http.adornParams({
|
|
|
- datasetName:filename
|
|
|
- }),
|
|
|
- }).then(({data})=>{
|
|
|
- if(data&&data.code===0){
|
|
|
- window.location.href=data.downloadUrl;
|
|
|
- }else{
|
|
|
- Message.error('下载失败');
|
|
|
- }
|
|
|
- });
|
|
|
+ url:this.$http.adornUrl('/dataset/downloadDataset'),
|
|
|
+ method:'get',
|
|
|
+ params:this.$http.adornParams({
|
|
|
+ datasetName: filename,
|
|
|
+ categoryName: this.categoryName || "",
|
|
|
+ bucketName: "algorithm"
|
|
|
+ }),
|
|
|
+ }).then(({data}) => {
|
|
|
+ if (data && data.code === 0) {
|
|
|
+ window.location.href = data.downloadUrl;
|
|
|
+ } else {
|
|
|
+ Message.error('下载失败');
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
-
|
|
|
},
|
|
|
-
|
|
|
mounted(){
|
|
|
-
|
|
|
this.$refs.cm.codemirror.setSize("auto", (document.documentElement.clientHeight - 200) + "px");
|
|
|
this.$nextTick(() => {
|
|
|
- window.addEventListener('resize', () => {
|
|
|
+ window.addEventListener('resize', () => {
|
|
|
//监听浏览器窗口大小改变
|
|
|
//浏览器变化执行动作
|
|
|
this.$refs.cm.codemirror.setSize("auto", (document.documentElement.clientHeight - 200) + "px")
|
|
|
});
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
+ });
|
|
|
},
|
|
|
//切换路由时,清楚定时器
|
|
|
beforeRouteLeave(to, from, next){
|
|
|
next();
|
|
|
- if (this.timer) {
|
|
|
- clearInterval(this.timer);
|
|
|
- this.timer = null;
|
|
|
- }
|
|
|
+ // if (this.timer) {
|
|
|
+ // clearInterval(this.timer);
|
|
|
+ // this.timer = null;
|
|
|
+ // }
|
|
|
},
|
|
|
|
|
|
};
|