def post(self): """ 删除监控周期任务 """ args = self.parse_args(delete_scheduler_fields) job_id_list = args.get("job_id", []) ret_data = {"job_id": job_id_list} for job_id in job_id_list: item = app_scheduler.find_job(job_id) if not item: return utils.build_ret(ErrorMsg.JobNotFound, ret_data) for job_id in job_id_list: app_scheduler.delete_job(job_id) return utils.build_ret(ErrorMsg.Success, ret_data)
def post(self): """ 停止监控周期任务 """ args = self.parse_args(stop_scheduler_fields) job_id = args.get("job_id") item = app_scheduler.find_job(job_id) if not item: return utils.build_ret(ErrorMsg.JobNotFound, {"job_id": job_id}) status = item.get("status", SchedulerStatus.RUNNING) if status != SchedulerStatus.RUNNING: return utils.build_ret(ErrorMsg.SchedulerStatusNotRunning, {"job_id": job_id}) app_scheduler.stop_job(job_id) return utils.build_ret(ErrorMsg.Success, {"job_id": job_id})