def get(self,id): next = request.headers.get('Referer') task = Task.query.filter_by(id=id).first() try: sched.pause_job(str(id)) task.yunxing_status = u'暂停' db.session.commit() flash(u'定时任务暂停成功!') return redirect(next or url_for('home.timingtask')) except Exception as e: task.yunxing_status = u'创建' db.session.commit() flash(u'定时任务暂停失败!已经为您初始化,原因:%s'%e) return redirect(next or url_for('home.timingtask'))
def get(self, id): next = request.headers.get('Referer') task = Task.query.filter_by(id=id).first() try: sched.pause_job(str(id)) task.yunxing_status = u'暂停' db.session.commit() flash(u'!') return redirect(next or url_for('home.timingtask')) except Exception as e: logger.exception(e) task.yunxing_status = u'创建' db.session.commit() flash(MessageEnum.task_stop_fail.value[1]) return redirect(next or url_for('home.timingtask'))