Skip to content

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

fix: Added task ID in WF execution model in API deployment POST call (#1145)

Chandrasekharan Mcd48e45a06ad
diff --git a/backend/workflow_manager/workflow_v2/execution.py b/backend/workflow_manager/workflow_v2/execution.py
index 0c382ee65..770f9e8d4 100644
--- a/backend/workflow_manager/workflow_v2/execution.py
+++ b/backend/workflow_manager/workflow_v2/execution.py
@@ -415,7 +415,11 @@ class WorkflowExecutionServiceHelper(WorkflowExecutionService):
@staticmethod
def update_execution_task(execution_id: str, task_id: str) -> None:
try:
+ assert (
+ task_id is not None
+ ), f"task_id is NULL for execution_id: {execution_id}"
execution = WorkflowExecution.objects.get(pk=execution_id)
+ # TODO: Review if status should be updated to EXECUTING
execution.task_id = task_id
execution.save()
except WorkflowExecution.DoesNotExist:
diff --git a/backend/workflow_manager/workflow_v2/workflow_helper.py b/backend/workflow_manager/workflow_v2/workflow_helper.py
index 536c98796..d6643289d 100644
--- a/backend/workflow_manager/workflow_v2/workflow_helper.py
+++ b/backend/workflow_manager/workflow_v2/workflow_helper.py
@@ -521,9 +521,12 @@ class WorkflowHelper:
queue=queue,
)
logger.info(
- f"Job '{async_execution}' has been enqueued for "
- f"execution_id '{execution_id}'"
+ f"[{org_schema}] Job '{async_execution}' has been enqueued for "
+ f"execution_id '{execution_id}', '{len(hash_values_of_files)}' files"
)
+ workflow_execution = WorkflowExecution.objects.get(id=execution_id)
+ workflow_execution.task_id = async_execution.id
+ workflow_execution.save()
if timeout > -1:
async_execution.wait(
timeout=timeout,
@@ -532,7 +535,6 @@ class WorkflowHelper:
task = AsyncResultData(async_result=async_execution)
celery_result = task.to_dict()
task_result = celery_result.get("result")
- workflow_execution = WorkflowExecution.objects.get(id=execution_id)
execution_response = ExecutionResponse(
workflow_id,
execution_id,
@@ -663,11 +665,17 @@ class WorkflowHelper:
dict[str, list[Any]]: Returns a dict with result from
workflow execution
"""
+ logger.info(
+ f"Executing for execution_id: {execution_id}, task_id: {task_id}, "
+ f"org: {organization_id}, workflow_id: {workflow_id}, "
+ f"files: {len(hash_values_of_files)}"
+ )
hash_values = {
key: FileHash.from_json(value)
for key, value in hash_values_of_files.items()
}
workflow = Workflow.objects.get(id=workflow_id)
+ # TODO: Make use of WorkflowExecution.get_or_create()
try:
workflow_execution = (
WorkflowExecutionServiceHelper.create_workflow_execution(