def root(): try: conn = Environment.instance().db.engine.connect() stmt = select([Tile.id]).limit(1) res = conn.execute(stmt) assert res is not None except Exception as e: return "Error hitting Redshift: %s" % str(e), 500 try: bucket = Environment.instance().s3.get_bucket(Environment.instance().config.S3["bucket"]) key = Key(bucket) key.name = "__heartbeat__%d" % random.randint(0, 759392) key.set_contents_from_string("heartbeat test") key.delete() except Exception as e: return "Error hitting S3: %s" % str(e), 500 return "OK", 200
def root(): try: conn = Environment.instance().db.engine.connect() stmt = select([Tile.id]).limit(1) res = conn.execute(stmt) assert res is not None except Exception as e: return "Error hitting Redshift: %s" % str(e), 500 try: bucket = Environment.instance().s3.get_bucket( Environment.instance().config.S3["bucket"]) key = Key(bucket) key.name = "__heartbeat__%d" % random.randint(0, 759392) key.set_contents_from_string("heartbeat test") key.delete() except Exception as e: return "Error hitting S3: %s" % str(e), 500 return "OK", 200
def path_slot_stats(start_date, period, slot_id): country_code, locale = _parse_country_locale() conn = Environment.instance().db.engine.connect() keys, rval = slot_stats(conn, start_date, _periods[period], slot_id, country_code, locale) return _build_response(rval, keys, name=start_date)
def path_summary(summary, start_date, period): country_code, locale = _parse_country_locale() conn = Environment.instance().db.engine.connect() keys, rval = _sumaries[summary](conn, start_date, _periods[period], country_code, locale) return _build_response(rval, keys, name=start_date)