def list_nodes(): data = Request.get('/nodes') if data.get('error'): print('error: ' + data.get('error')) items = data.get('data') or [] columns = ['_id', 'name', 'status', 'create_ts', 'update_ts'] Client.list(columns, items)
def list_tasks(number=10): data = Request.get('/tasks', {'page_num': 1, 'page_size': number}) if data.get('error'): print('error: ' + data.get('error')) items = data.get('data') or [] columns = [ '_id', 'status', 'node_name', 'spider_name', 'error', 'result_count', 'create_ts', 'update_ts' ] Client.list(columns, items)
def list_spiders(): data = Request.get('/spiders', {'page_num': 1, 'page_size': 99999999}) if data.get('error'): print('error: ' + data.get('error')) items = (data.get('data').get('list') or []) if data.get('data') is not None else [] columns = [ '_id', 'name', 'display_name', 'type', 'col', 'create_ts', 'update_ts' ] Client.list(columns, items)
def list_schedules(): data = Request.get('/schedules', { 'page_num': 1, 'page_size': 99999999 }) if data.get('error'): print('error: ' + data.get('error')) items = data.get('data') or [] columns = [ '_id', 'name', 'spider_name', 'run_type', 'cron', 'create_ts', 'update_ts' ] Client.list(columns, items)