Skip to content

Commit

Permalink
restart celery
Browse files Browse the repository at this point in the history
  • Loading branch information
leftmove committed Dec 26, 2024
1 parent 160abaa commit 7d64d0b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions backend/install.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
sudo systemctl restart uvicorn
uv run python -m celery -A worker.tasks.queue purge -f
sudo systemctl restart celery
16 changes: 8 additions & 8 deletions backend/routers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@ def insert_search(document_list: list):
{"type": "create-latest", "completion": {"$exists": True}}
)
results = [result for result in create_latest]
latest_completitions = [result["completion"] for result in results]
if latest_completitions:
latest_total = sum(latest_completitions)
latest_count = len(latest_completitions)
latest_completions = [result["completion"] for result in results]
if latest_completions:
latest_total = sum(latest_completions)
latest_count = len(latest_completions)
latest_average = latest_total / latest_count
latest_stat = {
"count": latest_count,
Expand All @@ -290,10 +290,10 @@ def insert_search(document_list: list):
{"type": "create-historical", "completion": {"$exists": True}}
)
results = [result for result in create_historical]
historical_completitions = [result["completion"] for result in results]
if historical_completitions:
historical_total = sum(historical_completitions)
historical_count = len(historical_completitions)
historical_completions = [result["completion"] for result in results]
if historical_completions:
historical_total = sum(historical_completions)
historical_count = len(historical_completions)
historical_average = historical_total / historical_count
historical_stat = {
"count": historical_count,
Expand Down
2 changes: 2 additions & 0 deletions backend/worker/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
TELEMETRY = bool(os.environ.get("TELEMETRY", False))
ENVIRONMENT = os.environ.get("ENVIRONMENT", "development")

__all__ = []

production_environment = True if ENVIRONMENT == "production" else False
run_telemetry = True if TELEMETRY else False

Expand Down

0 comments on commit 7d64d0b

Please sign in to comment.