mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-19 12:15:59 +00:00
celery syncs
This commit is contained in:
1 parent
a619269502
commit
cd9b03bdb9
3 files changed
+6
-4
No files matched your search
@@ -6,7 +6,6 @@ from pymongo import MongoClient
|
|||||||
from bson.objectid import ObjectId
|
from bson.objectid import ObjectId
|
||||||
from werkzeug.utils import secure_filename
|
from werkzeug.utils import secure_filename
|
||||||
import http.client
|
import http.client
|
||||||
from celery.result import AsyncResult
|
|
||||||
|
|
||||||
from application.api.user.tasks import ingest
|
from application.api.user.tasks import ingest
|
||||||
|
|
||||||
@@ -142,7 +141,8 @@ def upload_file():
|
|||||||
def task_status():
|
def task_status():
|
||||||
"""Get celery job status."""
|
"""Get celery job status."""
|
||||||
task_id = request.args.get("task_id")
|
task_id = request.args.get("task_id")
|
||||||
task = AsyncResult(task_id, backend=settings.CELERY_RESULT_BACKEND)
|
from application.celery import celery
|
||||||
|
task = celery.AsyncResult(task_id)
|
||||||
task_meta = task.info
|
task_meta = task.info
|
||||||
return {"status": task.status, "result": task_meta}
|
return {"status": task.status, "result": task_meta}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from celery import Celery
|
|||||||
from application.core.settings import settings
|
from application.core.settings import settings
|
||||||
|
|
||||||
def make_celery(app_name=__name__):
|
def make_celery(app_name=__name__):
|
||||||
celery = Celery(app_name, broker=settings.CELERY_BROKER_URL)
|
celery = Celery(app_name, broker=settings.CELERY_BROKER_URL, backend=settings.CELERY_RESULT_BACKEND)
|
||||||
celery.conf.update(settings)
|
celery.conf.update(settings)
|
||||||
return celery
|
return celery
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ download_locally() {
|
|||||||
#pip install -r application/requirements.txt
|
#pip install -r application/requirements.txt
|
||||||
#pip install llama-cpp-python
|
#pip install llama-cpp-python
|
||||||
#pip install sentence-transformers
|
#pip install sentence-transformers
|
||||||
|
export LLM_NAME=llama.cpp
|
||||||
|
export EMBEDDINGS_NAME=huggingface_sentence-transformers/all-mpnet-base-v2
|
||||||
export FLASK_APP=application/app.py
|
export FLASK_APP=application/app.py
|
||||||
export FLASK_DEBUG=true
|
export FLASK_DEBUG=true
|
||||||
export CELERY_BROKER_URL=redis://localhost:6379/0
|
export CELERY_BROKER_URL=redis://localhost:6379/0
|
||||||
@@ -42,7 +44,7 @@ download_locally() {
|
|||||||
echo "The application is now running on http://localhost:5173"
|
echo "The application is now running on http://localhost:5173"
|
||||||
echo "You can stop the application by running the following command:"
|
echo "You can stop the application by running the following command:"
|
||||||
echo "Ctrl + C and then"
|
echo "Ctrl + C and then"
|
||||||
echo "Then pkill -f "flask run" and then"
|
echo "Then pkill -f 'flask run' and then"
|
||||||
echo "docker-compose down"
|
echo "docker-compose down"
|
||||||
flask run --host=0.0.0.0 --port=7091 &
|
flask run --host=0.0.0.0 --port=7091 &
|
||||||
celery -A application.app.celery worker -l INFO
|
celery -A application.app.celery worker -l INFO
|
||||||
|
|||||||
Reference in new issue
Block a user