Dockerfile, requirement.txt, entrypoint.sh and docker-compose.yml: Reconfig these files to serve the purpose of triggering Celery in parallel with the Django application
endpoint/tasks.py: Define tasks for the Celery worker to process
endpoint/view.py: Refactor the validate_recording and enroll_user to call tasks, push tasks into the queue and have workers process them
api/__init__.py, api/asgi.py, api/celery.py, api/settings.py, api/urls.py, api/wsgi.py, endpoint/services/speaker_wrapper.py, endpoint/admin.py, endpoint/apps.py, endpoint/models.py, endpoint/tasks.py, endpoint/urls.py, endpoint/views.py and manage.py: Format python code with black
Note:
The Celery worker has not been implemented to run in the background as a daemon, since for testing and development, running it by command with docker-compose is sufficient
The Celery system has not been optimized because only one worker is responsible for processing the tasks at the moment.
File Changes:
Dockerfile
,requirement.txt
,entrypoint.sh
anddocker-compose.yml
: Reconfig these files to serve the purpose of triggering Celery in parallel with the Django applicationapi/settings.py
: Remove redundant Celery configuration optionsendpoint/tasks.py
: Define tasks for the Celery worker to processendpoint/view.py
: Refactor thevalidate_recording
andenroll_user
to call tasks, push tasks into the queue and have workers process themapi/__init__.py
,api/asgi.py
,api/celery.py
,api/settings.py
,api/urls.py
,api/wsgi.py
,endpoint/services/speaker_wrapper.py
,endpoint/admin.py
,endpoint/apps.py
,endpoint/models.py
,endpoint/tasks.py
,endpoint/urls.py
,endpoint/views.py
andmanage.py
: Format python code with blackNote:
Ref #4