Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

import actual celery app to get the result backend configuration (#1279)

ali6523e0cd5af0
diff --git a/backend/notification_v2/provider/webhook/webhook.py b/backend/notification_v2/provider/webhook/webhook.py
index d59c72e60..37fb7431b 100644
--- a/backend/notification_v2/provider/webhook/webhook.py
+++ b/backend/notification_v2/provider/webhook/webhook.py
@@ -4,6 +4,7 @@ from typing import Any
import requests
from celery import shared_task
+from backend.celery_service import app as celery_app
from notification_v2.enums import AuthorizationType
from notification_v2.provider.notification_provider import NotificationProvider
@@ -28,8 +29,14 @@ class Webhook(NotificationProvider):
except ValueError as e:
logger.error(f"Error validating notification {self.notification} :: {e}")
return
- send_webhook_notification.apply_async(
- (self.notification.url, self.payload, headers, self.NOTIFICATION_TIMEOUT),
+ celery_app.send_task(
+ "send_webhook_notification",
+ args=[
+ self.notification.url,
+ self.payload,
+ headers,
+ self.NOTIFICATION_TIMEOUT,
+ ],
kwargs={
WebhookNotificationArg.MAX_RETRIES: self.notification.max_retries,
WebhookNotificationArg.RETRY_DELAY: self.RETRY_DELAY,
diff --git a/backend/workflow_manager/workflow_v2/workflow_helper.py b/backend/workflow_manager/workflow_v2/workflow_helper.py
index 9bef3d1bd..f1a57fac8 100644
--- a/backend/workflow_manager/workflow_v2/workflow_helper.py
+++ b/backend/workflow_manager/workflow_v2/workflow_helper.py
@@ -23,6 +23,7 @@ from utils.constants import Account
from utils.local_context import StateStore
from utils.user_context import UserContext
+from backend.celery_service import app as celery_app
from unstract.workflow_execution.enums import LogComponent, LogLevel, LogState
from unstract.workflow_execution.exceptions import StopExecution
from workflow_manager.endpoint_v2.destination import DestinationConnector
@@ -452,7 +453,7 @@ class WorkflowHelper:
if not execution.task_id:
raise TaskDoesNotExistError(f"No task ID found for execution: {execution_id}")
- result = AsyncResult(str(execution.task_id))
+ result = celery_app.AsyncResult(str(execution.task_id))
task = AsyncResultData(async_result=result)
# Prepare the initial response with the task's current status and result.
@@ -518,7 +519,8 @@ class WorkflowHelper:
}
org_schema = UserContext.get_organization_identifier()
log_events_id = StateStore.get(Common.LOG_EVENTS_ID)
- async_execution: AsyncResult = cls.execute_bin.apply_async(
+ async_execution: AsyncResult = celery_app.send_task(
+ "async_execute_bin",
args=[
org_schema, # schema_name
workflow_id, # workflow_id