mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-29 03:37:17 +00:00
⚰️(summary) cleaned tasks failure handling
Code in task failure was assuming that the failure signal would be called on retry which is not the case.
This commit is contained in:
@@ -590,39 +590,26 @@ def handle_transcribe_v2_failed(
|
|||||||
):
|
):
|
||||||
"""Handle the failure of transcribe_v2_task.
|
"""Handle the failure of transcribe_v2_task.
|
||||||
|
|
||||||
Tracks the failure event in analytics and, if the task
|
Tracks the failure event in analytics and sends a failure webhook to the client.
|
||||||
will not be retried, sends a failure webhook to the client.
|
|
||||||
"""
|
"""
|
||||||
autoretry_for = sender.autoretry_for
|
logger.error(
|
||||||
retries_remaining = sender.max_retries - sender.request.retries - 1
|
"Transcribe task %s failed, no more retries left, sending failure webhook.",
|
||||||
|
task_id,
|
||||||
will_retry = retries_remaining > 0 and isinstance(exception, tuple(autoretry_for))
|
)
|
||||||
|
metadata_manager.capture(
|
||||||
if will_retry:
|
task_id,
|
||||||
logger.info(
|
settings.posthog_transcript_failure,
|
||||||
"Transcribe task %s failed, %s retries left.",
|
{"exception_type": type(exception).__name__},
|
||||||
task_id,
|
)
|
||||||
retries_remaining,
|
call_webhook_v2_task.apply_async(
|
||||||
)
|
args=[
|
||||||
else:
|
TranscribeWebhookFailurePayload(
|
||||||
logger.error(
|
job_id=task_id,
|
||||||
"Transcribe task %s failed, no more retries left, sending failure webhook.",
|
error_code="unknown_error",
|
||||||
task_id,
|
).model_dump(),
|
||||||
)
|
args[0]["tenant_id"],
|
||||||
metadata_manager.capture(
|
]
|
||||||
task_id,
|
)
|
||||||
settings.posthog_transcript_failure,
|
|
||||||
{"exception_type": type(exception).__name__},
|
|
||||||
)
|
|
||||||
call_webhook_v2_task.apply_async(
|
|
||||||
args=[
|
|
||||||
TranscribeWebhookFailurePayload(
|
|
||||||
job_id=task_id,
|
|
||||||
error_code="unknown_error",
|
|
||||||
).model_dump(),
|
|
||||||
args[0]["tenant_id"],
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@celery.task(
|
@celery.task(
|
||||||
@@ -699,36 +686,23 @@ def handle_summarize_v2_failed(
|
|||||||
):
|
):
|
||||||
"""Handle the failure of summarize_v2_task.
|
"""Handle the failure of summarize_v2_task.
|
||||||
|
|
||||||
Tracks the failure event in analytics and, if the task
|
Tracks the failure event in analytics and sends a failure webhook to the client.
|
||||||
will not be retried, sends a failure webhook to the client.
|
|
||||||
"""
|
"""
|
||||||
autoretry_for = sender.autoretry_for
|
logger.warn(
|
||||||
retries_remaining = sender.max_retries - sender.request.retries - 1
|
"Summary task %s failed, no more retries left, sending failure webhook.",
|
||||||
|
task_id,
|
||||||
will_retry = retries_remaining > 0 and isinstance(exception, tuple(autoretry_for))
|
)
|
||||||
|
metadata_manager.capture(
|
||||||
if will_retry:
|
task_id,
|
||||||
logger.info(
|
settings.posthog_summary_failure,
|
||||||
"Summary task %s failed, %s retries left.",
|
{"exception_type": type(exception).__name__},
|
||||||
task_id,
|
)
|
||||||
retries_remaining,
|
call_webhook_v2_task.apply_async(
|
||||||
)
|
args=[
|
||||||
else:
|
SummarizeWebhookFailurePayload(
|
||||||
logger.warn(
|
job_id=task_id,
|
||||||
"Summary task %s failed, no more retries left, sending failure webhook.",
|
error_code="unknown_error",
|
||||||
task_id,
|
).model_dump(),
|
||||||
)
|
args[0]["tenant_id"],
|
||||||
metadata_manager.capture(
|
]
|
||||||
task_id,
|
)
|
||||||
settings.posthog_summary_failure,
|
|
||||||
{"exception_type": type(exception).__name__},
|
|
||||||
)
|
|
||||||
call_webhook_v2_task.apply_async(
|
|
||||||
args=[
|
|
||||||
SummarizeWebhookFailurePayload(
|
|
||||||
job_id=task_id,
|
|
||||||
error_code="unknown_error",
|
|
||||||
).model_dump(),
|
|
||||||
args[0]["tenant_id"],
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user