- Add test environment to __init__.py for all eveai services
- Add postgresql certificate to secrets for secure communication in staging and production environments - Adapt for TLS communication with PostgreSQL - Adapt tasks to handle invalid connections from the connection pool - Migrate to psycopg3 for connection to PostgreSQL
This commit is contained in:
@@ -3,7 +3,8 @@ from typing import Dict, Any, Optional
|
||||
import traceback
|
||||
|
||||
from flask import current_app
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from celery import states
|
||||
from sqlalchemy.exc import SQLAlchemyError, InterfaceError, OperationalError
|
||||
|
||||
from common.utils.config_field_types import TaggingFields
|
||||
from common.utils.database import Database
|
||||
@@ -214,7 +215,7 @@ def prepare_arguments(specialist: Any, arguments: Dict[str, Any]) -> Dict[str, A
|
||||
raise ArgumentPreparationError(str(e))
|
||||
|
||||
|
||||
@current_celery.task(name='execute_specialist', queue='llm_interactions', bind=True)
|
||||
@current_celery.task(bind=True, name='execute_specialist', queue='llm_interactions', autoretry_for=(InterfaceError, OperationalError), retry_backoff=True, retry_jitter=True, max_retries=5)
|
||||
def execute_specialist(self, tenant_id: int, specialist_id: int, arguments: Dict[str, Any],
|
||||
session_id: str, user_timezone: str) -> dict:
|
||||
"""
|
||||
@@ -356,6 +357,7 @@ def execute_specialist(self, tenant_id: int, specialist_id: int, arguments: Dict
|
||||
stacktrace = traceback.format_exc()
|
||||
current_app.logger.error(f'execute_specialist: Error updating interaction: {e}\n{stacktrace}')
|
||||
|
||||
self.update_state(state=states.FAILURE)
|
||||
raise
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user