#! /usr/bin/env python import sys sys.path.insert(0, '.') import boto3 from tracker.search import get_es from tracker import config, dynamo from tracker.logger import get_logger logger = get_logger(__name__) credentials = boto3.Session().get_credentials() logger.info(f"AWs Credentials {credentials.access_key} {credentials.method}") es_info = get_es().info() logger.info(f'ES info {es_info}') logger.info("Dynamo") desc_table = dynamo.FollowedArtist.describe_table() logger.info(f"{desc_table}") db_name = config.db_connection_uri.split('/')[-1] from tracker import db db.setup_session() checks = db.Session.execute(''' select 'version' as "field", version_num as "value" from alembic_version union all (select 'checks', 'ok' from in_user limit 1) union all (select 'users', count(*)::Text from users) ''').fetchall() formatted_checks = ", ".join("{}={}".format(r[0], r[1]) for r in checks) # TODO: add more fast checks: # twitter api limits, spotify connection, soundcloud connection, youtube connection, docx? (create test deal doc) logger.info("Cron heart is beating. db={}, {}" "".format(db_name, formatted_checks))