ConnectedPlacesCatapult / SharingCitiesDashboard

Personalisable dashboard for Sharing Cities IoT data
Apache License 2.0
6 stars 5 forks source link

Fcc 66 celery async #145

Closed kpennels closed 5 years ago

kpennels commented 5 years ago

Updated Files

resources/request_for_data.py - 1) Marked the get_prediction method as a celery task 2) Added the PredictStatus resource class which implements a GET request that when passed a task_id argument will return the state of the corresponding task and possibly the result of that task.

Analytics/app.py - Added the PredictStatus resource class and exposed the corresponding /pred_status endpoint. This endpoint can be used to poll the status of prediction tasks that were asynchronously requested via the /data endpoint

Analytics/manage.py - Initialised the the celery application with the Flask application.

New Files

Analytics/celeryconfig - Defines the broker and backend hostname and port numbers that is used by the celery application. Redis was chosen as the broker and backend

Analytics/create_celery - Defines a method which instantiates a celery object and wraps the object with the context of the Flask application

Analytics/CELERY_README.md - Explains the procedure that needs to be followed for the celery application to function correctly

Analytics/test_celery_prediction - Tests the functionality of the asynchronous get prediction method and the /pred_status endpoint.