def get(self): result = {"result": Errors.OK} try: app_id = self.get_argument("app_id", "") history_id = int(self.get_argument("history_id", "-1")) config = self.get_argument("config", "false") config = True if config.lower() == "true" else False if history_id != -1: app_history = AppManager.instance().info_history( history_id, app_id) if app_history: if config: app_config = AppManager.instance().get_app_config( app_id, app_history["sha1"]) if app_config: result["history_info"] = app_history result["history_config"] = app_config else: Errors.set_result_error("OperationFailed", result) else: result["history_info"] = app_history elif app_history is None: Errors.set_result_error("AppHistoryNotExists", result) else: Errors.set_result_error("OperationFailed", result) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def get(self): result = {"result": Errors.OK, "version": __version__} try: include = self.get_argument("include", "manager,nodes,actions") include = include.split(",") info = {} if "manager" in include: info["manager"] = CONFIG info["manager"]["version"] = __version__ info["manager"][ "total_action_slots"] = Connection.get_total_action_slots( ) if "nodes" in include: info["nodes"] = [] info["number_of_nodes"] = 0 for node in Connection.clients: info["nodes"].append(node.info) info["number_of_nodes"] += 1 if "actions" in include: info["actions"] = Scheduler.instance( ).current_schedule_actions() result["info"] = info except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(json.dumps(result, sort_keys=True)) self.finish()
def get(self): result = {"result": Errors.OK} redirect_flag = False try: task_id = self.get_argument("task_id", "") name = self.get_argument("name", "") if task_id and name: r = yield Scheduler.instance().select_task_node_info( task_id, name) if "node_info" in r and r["node_info"] and r["task_info"]: http_host = r["node_info"]["http_host"] http_port = r["node_info"]["http_port"] if http_host == "127.0.0.1": host_parts = urllib.parse.urlsplit("//" + self.request.host) http_host = host_parts.hostname create_at = r["task_info"]["create_at"] service_id = r["task_info"]["service_id"] url = "http://%s:%s/workspace/download?task_id=%s&create_at=%s&name=%s&service_id=%s" % ( http_host, http_port, task_id, create_at, name, service_id) self.redirect(url) redirect_flag = True else: result = r else: Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) if not redirect_flag: self.write(result) self.finish()
def get(self): result = {"result": Errors.OK} try: offset = int(self.get_argument("offset", "0")) limit = int(self.get_argument("limit", "0")) filters = {} work_id = self.get_argument("work_id", "") if work_id: filters["work_id"] = work_id workflow_id = self.get_argument("workflow_id", "") if workflow_id: filters["workflow_id"] = workflow_id name = self.get_argument("name", "") if name: filters["name"] = name stage = self.get_argument("stage", "") if stage: filters["stage"] = stage status = self.get_argument("status", "") if status: filters["status"] = status LOG.debug("ListWorkHandler offset: %s, limit: %s, filters: %s", offset, limit, filters) r = Works.instance().list(offset=offset, limit=limit, filters=filters) result["works"] = r["works"] result["total"] = r["total"] result["offset"] = offset result["limit"] = limit except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def delete(self): result = {"result": Errors.OK} try: schedule_id = self.get_argument("schedule_id", "") if schedule_id: success = Schedules.instance().delete(schedule_id) if not success: Errors.set_result_error("OperationFailed", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def delete(self): result = {"result": Errors.OK} try: venv_id = self.get_argument("venv_id", "") if venv_id: success = VenvManager.instance().delete(venv_id) if not success: Errors.set_result_error("OperationFailed", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def post(self): result = {"result": Errors.OK} try: self.json_data = json.loads(self.request.body.decode("utf-8")) task_name = self.get_json_argument("task_name", "") app_id = self.get_json_argument("app_id", "") input_data = self.get_json_argument("input_data", {}) if app_id and AppManager.instance().info(app_id) and task_name: if not isinstance(input_data, dict): raise JSONLoadError("input_data must be dict type") task_id = Tasks.instance().add(task_name, app_id, input_data=input_data) if task_id is not False: result["task_id"] = task_id else: Errors.set_result_error("OperationFailed", result) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) LOG.debug("CreateTaskHandler, task_name: %s, app_id: %s", task_name, app_id) except JSONLoadError as e: LOG.error(e) Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def get(self): result = {"result": Errors.OK, "app_histories": [], "total": 0} try: app_id = self.get_argument("app_id", "") offset = int(self.get_argument("offset", "0")) limit = int(self.get_argument("limit", "0")) if app_id: app_info = AppManager.instance().info(app_id) if app_info: app_histories = AppManager.instance().list_history( offset, limit, {"app_id": app_id}) if app_histories: result["app_histories"] = app_histories["histories"] result["total"] = app_histories["total"] result["offset"] = offset result["limit"] = limit elif app_info is None: Errors.set_result_error("AppNotExists", result) else: Errors.set_result_error("OperationFailed", result) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def put(self): result = {"result": Errors.OK} try: self.json_data = json.loads(self.request.body.decode("utf-8")) task_ids = self.get_json_argument("task_ids", []) if isinstance(task_ids, list) and task_ids: result = yield Scheduler.instance().delete_task_workspace( task_ids) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) LOG.debug("DeleteTaskWorkspaceHandler, task_ids: %s", task_ids) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def post(self): result = {"result": Errors.OK} try: self.json_data = json.loads(self.request.body.decode("utf-8")) schedule_name = self.get_json_argument("schedule_name", "") source = self.get_json_argument("source", "") source_id = self.get_json_argument("source_id", "") input_data = self.get_json_argument("input_data", {}) minute = int(self.get_json_argument("minute", -1)) # [0, 59] hour = int(self.get_json_argument("hour", -1)) # [0, 23] day_of_month = int(self.get_json_argument("day_of_month", -1)) # [1, 31] day_of_week = int(self.get_json_argument( "day_of_week", -1)) # [1, 7] (Sunday = 7) enable = True if self.get_json_argument("enable", False) else False if (((source == Schedules.application and AppManager.instance().info(source_id)) or (source == Schedules.workflow and Workflows.instance().get(source_id))) and schedule_name and (minute == -1 or (minute >= 0 and minute <= 59)) and (hour == -1 or (hour >= 0 and hour <= 23)) and (day_of_month == -1 or (day_of_month >= 1 and day_of_month <= 31)) and (day_of_week == -1 or (day_of_week >= 1 and day_of_week <= 7))): if not isinstance(input_data, dict): raise JSONLoadError("input_data must be dict type") schedule_id = Schedules.instance().add( schedule_name, source, source_id, minute=minute, hour=hour, day_of_month=day_of_month, day_of_week=day_of_week, enable=enable, input_data=input_data) if schedule_id is not False: result["schedule_id"] = schedule_id else: Errors.set_result_error("OperationFailed", result) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) LOG.debug( "CreateScheduleHandler, schedule_name: %s, source: %s, source_id: %s", schedule_name, source, source_id) except JSONLoadError as e: LOG.error(e) Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def get(self): result = {"result": Errors.OK} try: app_id = self.get_argument("app_id", "") sha1 = self.get_argument("sha1", "") if app_id: app_info = AppManager.instance().info(app_id) if app_info: if sha1 == "": sha1 = app_info["sha1"] f = AppManager.instance().open(app_id, sha1) if f: self.set_header('Content-Type', 'application/octet-stream') if "app_store" in CONFIG: if "tar.gz" in CONFIG["app_store"]: self.set_header( 'Content-Disposition', 'attachment; filename=%s.tar.gz' % app_id) elif "zip" in CONFIG["app_store"]: self.set_header( 'Content-Disposition', 'attachment; filename=%s.zip' % app_id) else: self.set_header( 'Content-Disposition', 'attachment; filename=%s.tar.gz' % app_id) else: self.set_header( 'Content-Disposition', 'attachment; filename=%s.tar.gz' % app_id) buf_size = 1024 * 1024 while True: data = f.read(buf_size) if not data: break self.write(data) self.flush() yield gen.moment f.close() self.finish() return else: Errors.set_result_error("OperationFailed", result) elif app_info is None: Errors.set_result_error("AppNotExists", result) else: Errors.set_result_error("OperationFailed", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.set_status(400) self.write(result) self.finish()
def post(self): result = {"result": Errors.OK} try: self.json_data = json.loads(self.request.body.decode("utf-8")) name = self.get_json_argument("name", "") configuration = self.get_json_argument("configuration", {}) description = self.get_json_argument("description", "") enable = self.get_json_argument("enable", False) if name: workflow_id = Workflows.instance().add(name, configuration, description = description, enable = enable) result["workflow_id"] = workflow_id else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def put(self): result = {"result": Errors.OK} try: self.json_data = json.loads(self.request.body.decode("utf-8")) task_id = self.get_json_argument("task_id", "") name = self.get_json_argument("name", "") force = self.get_json_argument("force", False) if task_id and name: result = yield Scheduler.instance().pack_task_workspace( task_id, name, force) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) LOG.debug("PackTaskWorkspaceHandler, task_id: %s, name: %s", task_id, name) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def post(self): result = {"result": Errors.OK} try: name = self.get_form_argument("name", "") description = self.get_form_argument("description", "") file_path = self.file_path.decode("utf-8") if name and os.path.exists(file_path) and os.path.isfile( file_path): file_name = os.path.split(file_path)[-1].lower() if ((CONFIG["app_store"].endswith("tar.gz") and file_name.endswith("tar.gz")) or (CONFIG["app_store"].endswith("zip") and file_name.endswith("zip"))): result["app_id"] = AppManager.instance().create( name, description, file_path) else: LOG.warning("application wrong format") Errors.set_result_error("AppWrongFormat", result) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) LOG.debug("deploy application package use: %ss", time.time() - self.start) self.write(result) self.finish()
def put(self): result = {"result": Errors.OK} try: self.json_data = json.loads(self.request.body.decode("utf-8")) workflow_id = self.get_json_argument("workflow_id", "") name = self.get_json_argument("name", "") configuration = self.get_json_argument("configuration", {}) description = self.get_json_argument("description", "") enable = self.get_json_argument("enable", None) LOG.debug("UpdateWorkflowHandler workflow_id: %s, name: %s, description: %s", workflow_id, name, description) if workflow_id and Workflows.instance().get(workflow_id): result["workflow_id"] = workflow_id data = {} if name: data["name"] = name if configuration: data["configuration"] = configuration if description: data["description"] = description if enable is not None: data["enable"] = enable if data: success = Workflows.instance().update(workflow_id, data) if not success: Errors.set_result_error("OperationFailed", result) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def put(self): result = {"result": Errors.OK} try: self.json_data = json.loads(self.request.body.decode("utf-8")) name = self.get_json_argument("name", "") task_id = self.get_json_argument("task_id", "") stage = self.get_json_argument("stage", "") if task_id and name and stage: if stage == Stage.running: Scheduler.instance().update_running_action(self.json_data) elif stage == Stage.finished: Scheduler.instance().update_finish_action(self.json_data) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) LOG.debug("UpdateActionHandler, action_name: %s, task_id: %s", name, task_id) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def get(self): result = {"result": Errors.OK} try: offset = int(self.get_argument("offset", "0")) limit = int(self.get_argument("limit", "0")) filters = {} schedule_id = self.get_argument("schedule_id", "") if schedule_id: filters["schedule_id"] = schedule_id source_id = self.get_argument("source_id", "") if source_id: filters["source_id"] = source_id name = self.get_argument("name", "") if name: filters["name"] = name enable = self.get_argument("enable", "").lower() if enable == "true": enable = True elif enable == "false": enable = False else: enable = "" if enable is not "": filters["enable"] = enable LOG.debug("ListScheduleHandler offset: %s, limit: %s, filters: %s", offset, limit, filters) r = Schedules.instance().list(offset=offset, limit=limit, filters=filters) result["schedules"] = r["schedules"] result["total"] = r["total"] result["offset"] = offset result["limit"] = limit except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def get(self): result = {"result": Errors.OK} try: offset = int(self.get_argument("offset", "0")) limit = int(self.get_argument("limit", "0")) filters = {} name = self.get_argument("name", "") if name: filters["name"] = name venv_id = self.get_argument("id", "") if venv_id: filters["id"] = venv_id LOG.debug("ListVenvHandler offset: %s, limit: %s", offset, limit) r = VenvManager.instance().list(offset, limit, filters=filters) result["venvs"] = r["venvs"] result["total"] = r["total"] result["offset"] = offset result["limit"] = limit except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def post(self): result = {"result": Errors.OK} try: self.json_data = json.loads(self.request.body.decode("utf-8")) name = self.get_json_argument("name", "") workflow_id = self.get_json_argument("workflow_id", "") input_data = self.get_json_argument("input_data", {}) workflow = Workflows.instance().get(workflow_id) if workflow and name: if not isinstance(input_data, dict): raise JSONLoadError("input_data must be dict type") if workflow["enable"]: work_id = Works.instance().add( name, workflow_id, input_data=input_data, configuration=workflow["configuration"]) if work_id is not False: result["work_id"] = work_id else: Errors.set_result_error("OperationFailed", result) else: Errors.set_result_error("WorkflowDisabled", result) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) LOG.debug("CreateWorkHandler, name: %s, workflow_id: %s", name, workflow_id) except JSONLoadError as e: LOG.error(e) Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def put(self): result = {"result": Errors.OK} try: self.json_data = json.loads(self.request.body.decode("utf-8")) service_id = self.get_json_argument("service_id", "") result["service_id"] = service_id data = self.get_json_exists_arguments([ "name", "app_id", "description", "input_data", "signal", "enable", ]) if (data and (service_id and Services.instance().get(service_id)) and (("name" in data and data["name"] != "") or "name" not in data) and ("app_id" not in data or ("app_id" in data and AppManager.instance().info(data["app_id"]))) and ("signal" in data and data["signal"] in (-9, -15)) and (("enable" in data and data["enable"] in [True, False]) or "enable" not in data)): if "input_data" in data and not isinstance( data["input_data"], dict): raise JSONLoadError("input_data must be dict type") if "app_id" in data: data["application_id"] = data["app_id"] del data["app_id"] success = Services.instance().update(service_id, data) if not success: Errors.set_result_error("OperationFailed", result) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) LOG.debug("UpdateServiceHandler, service_id: %s, data: %s", service_id, data) except JSONLoadError as e: LOG.error(e) Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def get(self): result = {"result": Errors.OK} try: venv_id = self.get_argument("venv_id", "") if venv_id: venv_info = VenvManager.instance().info(venv_id) if venv_info: result["venv_info"] = venv_info elif venv_info is None: Errors.set_result_error("VenvNotExists", result) else: Errors.set_result_error("OperationFailed", result) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def get(self): result = {"result": Errors.OK} try: task_id = self.get_argument("task_id", "") if task_id: task_info = Tasks.instance().get(task_id) if task_info: result["task_info"] = task_info if task_info["stage"] == Stage.running: result["task_running_info"] = Scheduler.instance( ).get_running_actions(task_id) elif task_info is None: Errors.set_result_error("TaskNotExists", result) else: Errors.set_result_error("OperationFailed", result) else: Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def get(self): result = {"result": Errors.OK} try: venv_id = self.get_argument("venv_id", "") history_id = int(self.get_argument("history_id", "-1")) if history_id != -1: venv_history = VenvManager.instance().info_history( history_id, venv_id) if venv_history: result["history_info"] = venv_history elif venv_history is None: Errors.set_result_error("VenvHistoryNotExists", result) else: Errors.set_result_error("OperationFailed", result) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def get(self): result = {"result": Errors.OK} try: workflow_id = self.get_argument("workflow_id", "") if workflow_id: workflow_info = Workflows.instance().get(workflow_id) if workflow_info: result["info"] = workflow_info elif workflow_info is None: Errors.set_result_error("AppNotExists", result) else: Errors.set_result_error("OperationFailed", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def post(self): result = {"result": Errors.OK} try: self.json_data = json.loads(self.request.body.decode("utf-8")) name = self.get_json_argument("name", "") app_id = self.get_json_argument("app_id", "") description = self.get_json_argument("description", "") input_data = self.get_json_argument("input_data", {}) signal = self.get_json_argument("signal", -9) enable = True if self.get_json_argument("enable", False) else False if AppManager.instance().info(app_id) and name: if not isinstance(input_data, dict): raise JSONLoadError("input_data must be dict type") service_id = Services.instance().add(name, app_id, description=description, enable=enable, input_data=input_data, signal=signal) if service_id is not False: result["service_id"] = service_id else: Errors.set_result_error("OperationFailed", result) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) LOG.debug("CreateServiceHandler, name: %s, app_id: %s, enable: %s", name, app_id, enable) except JSONLoadError as e: LOG.error(e) Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def delete(self): result = {"result": Errors.OK} try: app_id = self.get_argument("app_id", "") history_id = int(self.get_argument("history_id", "-1")) if history_id != -1 and app_id: success = AppManager.instance().delete_history( history_id, app_id) if not success: Errors.set_result_error("OperationFailed", result) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def put(self): result = {"result": Errors.OK} try: self.json_data = json.loads(self.request.body.decode("utf-8")) history_id = self.get_json_argument("history_id", "") app_id = self.get_json_argument("app_id", "") if history_id and app_id: success = AppManager.instance().activate_history(history_id, app_id=app_id) if not success: Errors.set_result_error("OperationFailed", result) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def get(self): result = {"result": Errors.OK} try: schedule_id = self.get_argument("schedule_id", "") if schedule_id: schedule_info = Schedules.instance().get(schedule_id) if schedule_info: result["schedule_info"] = schedule_info if schedule_id in Schedules.instance().cache: result["schedule_cache_info"] = Schedules.instance( ).cache[schedule_id] elif schedule_info is None: Errors.set_result_error("ScheduleNotExists", result) else: Errors.set_result_error("OperationFailed", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()
def post(self): result = {"result": Errors.OK} try: venv_id = self.get_form_argument("venv_id", "") name = self.get_form_argument("name", "") description = self.get_form_argument("description", "") LOG.debug( "UpdateVenvHandler venv_id: %s, name: %s, description: %s", venv_id, name, description) if venv_id and VenvManager.instance().info(venv_id): success = VenvManager.instance().update( venv_id, name, description, self.file_path.decode("utf-8")) if not success: Errors.set_result_error("OperationFailed", result) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) LOG.debug("update venv package use: %ss", time.time() - self.start) self.write(result) self.finish()
def put(self): result = {"result": Errors.OK} try: self.json_data = json.loads(self.request.body.decode("utf-8")) schedule_id = self.get_json_argument("schedule_id", "") result["schedule_id"] = schedule_id data = self.get_json_exists_arguments([ "schedule_name", "source", "source_id", "input_data", "minute", # [0, 59] "hour", # [0, 23] "day_of_month", # [1, 31] "day_of_week", # [1, 7] (Sunday = 7) "enable", ]) if (data and (schedule_id and Schedules.instance().get(schedule_id)) and (("schedule_name" in data and data["schedule_name"] != "") or "schedule_name" not in data) and ("source_id" not in data or ("source_id" in data and data["source"] == Schedules.application and AppManager.instance().info(data["source_id"])) or ("source_id" in data and data["source"] == Schedules.workflow and Workflows.instance().get(data["source_id"]))) and (("minute" in data and (data["minute"] == -1 or (data["minute"] >= 0 and data["minute"] <= 59))) or "minute" not in data) and (("hour" in data and (data["hour"] == -1 or (data["hour"] >= 0 and data["hour"] <= 23))) or "hour" not in data) and (("day_of_month" in data and (data["day_of_month"] == -1 or (data["day_of_month"] >= 1 and data["day_of_month"] <= 31))) or "day_of_month" not in data) and (("day_of_week" in data and (data["day_of_week"] == -1 or (data["day_of_week"] >= 1 and data["day_of_week"] <= 7))) or "day_of_week" not in data) and (("enable" in data and data["enable"] in [True, False]) or "enable" not in data)): if "input_data" in data and not isinstance( data["input_data"], dict): raise JSONLoadError("input_data must be dict type") if "app_id" in data: data["application_id"] = data["app_id"] del data["app_id"] success = Schedules.instance().update(schedule_id, data) if not success: Errors.set_result_error("OperationFailed", result) else: LOG.warning("invalid arguments") Errors.set_result_error("InvalidParameters", result) LOG.debug("UpdateScheduleHandler, schedule_id: %s, data: %s", schedule_id, data) except JSONLoadError as e: LOG.error(e) Errors.set_result_error("InvalidParameters", result) except Exception as e: LOG.exception(e) Errors.set_result_error("ServerException", result) self.write(result) self.finish()