async def create_series(cls, sid, data, event): if not isinstance(data, dict): resp = {'error': 'Incorrect data'} else: series_name = data.get('name') if series_name is not None: resp, status = await BaseHandler.resp_add_series(data) else: resp = {'error': 'Missing required field(s)'} return safe_json_dumps(resp)
async def run_siridb_query(cls, sid, data, event): query = data.get('query') resp, status = await BaseHandler.resp_run_siridb_query(query) return safe_json_dumps(resp)
async def get_series_static_rules_hits(cls, sid, data, event): series_name = data.get('series_name') resp = await BaseHandler.resp_get_series_static_rules_hits(series_name) return safe_json_dumps(resp)
async def get_series_forecasts(cls, sid, data, event): series_name = data.get('series_name') only_future = data.get('only_future') resp = await BaseHandler.resp_get_series_forecasts( series_name, only_future) return safe_json_dumps(resp)
async def get_series_details(cls, sid, data, event): series_name = data.get('series_name') resp, status = await BaseHandler.resp_get_single_monitored_series( series_name) return safe_json_dumps(resp)
async def _get_all_series(cls, regex_filter): regex_filter = regex_filter if regex_filter else None resp = BaseHandler.resp_get_monitored_series(regex_filter) return safe_json_dumps(resp)
async def subscribe_queue(cls, sid, data, event=None): if cls._sio is not None: cls._sio.enter_room(sid, 'job_updates') return safe_json_dumps(BaseHandler.resp_get_jobs_queue())