diff --git a/app/__init__.py b/app/__init__.py index 1406bf2..90aad17 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -7,31 +7,34 @@ from quart import Quart, jsonify, request from app import keeper_of_the_state, now_adjusted, predictor -from app.fybr import zone_info -from app.fybr.availability_provider import FybrAvailabilityProvider + +# from app.fybr import zone_info +# from app.fybr.availability_provider import FybrAvailabilityProvider + +#logging.basicConfig(filename='app/example.log', level=logging.DEBUG) LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.INFO) app = Quart(__name__) -app.fybr_availability_provider = FybrAvailabilityProvider( - 'wss://streams.smartcolumbusos.com/socket/websocket', - [] -) +# app.fybr_availability_provider = FybrAvailabilityProvider( +# 'wss://streams.smartcolumbusos.com/socket/websocket', +# [] +# ) @app.before_serving async def startup(): LOGGER.info('starting API') - app.fybr_availability_provider = FybrAvailabilityProvider( - 'wss://streams.smartcolumbusos.com/socket/websocket', - zone_info.meter_and_zone_list() - ) + # app.fybr_availability_provider = FybrAvailabilityProvider( + # 'wss://streams.smartcolumbusos.com/socket/websocket', + # zone_info.meter_and_zone_list() + # ) loop = asyncio.get_event_loop() - LOGGER.info('Scheduling availability cache to be filled from stream') - app.fybr_availability_streamer = loop.create_task(app.fybr_availability_provider.handle_websocket_messages()) + # LOGGER.info('Scheduling availability cache to be filled from stream') + # app.fybr_availability_streamer = loop.create_task(app.fybr_availability_provider.handle_websocket_messages()) LOGGER.info('Scheduling model and zone caches to be re-warmed periodically') app.model_fetcher = loop.create_task(keeper_of_the_state.fetch_state_periodically()) LOGGER.info('Finished starting API') @@ -43,7 +46,7 @@ async def startup(): @app.after_serving async def shutdown(): - app.fybr_availability_streamer.cancel() + # app.fybr_availability_streamer.cancel() app.model_fetcher.cancel() @@ -60,7 +63,7 @@ async def predictions(): availability = predictor.predict(now, zone_ids) prediction_transforms = [ - _override_availability_predictions_with_known_values, + # _override_availability_predictions_with_known_values, predictor.to_api_format, jsonify ] @@ -100,9 +103,9 @@ async def predictions_comparative(): return jsonify(results) -@app.route('/api/v1/availability') -async def availability(): - return jsonify(app.fybr_availability_provider.get_all_availability()) +# @app.route('/api/v1/availability') +# async def availability(): +# return jsonify(app.fybr_availability_provider.get_all_availability()) if __name__ == '__main__':