mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-06-29 17:20:44 +02:00
clean up logging in light worker (#3072)
This commit is contained in:
@ -59,7 +59,7 @@ def document_by_cc_pair_cleanup_task(
|
|||||||
connector / credential pair from the access list
|
connector / credential pair from the access list
|
||||||
(6) delete all relevant entries from postgres
|
(6) delete all relevant entries from postgres
|
||||||
"""
|
"""
|
||||||
task_logger.info(f"tenant={tenant_id} doc={document_id}")
|
task_logger.debug(f"Task start: tenant={tenant_id} doc={document_id}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with get_session_with_tenant(tenant_id) as db_session:
|
with get_session_with_tenant(tenant_id) as db_session:
|
||||||
@ -141,7 +141,9 @@ def document_by_cc_pair_cleanup_task(
|
|||||||
return False
|
return False
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if isinstance(ex, RetryError):
|
if isinstance(ex, RetryError):
|
||||||
task_logger.info(f"Retry failed: {ex.last_attempt.attempt_number}")
|
task_logger.warning(
|
||||||
|
f"Tenacity retry failed: num_attempts={ex.last_attempt.attempt_number}"
|
||||||
|
)
|
||||||
|
|
||||||
# only set the inner exception if it is of type Exception
|
# only set the inner exception if it is of type Exception
|
||||||
e_temp = ex.last_attempt.exception()
|
e_temp = ex.last_attempt.exception()
|
||||||
@ -171,8 +173,8 @@ def document_by_cc_pair_cleanup_task(
|
|||||||
else:
|
else:
|
||||||
# This is the last attempt! mark the document as dirty in the db so that it
|
# This is the last attempt! mark the document as dirty in the db so that it
|
||||||
# eventually gets fixed out of band via stale document reconciliation
|
# eventually gets fixed out of band via stale document reconciliation
|
||||||
task_logger.info(
|
task_logger.warning(
|
||||||
f"Max retries reached. Marking doc as dirty for reconciliation: "
|
f"Max celery task retries reached. Marking doc as dirty for reconciliation: "
|
||||||
f"tenant={tenant_id} doc={document_id}"
|
f"tenant={tenant_id} doc={document_id}"
|
||||||
)
|
)
|
||||||
with get_session_with_tenant(tenant_id):
|
with get_session_with_tenant(tenant_id):
|
||||||
|
@ -869,7 +869,9 @@ def vespa_metadata_sync_task(
|
|||||||
)
|
)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if isinstance(ex, RetryError):
|
if isinstance(ex, RetryError):
|
||||||
task_logger.warning(f"Retry failed: {ex.last_attempt.attempt_number}")
|
task_logger.warning(
|
||||||
|
f"Tenacity retry failed: num_attempts={ex.last_attempt.attempt_number}"
|
||||||
|
)
|
||||||
|
|
||||||
# only set the inner exception if it is of type Exception
|
# only set the inner exception if it is of type Exception
|
||||||
e_temp = ex.last_attempt.exception()
|
e_temp = ex.last_attempt.exception()
|
||||||
|
@ -505,7 +505,6 @@ def delete_documents_complete__no_commit(
|
|||||||
db_session: Session, document_ids: list[str]
|
db_session: Session, document_ids: list[str]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""This completely deletes the documents from the db, including all foreign key relationships"""
|
"""This completely deletes the documents from the db, including all foreign key relationships"""
|
||||||
logger.info(f"Deleting {len(document_ids)} documents from the DB")
|
|
||||||
delete_documents_by_connector_credential_pair__no_commit(db_session, document_ids)
|
delete_documents_by_connector_credential_pair__no_commit(db_session, document_ids)
|
||||||
delete_document_feedback_for_documents__no_commit(
|
delete_document_feedback_for_documents__no_commit(
|
||||||
document_ids=document_ids, db_session=db_session
|
document_ids=document_ids, db_session=db_session
|
||||||
|
Reference in New Issue
Block a user