diff --git a/.github/workflows/deploy-to-node.yaml b/.github/workflows/deploy-to-node.yaml index 3457293e2f..436e7f582a 100644 --- a/.github/workflows/deploy-to-node.yaml +++ b/.github/workflows/deploy-to-node.yaml @@ -59,6 +59,7 @@ jobs: ${{ vars.WEB_NEXT_PUBLIC_ENABLE_EMAIL_SIGNIN_CAPTCHA }} WEB_NEXT_PUBLIC_ENABLE_EMAIL_SIGNIN: ${{ vars.WEB_NEXT_PUBLIC_ENABLE_EMAIL_SIGNIN }} + LOGURU_LEVEL: ${{ vars.LOGURU_LEVEL }} steps: - name: Checkout uses: actions/checkout@v2 diff --git a/ansible/deploy-to-node.yaml b/ansible/deploy-to-node.yaml index 23bc0573c2..639003a42f 100644 --- a/ansible/deploy-to-node.yaml +++ b/ansible/deploy-to-node.yaml @@ -149,6 +149,9 @@ USER_STATS_INTERVAL_TOTAL: "{{ lookup('ansible.builtin.env', 'STATS_INTERVAL_TOTAL') | default('240', true) }}" + LOGURU_LEVEL: + "{{ lookup('ansible.builtin.env', 'LOGURU_LEVEL') | default('INFO', + true) }}" ports: - "{{ backend_port }}:8080" diff --git a/backend/oasst_backend/api/v1/tasks.py b/backend/oasst_backend/api/v1/tasks.py index c817ba67a3..c74dfcf329 100644 --- a/backend/oasst_backend/api/v1/tasks.py +++ b/backend/oasst_backend/api/v1/tasks.py @@ -104,7 +104,8 @@ def tasks_acknowledge( pr = PromptRepository(db, api_client, frontend_user=frontend_user) # here we store the message id in the database for the task - logger.info(f"Frontend acknowledges task {task_id=}, {ack_request=}.") + logger.info(f"Frontend ACK task_id={task_id}") + logger.debug(f"{ack_request=}.") pr.task_repository.bind_frontend_message_id(task_id=task_id, frontend_message_id=ack_request.message_id) except OasstError: diff --git a/backend/oasst_backend/config.py b/backend/oasst_backend/config.py index 683133f78b..ff4c549715 100644 --- a/backend/oasst_backend/config.py +++ b/backend/oasst_backend/config.py @@ -166,8 +166,8 @@ class Settings(BaseSettings): DATABASE_URI: Optional[PostgresDsn] = None DATABASE_MAX_TX_RETRY_COUNT: int = 3 - DATABASE_POOL_SIZE = 128 - DATABASE_MAX_OVERFLOW = 128 + DATABASE_POOL_SIZE = 75 + DATABASE_MAX_OVERFLOW = 20 RATE_LIMIT: bool = True MESSAGE_SIZE_LIMIT: int = 2000 diff --git a/backend/oasst_backend/tree_manager.py b/backend/oasst_backend/tree_manager.py index 7d5a37d9ea..6b4f523615 100644 --- a/backend/oasst_backend/tree_manager.py +++ b/backend/oasst_backend/tree_manager.py @@ -623,7 +623,8 @@ def next_task( HTTPStatus.SERVICE_UNAVAILABLE, ) - logger.info(f"Generated {task=}.") + logger.info(f"Generated task (type={task.type}, id={task.id})") + logger.debug(f"Generated {task=}.") return task, message_tree_id, parent_message_id @@ -634,8 +635,9 @@ async def handle_interaction(self, interaction: protocol_schema.AnyInteraction) match type(interaction): case protocol_schema.TextReplyToMessage: logger.info( - f"Frontend reports text reply to {interaction.message_id=} with {interaction.text=} by {interaction.user=}." + f"Frontend reports text reply to message_id={interaction.message_id} by user={interaction.user}." ) + logger.debug(f"with {interaction.text=}") # here we store the text reply in the database message = pr.store_text_reply( text=interaction.text, @@ -682,23 +684,26 @@ async def handle_interaction(self, interaction: protocol_schema.AnyInteraction) case protocol_schema.MessageRating: logger.info( - f"Frontend reports rating of {interaction.message_id=} with {interaction.rating=} by {interaction.user=}." + f"Frontend reports rating of message_id={interaction.message_id} by user={interaction.user}." ) + logger.debug(f"with {interaction.rating=}") pr.store_rating(interaction) case protocol_schema.MessageRanking: logger.info( - f"Frontend reports ranking of {interaction.message_id=} with {interaction.ranking=} by {interaction.user=}." + f"Frontend reports ranking of message_id={interaction.message_id} by user={interaction.user}." ) + logger.debug(f"with {interaction.ranking=}") _, task = pr.store_ranking(interaction) self.check_condition_for_scoring_state(task.message_tree_id) case protocol_schema.TextLabels: logger.info( - f"Frontend reports labels of {interaction.message_id=} with {interaction.labels=} by {interaction.user=}." + f"Frontend reports labels of message_id={interaction.message_id} by user={interaction.user}." ) + logger.debug(f"with {interaction.labels=}") _, task, msg = pr.store_text_labels(interaction)