Merge pull request 'fix' (#191) from annzee/JCC-RIP:cetc into master
This commit is contained in:
commit
a3924f22f3
|
@ -39,7 +39,8 @@
|
|||
"close": "Close",
|
||||
"userNameMsg": "Please enter the correct user name",
|
||||
"passwordMsg": "The password can not be less than 6 digits",
|
||||
"check": "Check"
|
||||
"check": "Check",
|
||||
"submit": "Submit"
|
||||
},
|
||||
"menu": {
|
||||
"taskManagement": "Task",
|
||||
|
@ -535,6 +536,19 @@
|
|||
"adapterCheckText": "After filling in the adapter information, click the Validate button. Check if the adapter is connected successfully; it must be connected successfully before you can click the Confirm button.",
|
||||
"bindClusterText": "After binding the cluster, return to the homepage to create a new task.",
|
||||
"newTask": "Add Task",
|
||||
"guideFinish": " Guidance has been completed."
|
||||
"guideFinish": " Guidance has been completed.",
|
||||
"taskInvocation": "Task Invocation",
|
||||
"taskCmdInput": "Task command input",
|
||||
"taskResult": "Task result output",
|
||||
"taskSimulateNum": "Number of task simulation",
|
||||
"picName": "Picture Name",
|
||||
"result": "Result",
|
||||
"pictureUpload": "Picture Upload",
|
||||
"createDeductiveTask": "Create Deductive Task",
|
||||
"image": "Image",
|
||||
"initFile": "Init File",
|
||||
"codeUpload": "Code Upload",
|
||||
"selectModel": "Select Model",
|
||||
"modelType": "Model Type"
|
||||
}
|
||||
}
|
|
@ -39,7 +39,8 @@
|
|||
"close": "关闭",
|
||||
"userNameMsg": "请输入正确的用户名",
|
||||
"passwordMsg": "密码不能少于6位",
|
||||
"check": "验证"
|
||||
"check": "验证",
|
||||
"submit": "提交"
|
||||
},
|
||||
"menu": {
|
||||
"taskManagement": "任务管理",
|
||||
|
@ -535,6 +536,19 @@
|
|||
"adapterCheckText": "填写完成适配器信息后,点击验证按钮。校验适配器是否连接成功,必须连接成功,才能点击确定保存。",
|
||||
"bindClusterText": "绑定集群后返回首页新建任务。",
|
||||
"newTask": "新建任务",
|
||||
"guideFinish": "引导已完成"
|
||||
"guideFinish": "引导已完成",
|
||||
"taskInvocation": "任务调用",
|
||||
"taskCmdInput": "任务指令输入",
|
||||
"taskResult": "任务结果输出",
|
||||
"taskSimulateNum": "任务模拟提交数",
|
||||
"picName": "图片名称",
|
||||
"result": "结果",
|
||||
"pictureUpload": "图片上传",
|
||||
"createDeductiveTask": "创建推理任务",
|
||||
"image": "镜像",
|
||||
"initFile": "启动文件",
|
||||
"codeUpload": "代码上传",
|
||||
"selectModel": "选择模型",
|
||||
"modelType": "模型类型"
|
||||
}
|
||||
}
|
|
@ -18,6 +18,23 @@ export const addVirtualMachine = (data) => {
|
|||
export const addNewApp = (params) => {
|
||||
return request({ url: '/pcm/v1/core/commitTask', method: 'post', params })
|
||||
}
|
||||
|
||||
export const addDeductiveTask = (data) => {
|
||||
return request({
|
||||
url: '/pcm/v1/inference/images',
|
||||
method: 'post',
|
||||
data,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
})
|
||||
}
|
||||
export const getModelType = () => {
|
||||
return request({ url: '/pcm/v1/inference/modelTypes', method: 'get' })
|
||||
}
|
||||
export const getModelName = (type) => {
|
||||
return request({ url: '/pcm/v1/inference/modelNames?type=' + type, method: 'get' })
|
||||
}
|
||||
export const getDetail = (name, params) => {
|
||||
return request({ url: '/pcm/v1/apps/detail/' + name, method: 'get', params })
|
||||
}
|
||||
|
|
|
@ -0,0 +1,277 @@
|
|||
<template>
|
||||
<div>
|
||||
<h3> {{ $t('page.createDeductiveTask') }} </h3>
|
||||
<el-alert
|
||||
v-if="!adapterId"
|
||||
:title="$t('page.selectDiver')"
|
||||
type="warning"
|
||||
show-icon
|
||||
/>
|
||||
<br>
|
||||
<el-form
|
||||
ref="formData"
|
||||
class="form-wrap"
|
||||
label-position="left"
|
||||
:model="formData"
|
||||
:rules="formDataRules"
|
||||
>
|
||||
<el-form-item :label="$t('page.taskName')" prop="taskName">
|
||||
<el-input
|
||||
v-model="formData.taskName"
|
||||
:placeholder="$t('page.inputWarn')"
|
||||
:max-length="30"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('page.taskDes')" prop="taskDesc">
|
||||
<el-input
|
||||
v-model="formData.taskDesc"
|
||||
:max-length="100"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item :label="$t('page.image')" prop="image">
|
||||
<el-radio-group v-model="formData.image" class="checkBox">
|
||||
<el-radio label="ac" />
|
||||
<el-radio label="slurm" />
|
||||
<el-radio label="paratera" />
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('page.datasetName')" prop="datasets">
|
||||
<el-select v-model="formData.datasets" style="width: 280px;margin-right: 10px;">
|
||||
<el-option v-for="item in dataSetList" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item :label="$t('page.modelType')" prop="modelType">
|
||||
<el-select v-model="formData.modelType" style="width: 280px;margin-right: 10px;">
|
||||
<el-option v-for="item in modelTypeList" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('page.selectModel')" prop="modelName">
|
||||
<el-select v-model="formData.modelName" style="width: 280px;margin-right: 10px;">
|
||||
<el-option v-for="item in modelNameList" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('page.pictureUpload')">
|
||||
<!-- <el-input v-model="taskInput" type="textarea" rows="10" /> -->
|
||||
<el-upload
|
||||
ref="upload"
|
||||
class="upload-demo"
|
||||
:file-list="fileList"
|
||||
:auto-upload="false"
|
||||
action="#"
|
||||
:multiple="true"
|
||||
>
|
||||
<el-button slot="trigger" size="small">选取文件</el-button>
|
||||
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item :label="$t('page.codeUpload')" prop="codeUpload">
|
||||
<el-input
|
||||
v-model="formData.codeUpload"
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('page.initFile')" prop="initFile">
|
||||
<el-input
|
||||
v-model="formData.initFile"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('page.enVariable')">
|
||||
<el-button
|
||||
v-if="formData.envs.length === 0"
|
||||
type="primary"
|
||||
icon="el-icon-circle-plus"
|
||||
@click="appendEnvs"
|
||||
/>
|
||||
<template v-else>
|
||||
<div v-for="(env, index) in formData.envs" :key="env.id" class="network-wrap">
|
||||
<div class="list-item">
|
||||
<el-input v-model="env.key" placeholder="key" />
|
||||
</div>
|
||||
<div class="list-item">
|
||||
<span>=</span>
|
||||
</div>
|
||||
<div class="list-item">
|
||||
<el-input v-model="env.value" placeholder="value" />
|
||||
</div>
|
||||
<div class="list-item">
|
||||
<el-button
|
||||
v-if="index === 0"
|
||||
icon="el-icon-circle-plus"
|
||||
style="margin-right:8px"
|
||||
@click="appendEnvs"
|
||||
/>
|
||||
<el-button v-else icon="el-icon-delete-solid" @click="removeEnvs(index)" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('page.commandContent')" prop="cmdScript">
|
||||
<el-input
|
||||
v-model="formData.cmdScript"
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
|
||||
<h3> 静态策略 </h3>
|
||||
<!-- <div v-if="formData.strategy === 'staticWeight'"> -->
|
||||
<!-- staticWeightMap -->
|
||||
<el-form-item :label="$t('page.staticWeight')" prop="strategy">
|
||||
<table class="tableInput">
|
||||
<tr v-for="env in formData.staticWeightMap" :key="env.key">
|
||||
<td>{{ env.key }}</td>
|
||||
<td>
|
||||
<el-input-number
|
||||
v-model="env.value"
|
||||
size="small"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getModelName, getModelType, addDeductiveTask } from '@/api/task/task'
|
||||
import generate from 'nanoid/generate'
|
||||
import { getClusterList } from '@/api/container/cluster'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
adapterId: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
'taskName': 'deductiveTask-' + generate('abcdefghijklmnopqrstuvwxyz', 12),
|
||||
'taskDesc': '',
|
||||
'modelType': '',
|
||||
'modelName': '',
|
||||
'staticWeightMap': [],
|
||||
'strategy': 'staticWeight'
|
||||
},
|
||||
fileList: [],
|
||||
modelTypeList: [],
|
||||
modelNameList: [],
|
||||
currentClusterList: [],
|
||||
form: new FormData()
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
formDataRules() {
|
||||
return {
|
||||
taskName: [
|
||||
{ required: true, message: this.$t('check.input') + this.$t('message.name') }
|
||||
// {
|
||||
// pattern: /^[a-z]([-a-z0-9]*[a-z0-9])?$/,
|
||||
// message: this.$t('check.inputInvalid')
|
||||
// }
|
||||
// { validator: this.nameValidator }
|
||||
],
|
||||
taskDesc: [
|
||||
{ required: true, message: this.$t('check.input') + this.$t('page.taskDes') }
|
||||
],
|
||||
modelType: [{ required: true, message: this.$t('check.requireSelect'), trigger: 'change' }],
|
||||
modelName: [{ required: true, message: this.$t('check.requireSelect'), trigger: 'change' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'adapterId'() {
|
||||
const query = { 'type': '1', 'adapterId': this.formData.adapterId, pageNum: 1, pageSize: 1000 }
|
||||
getClusterList(query).then(e => {
|
||||
// this.currentClusterList =
|
||||
(e.data.list || []).forEach(e => {
|
||||
this.formData.staticWeightMap.push({ key: e.name, id: e.id, value: 0 })
|
||||
})
|
||||
})
|
||||
},
|
||||
'formData.modelType'(val) {
|
||||
if (val) {
|
||||
this.formData.modelName = ''
|
||||
getModelName(val).then(e => {
|
||||
this.modelNameList = e.data.models
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
getModelType().then(e => {
|
||||
this.modelTypeList = e.data.types
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
submitUpload() {
|
||||
// console.log(formData)
|
||||
|
||||
// 阻止默认上传行为
|
||||
return false
|
||||
},
|
||||
handleSuccess() {
|
||||
|
||||
},
|
||||
// httpRequest(data) {
|
||||
// const isJar = data.file.name.indexOf('.yaml') === (data.file.name.length - 5)
|
||||
// if (!isJar) {
|
||||
// this.$message.error(this.$t('page.yamlWarn'))
|
||||
// }
|
||||
// },
|
||||
appendEnvs() {
|
||||
this.formData.envs.push(
|
||||
{
|
||||
key: '',
|
||||
value: ''
|
||||
}
|
||||
)
|
||||
},
|
||||
removeEnvs(i) {
|
||||
this.formData.envs.splice(i, 1)
|
||||
},
|
||||
checkForm() {
|
||||
let returnVal
|
||||
this.$refs.formData.validate((valid) => {
|
||||
if (valid) {
|
||||
const form = new FormData()
|
||||
this.$refs.upload.uploadFiles.forEach((file, index) => {
|
||||
form.append(`images`, file.raw)
|
||||
})
|
||||
const obj = {}
|
||||
this.formData.staticWeightMap.forEach(e => {
|
||||
obj[e.id.toString()] = e.value
|
||||
})
|
||||
form.set('taskName', this.formData.taskName)
|
||||
form.set('taskDesc', this.formData.taskDesc)
|
||||
form.set('modelType', this.formData.modelType)
|
||||
form.set('modelName', this.formData.modelName)
|
||||
form.set('staticWeightMap', JSON.stringify(obj))
|
||||
form.set('strategy', this.formData.strategy)
|
||||
form.set('adapterId', this.adapterId)
|
||||
|
||||
addDeductiveTask(form).then((e) => {
|
||||
if (e.code === 200) {
|
||||
this.$message.success('文件上传成功')
|
||||
this.$router.go(-1)
|
||||
} else {
|
||||
returnVal = false
|
||||
}
|
||||
})
|
||||
} else {
|
||||
returnVal = false
|
||||
}
|
||||
})
|
||||
return returnVal
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.form-wrap .el-form-item__label-wrap .el-form-item__label{
|
||||
text-indent: -1rem!important;
|
||||
}
|
||||
</style>
|
|
@ -44,8 +44,9 @@
|
|||
<div v-show="!selectCluster&&!strategySetting">
|
||||
<application-form v-show="cpType === 'cloud'&&taskType === 'application'" ref="application" />
|
||||
<hpc-create v-if="cpType === 'hpc'" ref="hpcBase" />
|
||||
<ai-create v-if="cpType === 'ai'" ref="aiBase" :type="taskType" :adapter-id="formData.adapterId" />
|
||||
<ai-create v-if="cpType === 'ai'&&taskType!=='deductive'" ref="aiBase" :type="taskType" :adapter-id="formData.adapterId" />
|
||||
<vm-form v-if="taskType === 'virtualmachine'" ref="virtualmachine" />
|
||||
<deductive-form v-if="taskType === 'deductive'" ref="deductive" :adapter-id="formData.adapterId" />
|
||||
</div>
|
||||
<!-- <div v-if="taskType === 'virtualmachine' && selectCluster">
|
||||
</div> -->
|
||||
|
@ -181,7 +182,6 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item :label="$t('page.performancePrice')" prop="strategy">
|
||||
<el-slider
|
||||
v-model="formData.b"
|
||||
|
@ -192,7 +192,6 @@
|
|||
show-stops
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
</div>
|
||||
|
||||
</el-form>
|
||||
|
@ -204,11 +203,11 @@
|
|||
<el-row type="flex" justify="end">
|
||||
<el-col :span="2.5">
|
||||
<el-button size="medium" @click="goBack">{{ $t("message.cancel") }}</el-button>
|
||||
<el-button v-if="!selectCluster&&!strategySetting&&taskType!=='aiCard'" size="medium" type="primary" @click="next">{{ $t('message.next') }}</el-button>
|
||||
<el-button v-if="!selectCluster&&!strategySetting&&taskType!=='aiCard'&&taskType!=='deductive'" size="medium" type="primary" @click="next">{{ $t('message.next') }}</el-button>
|
||||
<el-button v-if="selectCluster" size="medium" type="primary" @click="selectCluster=false">{{ $t('message.before') }}</el-button>
|
||||
<el-button v-if="selectCluster&&!strategySetting&&taskType!=='aiCard'" size="medium" type="primary" @click="setStrategy">{{ $t('message.next') }}</el-button>
|
||||
<el-button v-if="selectCluster&&!strategySetting&&taskType!=='aiCard'&&taskType!=='deductive'" size="medium" type="primary" @click="setStrategy">{{ $t('message.next') }}</el-button>
|
||||
<el-button v-if="strategySetting" size="medium" type="primary" @click="strategySetting=false;selectCluster=true">{{ $t('message.before') }}</el-button>
|
||||
<el-button v-if="strategySetting || taskType==='aiCard'" v-loading="submitLoading" size="medium" type="primary" @click="saveForm">{{ $t('message.create') }}</el-button>
|
||||
<el-button v-if="strategySetting || taskType==='aiCard' || taskType==='deductive'" v-loading="submitLoading" size="medium" type="primary" @click="saveForm">{{ $t('message.create') }}</el-button>
|
||||
<!-- <el-button size="medium" type="primary" @click="saveForm">{{ $t("message.easyCreate") }}</el-button> -->
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -224,11 +223,12 @@ import { getClusterList } from '@/api/container/cluster'
|
|||
import aiCreate from './components/aiCreate.vue'
|
||||
import { getAdapterList } from '@/api/pcm/adapter'
|
||||
import vmForm from './components/virtualmachineForm.vue'
|
||||
import deductiveForm from './components/deductiveForm.vue'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
// import jobForm from './components/jobForm.vue'
|
||||
export default {
|
||||
components: { applicationForm, List, hpcCreate, aiCreate, vmForm },
|
||||
components: { applicationForm, List, hpcCreate, aiCreate, vmForm, deductiveForm },
|
||||
data() {
|
||||
return {
|
||||
getClusterList,
|
||||
|
@ -259,7 +259,8 @@ export default {
|
|||
},
|
||||
'ai': {
|
||||
'aiBase': 'createAibase',
|
||||
'aiCard': 'createAiCard'
|
||||
'aiCard': 'createAiCard',
|
||||
'deductive': 'createDeductiveTask'
|
||||
}
|
||||
},
|
||||
adapterList: {
|
||||
|
@ -380,6 +381,10 @@ export default {
|
|||
list[i] = e.data.list.filter(r => r.type === '1')
|
||||
break
|
||||
}
|
||||
case 'deductive': {
|
||||
list[i] = e.data.list.filter(r => r.type === '1')
|
||||
break
|
||||
}
|
||||
default: {
|
||||
list[i] = e.data.list.filter(r => r.type === '0')
|
||||
break
|
||||
|
@ -433,7 +438,6 @@ export default {
|
|||
// if (this.taskType !== 'virtualmachine') {
|
||||
const type = this.taskType === 'aiCard' ? 'aiBase' : this.taskType
|
||||
const formHook = this.$refs[type].checkForm()
|
||||
// console.log(formHook)
|
||||
if (!formHook) return false
|
||||
// }
|
||||
this.getCluster()
|
||||
|
@ -451,6 +455,15 @@ export default {
|
|||
return false
|
||||
}
|
||||
const type = this.taskType === 'aiCard' ? 'aiBase' : this.taskType
|
||||
if (this.type === 'deductive') {
|
||||
this.submitLoading = true
|
||||
const formHook = this.$refs[type].checkForm()
|
||||
if (!formHook) {
|
||||
this.submitLoading = false
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
let formHook = this.$refs[type].checkForm()
|
||||
if (!formHook) return false
|
||||
if (this.taskType !== 'aiCard') {
|
||||
|
|
|
@ -39,6 +39,35 @@
|
|||
<p />
|
||||
<el-input v-model="log" type="textarea" rows="20" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane v-if="formData.clusterInfos" :label="$t('page.taskResult')">
|
||||
<el-form>
|
||||
<!-- <el-form-item :label="$t('page.taskCmdInput')">
|
||||
<el-input v-model="taskInput" type="textarea" rows="10" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('page.taskSimulateNum')">
|
||||
<el-input v-model="taskSimulateNum" style="width: 20%;" />
|
||||
</el-form-item>
|
||||
<el-button type="primary">{{ $t('message.submit') }}</el-button>
|
||||
<el-divider />
|
||||
<el-form-item :label="$t('page.taskResult')">
|
||||
<el-input v-model="taskOutput" type="textarea" rows="10" />
|
||||
</el-form-item> -->
|
||||
|
||||
<!-- <el-button type="primary" @click="submitUpload">{{ $t('message.submit') }}</el-button> -->
|
||||
<!-- <el-divider /> -->
|
||||
<el-form-item :label="$t('page.taskResult')">
|
||||
<List
|
||||
ref="multipleTable"
|
||||
:key="$i18n.locale"
|
||||
class="multipleTable"
|
||||
:columns="taskColumns"
|
||||
:table-list-data="taskResult"
|
||||
tooltip-effect="dark"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
</div>
|
||||
|
@ -62,6 +91,9 @@ export default {
|
|||
strategy: this.$t('page.policy'),
|
||||
synergyStatus: this.$t('page.synergyStatus')
|
||||
},
|
||||
taskInput: '',
|
||||
taskSimulateNum: '',
|
||||
taskOutput: '',
|
||||
cluster: '',
|
||||
formData: {
|
||||
'clusterInfos': [],
|
||||
|
@ -73,7 +105,14 @@ export default {
|
|||
'synergyStatus': '0'
|
||||
},
|
||||
activeName: '',
|
||||
log: ''
|
||||
log: '',
|
||||
taskResult: [{
|
||||
name: 'AAAAAAAAAAAAAA',
|
||||
clusterName: '1111',
|
||||
card: 'XXX',
|
||||
result: '阿猫'
|
||||
}],
|
||||
fileList: [{ name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100' }, { name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100' }]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -87,6 +126,14 @@ export default {
|
|||
{ prop: 'status', label: this.$t('page.taskStatus') },
|
||||
{ prop: 'remark', label: this.$t('page.description') }
|
||||
]
|
||||
},
|
||||
taskColumns() {
|
||||
return [
|
||||
{ prop: 'name', label: this.$t('page.picName') },
|
||||
{ prop: 'clusterName', label: this.$t('page.clusterIn') },
|
||||
{ prop: 'card', label: this.$t('page.card') },
|
||||
{ prop: 'result', label: this.$t('page.result') }
|
||||
]
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
|
Loading…
Reference in New Issue