mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-06-25 23:40:58 +02:00
Bugfix/celery ignore result (#3770)
* try using a redis replica in some areas * harden up replica usage * ignore results --------- Co-authored-by: Richard Kuo (Danswer) <rkuo@onyx.app>
This commit is contained in:
parent
05ab94945b
commit
fa78f50fe3
@ -32,6 +32,7 @@ def perform_ttl_management_task(
|
|||||||
|
|
||||||
@celery_app.task(
|
@celery_app.task(
|
||||||
name="check_ttl_management_task",
|
name="check_ttl_management_task",
|
||||||
|
ignore_result=True,
|
||||||
soft_time_limit=JOB_TIMEOUT,
|
soft_time_limit=JOB_TIMEOUT,
|
||||||
)
|
)
|
||||||
def check_ttl_management_task(*, tenant_id: str | None) -> None:
|
def check_ttl_management_task(*, tenant_id: str | None) -> None:
|
||||||
@ -56,6 +57,7 @@ def check_ttl_management_task(*, tenant_id: str | None) -> None:
|
|||||||
|
|
||||||
@celery_app.task(
|
@celery_app.task(
|
||||||
name="autogenerate_usage_report_task",
|
name="autogenerate_usage_report_task",
|
||||||
|
ignore_result=True,
|
||||||
soft_time_limit=JOB_TIMEOUT,
|
soft_time_limit=JOB_TIMEOUT,
|
||||||
)
|
)
|
||||||
def autogenerate_usage_report_task(*, tenant_id: str | None) -> None:
|
def autogenerate_usage_report_task(*, tenant_id: str | None) -> None:
|
||||||
|
@ -33,6 +33,7 @@ class TaskDependencyError(RuntimeError):
|
|||||||
|
|
||||||
@shared_task(
|
@shared_task(
|
||||||
name=OnyxCeleryTask.CHECK_FOR_CONNECTOR_DELETION,
|
name=OnyxCeleryTask.CHECK_FOR_CONNECTOR_DELETION,
|
||||||
|
ignore_result=True,
|
||||||
soft_time_limit=JOB_TIMEOUT,
|
soft_time_limit=JOB_TIMEOUT,
|
||||||
trail=False,
|
trail=False,
|
||||||
bind=True,
|
bind=True,
|
||||||
|
@ -91,6 +91,7 @@ def _is_external_doc_permissions_sync_due(cc_pair: ConnectorCredentialPair) -> b
|
|||||||
|
|
||||||
@shared_task(
|
@shared_task(
|
||||||
name=OnyxCeleryTask.CHECK_FOR_DOC_PERMISSIONS_SYNC,
|
name=OnyxCeleryTask.CHECK_FOR_DOC_PERMISSIONS_SYNC,
|
||||||
|
ignore_result=True,
|
||||||
soft_time_limit=JOB_TIMEOUT,
|
soft_time_limit=JOB_TIMEOUT,
|
||||||
bind=True,
|
bind=True,
|
||||||
)
|
)
|
||||||
|
@ -91,6 +91,7 @@ def _is_external_group_sync_due(cc_pair: ConnectorCredentialPair) -> bool:
|
|||||||
|
|
||||||
@shared_task(
|
@shared_task(
|
||||||
name=OnyxCeleryTask.CHECK_FOR_EXTERNAL_GROUP_SYNC,
|
name=OnyxCeleryTask.CHECK_FOR_EXTERNAL_GROUP_SYNC,
|
||||||
|
ignore_result=True,
|
||||||
soft_time_limit=JOB_TIMEOUT,
|
soft_time_limit=JOB_TIMEOUT,
|
||||||
bind=True,
|
bind=True,
|
||||||
)
|
)
|
||||||
|
@ -295,11 +295,13 @@ def validate_indexing_fences(
|
|||||||
r_celery: Redis,
|
r_celery: Redis,
|
||||||
lock_beat: RedisLock,
|
lock_beat: RedisLock,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
"""Validates all indexing fences for this tenant ... aka makes sure
|
||||||
|
indexing tasks sent to celery are still in flight.
|
||||||
|
"""
|
||||||
reserved_indexing_tasks = celery_get_unacked_task_ids(
|
reserved_indexing_tasks = celery_get_unacked_task_ids(
|
||||||
OnyxCeleryQueues.CONNECTOR_INDEXING, r_celery
|
OnyxCeleryQueues.CONNECTOR_INDEXING, r_celery
|
||||||
)
|
)
|
||||||
|
|
||||||
# validate all existing indexing jobs
|
|
||||||
# Use replica for this because the worst thing that happens
|
# Use replica for this because the worst thing that happens
|
||||||
# is that we don't run the validation on this pass
|
# is that we don't run the validation on this pass
|
||||||
for key_bytes in r_replica.scan_iter(
|
for key_bytes in r_replica.scan_iter(
|
||||||
|
@ -54,6 +54,7 @@ def _process_model_list_response(model_list_json: Any) -> list[str]:
|
|||||||
|
|
||||||
@shared_task(
|
@shared_task(
|
||||||
name=OnyxCeleryTask.CHECK_FOR_LLM_MODEL_UPDATE,
|
name=OnyxCeleryTask.CHECK_FOR_LLM_MODEL_UPDATE,
|
||||||
|
ignore_result=True,
|
||||||
soft_time_limit=JOB_TIMEOUT,
|
soft_time_limit=JOB_TIMEOUT,
|
||||||
trail=False,
|
trail=False,
|
||||||
bind=True,
|
bind=True,
|
||||||
|
@ -563,6 +563,7 @@ def build_job_id(
|
|||||||
|
|
||||||
@shared_task(
|
@shared_task(
|
||||||
name=OnyxCeleryTask.MONITOR_BACKGROUND_PROCESSES,
|
name=OnyxCeleryTask.MONITOR_BACKGROUND_PROCESSES,
|
||||||
|
ignore_result=True,
|
||||||
soft_time_limit=_MONITORING_SOFT_TIME_LIMIT,
|
soft_time_limit=_MONITORING_SOFT_TIME_LIMIT,
|
||||||
time_limit=_MONITORING_TIME_LIMIT,
|
time_limit=_MONITORING_TIME_LIMIT,
|
||||||
queue=OnyxCeleryQueues.MONITORING,
|
queue=OnyxCeleryQueues.MONITORING,
|
||||||
|
@ -78,6 +78,7 @@ def _is_pruning_due(cc_pair: ConnectorCredentialPair) -> bool:
|
|||||||
|
|
||||||
@shared_task(
|
@shared_task(
|
||||||
name=OnyxCeleryTask.CHECK_FOR_PRUNING,
|
name=OnyxCeleryTask.CHECK_FOR_PRUNING,
|
||||||
|
ignore_result=True,
|
||||||
soft_time_limit=JOB_TIMEOUT,
|
soft_time_limit=JOB_TIMEOUT,
|
||||||
bind=True,
|
bind=True,
|
||||||
)
|
)
|
||||||
|
@ -214,6 +214,7 @@ def document_by_cc_pair_cleanup_task(
|
|||||||
|
|
||||||
@shared_task(
|
@shared_task(
|
||||||
name=OnyxCeleryTask.CLOUD_BEAT_TASK_GENERATOR,
|
name=OnyxCeleryTask.CLOUD_BEAT_TASK_GENERATOR,
|
||||||
|
ignore_result=True,
|
||||||
trail=False,
|
trail=False,
|
||||||
bind=True,
|
bind=True,
|
||||||
)
|
)
|
||||||
|
@ -98,6 +98,7 @@ logger = setup_logger()
|
|||||||
# which bloats the result metadata considerably. trail=False prevents this.
|
# which bloats the result metadata considerably. trail=False prevents this.
|
||||||
@shared_task(
|
@shared_task(
|
||||||
name=OnyxCeleryTask.CHECK_FOR_VESPA_SYNC_TASK,
|
name=OnyxCeleryTask.CHECK_FOR_VESPA_SYNC_TASK,
|
||||||
|
ignore_result=True,
|
||||||
soft_time_limit=JOB_TIMEOUT,
|
soft_time_limit=JOB_TIMEOUT,
|
||||||
trail=False,
|
trail=False,
|
||||||
bind=True,
|
bind=True,
|
||||||
@ -872,7 +873,12 @@ def monitor_ccpair_indexing_taskset(
|
|||||||
redis_connector_index.reset()
|
redis_connector_index.reset()
|
||||||
|
|
||||||
|
|
||||||
@shared_task(name=OnyxCeleryTask.MONITOR_VESPA_SYNC, soft_time_limit=300, bind=True)
|
@shared_task(
|
||||||
|
name=OnyxCeleryTask.MONITOR_VESPA_SYNC,
|
||||||
|
ignore_result=True,
|
||||||
|
soft_time_limit=300,
|
||||||
|
bind=True,
|
||||||
|
)
|
||||||
def monitor_vespa_sync(self: Task, tenant_id: str | None) -> bool | None:
|
def monitor_vespa_sync(self: Task, tenant_id: str | None) -> bool | None:
|
||||||
"""This is a celery beat task that monitors and finalizes various long running tasks.
|
"""This is a celery beat task that monitors and finalizes various long running tasks.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user