Celery Tasks¶
Anything that can be run on the celery queues.
Event Based Tasks¶
The following tasks are initiated hooks on model save events and can be found in fb_shared/tasks/event_based.py.
Create Next Payment – Generates the next payment for a contract and also associate any accessible leagues if the contract restricted access. This task run when either a new contract saved or when the check contracts task is run.
Generate Credits - This generates new credits associated with a payment. It is run when a new credit base payment is made or when the check contracts task is run.
Scheduled Tasks¶
The following tasks are initiated by the celery scheduler and can be found in fb_shared/tasks/scheduled.py.
Check Contract Daily – Iterates through all the contracts. If a contract has come to the end of the billing cycle, it either generates a new payment or deactivates the contract if due to expire.
Check Credits Daily – Deactivates any expired credits.
Create New Players in Fast Look Up Table - This adds any new players to the fast player look up table. This run every week on Sunday morning.
Update Existing Players in Fast Look Up Table – This generates the tasks that update the data stored in the fast player look up table for each player. (Personal, role, style, injury and performance data) This run every week on Sunday morning.
Player Report Config¶
The fb_player/tasks/report_tasks.py contains the main task that kicks of all the data tasks for each requested players within the new report.
It also contains a config object that lists which data tasks are to be run when a report is created and what partial json file to the store the data to. It also contains the name of the element name used in the json.

Player Report Fast Tasks¶
The following tasks are initiated by the main create report method in report_tasks.py and can be found in fb_player/tasks/data_tasks.py:
These tasks are run for each player requested in the report. The code mainly retrieves data from database and some post processing so that it can be easily consumed by the frontend. The data is then stored in a partial player json file.
- Retrieve Player Status
- Retrieve Player Injury Status
- Retrieve Player Injury Data
- Retrieve Player Appearance History
- Retrieve Overall Role Classification
- Retrieve Player Action Breakdown
- Retrieve Player Performance Summary
- Retrieve Player Time Series Performance Data
- Retrieve Player Summary Appearances
- Retrieve Player Detailed Appearances
- Retrieve Player Role Heat Map Data
Player Report Slow Tasks¶
The following tasks are initiated by the main create report method in report_tasks.py and can be found in fb_player/tasks/delayed_data_tasks.py:
Like the data tasks, these need to be run for each player in the report. However the user can open report before these tasks finished. Once the data is available, the report will update.
- Retrieve Similar Players
Bokeh Tasks¶
The tasks define in fb_player/tasks/bokeh_tasks.py used to be run to generate bokeh graphs. However the frontend has moved over to the D3 graphing framework.
Utility Tasks¶
The FBTask task define in fb_player/tasks/utility_tasks.py is a base class, used by every other task. It simply records the duration of the task and the status in the Mysql database.
Monitoring Task Queues¶
The task queues and pools of worker threads can be monitored by creating a SSH tunnel to api.dectechsports.com forwarding port 8888 to localhost:8888. This is really useful to check that the task queues are alive and running properly.
Then navigate in your browser to: http://localhost:8888
