@@ -80,12 +80,19 @@
</el-form-item>
</div>
<el-divider />
<el-form-item label="分布式" prop="distributed ">
<el-form-item label="分布式" prop="distributed" style="display:inline-block; ">
<el-select v-model="ruleForm.isDistributed" :disabled="true">
<el-option label="是" :value="true" />
<el-option label="否" :value="false" />
</el-select>
</el-form-item>
<div v-if="!show" style="display:inline-block;">
<el-form-item label="资源池" prop="resourcePool">
<el-select v-model="ruleForm.resourcePool" placeholder="请选择资源池" @change="changeDisResourceList">
<el-option v-for="(item, index) in poolList" :key="index" :label="item" :value="item" />
</el-select>
</el-form-item>
</div>
<div v-if="show">
<el-form-item label="运行命令" prop="command">
<el-input v-model="ruleForm.command" type="textarea" />
@@ -102,15 +109,23 @@
<el-button type="primary" @click="addItem">增加</el-button>
<el-button type="text" :disabled="showArg" @click="open">预览</el-button>
</el-form-item>
<el-form-item label="资源规格" prop="resourceSpecId">
<el-select v-model="ruleForm.resourceSpecId" placeholder="请选择资源规格" style="width:35%">
<el-option v-for="(item,index) in resourceOptions" :key="index" :label="item.label"
:value="item.value" />
</el-select>
</el-form-item>
<div>
<el-form-item label="资源池" prop="resourcePool" style="display:inline-block;">
<el-select v-model="ruleForm.resourcePool" placeholder="请选择资源池" @change="changeResourceList">
<el-option v-for="(item, index) in poolList" :key="index" :label="item" :value="item" />
</el-select>
</el-form-item>
<el-form-item label="资源规格" prop="resourceSpecId" style="display:inline-block;">
<el-select v-model="ruleForm.resourceSpecId" placeholder="请选择资源规格" @click.native="getResourceItem">
<el-option v-for="(item,index) in resourceOptions" :key="index" :label="item.label"
:value="item.value" />
</el-select>
</el-form-item>
</div>
</div>
<div v-if="!show">
<traningList :training-table="table" :resource="resourceOptions" @tableData="getTableData" />
<traningList :resourcePool="ruleForm.resourcePool" :training-table="table " @tableData="getTableData" />
</div>
</el-form>
<div slot="footer" class="dialog-footer">
@@ -125,6 +140,7 @@
</template>
<script>
import { mapGetters } from 'vuex'
import traningList from './traningList.vue'
import { createTask, getResourceList, editTemplate } from '@/api/trainingManager'
import { getPresetAlgorithmList, getPublicAlgorithmList, getMyAlgorithmList, getAlgorithmVersionList } from '@/api/modelDev'
@@ -148,6 +164,7 @@
},
data() {
return {
poolList: [],
// 模板id
id: '',
show: true,
@@ -179,6 +196,7 @@
}],
resourceSpecId: "",
resourcePool: "",
command: ''
},
@@ -214,6 +232,9 @@
],
resourceSpecId: [
{ required: true, message: '请选择活资源规格', trigger: 'change' }
],
resourcePool: [
{ required: true, message: "请选择资源池", trigger: "blur" }
]
},
formLabelWidth: '120px',
@@ -291,8 +312,10 @@
return flag
}
}
},
...mapGetters([
'workspaces'
])
},
watch: {
'ruleForm.isDistributed': {
@@ -302,7 +325,6 @@
}
}
},
created() {
this.algorithmName = true
@@ -311,46 +333,76 @@
this.dataSetName = true
this.dataSetVersion = true
// 获取模板信息
// 1编辑模块2创建训练任务
this.getResourceList()
this.getSpacePools()
},
methods: {
getSpacePools() {
let workspaceName = JSON.parse(sessionStorage.getItem('space')).workspaceName
this.workspaces.forEach(
item => {
// 获取当前群组绑定资源池列表
if(item.name == workspaceName) {
this.poolList = item.resourcePools
}
}
)
const data = JSON.parse(JSON.stringify(this.row))
this.temp.imageVersion = data.imageVersion
this.temp.algorithmId = data.algorithmId
this.temp.imageId = data.imageId
this.temp.dataSetId = data.dataSetId
this.id = data.id
delete this.row.createdAt
delete this.row.workspaceId
delete this.row.userId
delete this.row.updatedAt
delete this.row.id
delete this.row.imageVersion
this.ruleForm = this.row
this.ruleForm.imageId = this.row.imageName + ':' + this.temp.imageVersion
this.ruleForm.algorithmId = this.row.algorithmName
this.ruleForm.dataSetId = this.row.dataSetName
delete this.ruleForm.algorithmName
delete this.ruleForm.imageName
delete this.ruleForm.dataSetName
this.$set(this.ruleForm, "command", data.config[0].command)
this.$set(this.ruleForm, "resourceSpecId", data.config[0].resourceSpecId)
this.ruleForm.resourceSpecId = data.config[0].resourceSpecName + " " + data.config[0].resourceSpecPrice + "机时/h"
if (this.ruleForm.isDistributed) {
this.table = this.ruleForm.config
}
if (this.flag === 2) {
this.ruleForm.name = ''
}
this.getResourceList()
},
changeDisResourceList() {
this.resourceOptions = []
this.ruleForm.resourceSpecId = ""
this.table.forEach(
item => {
item.resourceSpecId = ""
}
)
},
changeResourceList() {
this.resourceOptions = []
this.ruleForm.resourceSpecId = ""
},
getResourceItem() {
this.resourceOptions = []
this.ruleForm.resourceSpecId = ""
this.getResourceList()
},
// 获取资源规格
getResourceList() {
getResourceList().then(response => {
getResourceList(this.row.resourcePool ).then(response => {
if (response.success) {
response.data.mapResourceSpecIdList.train.resourceSpecs.forEach(
item => {
this.resourceOptions.push({ label: item.name + ' ' + item.price + '机时/h', value: item.id })
}
)
const data = JSON.parse(JSON.stringify(this.row))
this.temp.imageVersion = data.imageVersion
this.temp.algorithmId = data.algorithmId
this.temp.imageId = data.imageId
this.temp.dataSetId = data.dataSetId
this.id = data.id
delete this.row.createdAt
delete this.row.workspaceId
delete this.row.userId
delete this.row.updatedAt
delete this.row.id
delete this.row.imageVersion
this.ruleForm = this.row
this.ruleForm.imageId = this.row.imageName + ':' + this.temp.imageVersion
this.ruleForm.algorithmId = this.row.algorithmName
this.ruleForm.dataSetId = this.row.dataSetName
delete this.ruleForm.algorithmName
delete this.ruleForm.imageName
delete this.ruleForm.dataSetName
this.$set(this.ruleForm, "command", data.config[0].command)
this.$set(this.ruleForm, "resourceSpecId", data.config[0].resourceSpecId)
if (this.ruleForm.isDistributed) {
this.table = this.ruleForm.config
}
if (this.flag === 2) {
this.ruleForm.name = ''
}
}
})
},
@@ -410,13 +462,23 @@
if (!this.ruleForm.isDistributed) {
this.ruleForm.config = [this.ruleForm.config[0]]
this.ruleForm.config[0].command = this.ruleForm.command
this.ruleForm.config[0].resourceSpecId = this.ruleForm.resourceSpecId
this.ruleForm.config[0].name = this.ruleForm.name
this.ruleForm.config[0].taskNumber = 1
this.ruleForm.config[0].minFailedTaskCount = 1
this.ruleForm.config[0].minSucceededTaskCount = 1
delete this.ruleForm.config[0].isMainRole
delete this.ruleForm.config[0].name
if(this.ruleForm.resourceSpecId.slice(-2) == "/h") {
this.resourceOptions.forEach(
item => {
if(item.label == this.ruleForm.resourceSpecId) {
this.ruleForm.config[0].resourceSpecId = item.value
}
}
)
} else {
this.ruleForm.config[0].resourceSpecId = this.ruleForm.resourceSpecId
}
}
var data = JSON.parse(JSON.stringify(this.ruleForm))
if (!this.algorithmChange) {