click: () => {
_this = this
_this.scheduleName = params.row.name
axios({
method: "post",
url: "/get_schedule/",
data: Qs.stringify({"schedule_start":params.row.name})
}).then(function (response){
_this.percentClock[_this.scheduleName] = setInterval("_this.test1(_this.scheduleName)", 3000)
})
}
this code corresponds to the start button on the front end
starttest1test1
:
q1startstartsetInterval()
test1console.log(taskId)
q1 start
4Q1()q2start
q1
q1100%
all codes
render: (h, params) => {
return h("div", [
h("i-button", {
props: {
type: "error",
size: "small",
},
style: {
marginRight: "5px"
},
on: {
click: () => {
_this = this
_this.scheduleName = params.row.name
axios({
method: "post",
url: "/delete_graph/",
data: Qs.stringify({"start_name":params.row.name})
})
axios({
method: "post",
url: "/get_schedule/",
data: Qs.stringify({"schedule_start":params.row.name})
}).then(function (response){
_this.percentClock[_this.scheduleName] = setInterval("_this.test1(_this.scheduleName)", 3000)
})
}
}
}, "Start")
---------------------------------------
test1(taskId) {
console.log(taskId)
_this = this
axios({
method: "post",
url: "/get_schedule/",
data: Qs.stringify({"schedule_start":this.scheduleName})
}).then(function (response){
//console.log(response.data)
_this.$nextTick(() => {
if (_this.progress["percentage" + taskId] === undefined) {
Vue.set(vm.progress, "percentage" + taskId, "0")
Vue.set(vm.progress, "loss" + taskId, "0")
Vue.set(vm.progress, "status" + taskId, "")
}
if (response.data[taskId].epoch_index === undefined) {
_this.progress["percentage" + taskId] = 0
_this.progress["loss" + taskId] = 0
}
if (_this.watchPause === "") {
console.log("sucee")
_this.progress["percentage" + taskId] = response.data[taskId].epoch_index
localStorage.setItem("percentage" + taskId,response.data[taskId].epoch_index)
}
else{
_this.progress["percentage" + taskId] = response.data[taskId].epoch_index
_this.progress["loss" + taskId] = response.data[taskId].epoch_loss
//console.log(_this.progress)
}
})
if (response.data[taskId].epoch_index === 10) {
console.log("success")
localStorage.setItem("percentage" + taskId,response.data[taskId].epoch_index)
localStorage.setItem("loss" + taskId,response.data[taskId].epoch_loss)
clearInterval(_this.percentClock[taskId])
}
})
},