LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
feat: UN-1983 BE API changes for file centric logging (#1129)
Chandrasekharan Mb8f83b5ba48a
diff --git a/backend/api_v2/deployment_helper.py b/backend/api_v2/deployment_helper.pyindex 95bda00e1..b04f4744b 100644--- a/backend/api_v2/deployment_helper.py+++ b/backend/api_v2/deployment_helper.py@@ -162,6 +162,7 @@ class DeploymentHelper(BaseAPIKeyValidator):pipeline_id=pipeline_id,mode=WorkflowExecution.Mode.QUEUE,tags=tags,+ total_files=len(file_objs),)execution_id = workflow_execution.iddiff --git a/backend/workflow_manager/execution/serializer/execution.py b/backend/workflow_manager/execution/serializer/execution.pyindex 1dcf0758f..7fa9c0068 100644--- a/backend/workflow_manager/execution/serializer/execution.py+++ b/backend/workflow_manager/execution/serializer/execution.py@@ -1,6 +1,7 @@from typing import Optionalfrom rest_framework import serializers+from workflow_manager.workflow_v2.enums import ExecutionStatusfrom workflow_manager.workflow_v2.models import WorkflowExecution@@ -8,6 +9,8 @@ from workflow_manager.workflow_v2.models import WorkflowExecutionclass ExecutionSerializer(serializers.ModelSerializer):workflow_name = serializers.SerializerMethodField()pipeline_name = serializers.SerializerMethodField()+ successful_files = serializers.SerializerMethodField()+ failed_files = serializers.SerializerMethodField()class Meta:model = WorkflowExecution@@ -20,3 +23,11 @@ class ExecutionSerializer(serializers.ModelSerializer):def get_pipeline_name(self, obj: WorkflowExecution) -> Optional[str]:"""Fetch the pipeline or API deployment name"""return obj.pipeline_name++ def get_successful_files(self, obj: WorkflowExecution) -> int:+ """Return the count of successfully executed files"""+ return obj.file_executions.filter(status=ExecutionStatus.COMPLETED).count()++ def get_failed_files(self, obj: WorkflowExecution) -> int:+ """Return the count of failed executed files"""+ return obj.file_executions.filter(status=ExecutionStatus.ERROR).count()diff --git a/backend/workflow_manager/execution/serializer/file_centric.py b/backend/workflow_manager/execution/serializer/file_centric.pyindex c55e554b1..2ce66d018 100644--- a/backend/workflow_manager/execution/serializer/file_centric.py+++ b/backend/workflow_manager/execution/serializer/file_centric.py@@ -15,8 +15,10 @@ class FileCentricExecutionSerializer(serializers.ModelSerializer):def get_latest_log(self, obj: FileExecution) -> Optional[dict[str, any]]:latest_log = (- obj.execution_logs.exclude(data__log_level__in=["DEBUG", "WARN"])+ obj.execution_logs.exclude(data__level__in=["DEBUG", "WARN"]).order_by("-event_time").first())- return latest_log.data if latest_log else None+ return (+ latest_log.data["log"] if latest_log and "log" in latest_log.data else None+ )diff --git a/backend/workflow_manager/execution/urls.py b/backend/workflow_manager/execution/urls.pyindex 7445e4037..0872aad04 100644--- a/backend/workflow_manager/execution/urls.py+++ b/backend/workflow_manager/execution/urls.py@@ -13,12 +13,14 @@ execution_list = ExecutionViewSet.as_view("get": "list",})+execution_detail = ExecutionViewSet.as_view({"get": "retrieve"})file_centric_list = FileCentricExecutionViewSet.as_view({"get": "list"})execution_log_list = ExecutionLogViewSet.as_view({"get": "list"})urlpatterns = format_suffix_patterns([path("", execution_list, name="execution-list"),+ path("<uuid:pk>/", execution_detail, name="execution-detail"),path("<uuid:pk>/files/", file_centric_list, name="file-centric-execution-list"),path("<uuid:pk>/logs/", execution_log_list, name="execution-log"),]diff --git a/backend/workflow_manager/file_execution/migrations/0002_rename_status_and_update_exec_time.py b/backend/workflow_manager/file_execution/migrations/0002_rename_status_and_update_exec_time.pynew file mode 100644index 000000000..fa1953f97--- /dev/null+++ b/backend/workflow_manager/file_execution/migrations/0002_rename_status_and_update_exec_time.py@@ -0,0 +1,71 @@+# Generated by Django 4.2.1 on 2025-02-11 12:34++from django.db import migrations+from django.db.models import ExpressionWrapper, F, Func, fields++STATUS_RENAME_MAP = {+ "ExecutionStatus.PENDING": "PENDING",+ "ExecutionStatus.INITIATED": "INITIATED",+ "ExecutionStatus.QUEUED": "QUEUED",+ "ExecutionStatus.READY": "READY",+ "ExecutionStatus.EXECUTING": "EXECUTING",+ "ExecutionStatus.COMPLETED": "COMPLETED",+ "ExecutionStatus.STOPPED": "STOPPED",+ "ExecutionStatus.ERROR": "ERROR",+}++REVERSE_STATUS_RENAME_MAP = {v: k for k, v in STATUS_RENAME_MAP.items()}+++def rename_statuses_and_update_execution_time(apps, schema_editor):+ """Rename statuses and calculate execution_time in a single DB query per status."""+ WorkflowFileExecution = apps.get_model("file_execution", "WorkflowFileExecution")++ # Calculate execution_time as (modified_at - created_at) in seconds+ execution_time_expr = ExpressionWrapper(+ Func(+ Func(+ F("modified_at") - F("created_at"),+ function="EXTRACT",+ template="EXTRACT(EPOCH FROM %(expressions)s)",+ ),+ 3, # Round to 3 decimal places+ function="ROUND",+ ),+ output_field=fields.FloatField(),+ )++ for old_status, new_status in STATUS_RENAME_MAP.items():+ WorkflowFileExecution.objects.filter(status=old_status).update(+ status=new_status,+ execution_time=execution_time_expr,+ )+++# NOTE: The reverse migration does affect unintended rows which were not affected during+# the forward migration - however every status and execution time gets computed as+# expected and this doesn't warrant maintaining a temp table / additional column to+# track the affected rows.+def restore_statuses_and_reset_execution_time(apps, schema_editor):+ """Revert status names and reset execution_time to 0.0 in a single query per status."""+ WorkflowFileExecution = apps.get_model("file_execution", "WorkflowFileExecution")++ for new_status, old_status in REVERSE_STATUS_RENAME_MAP.items():+ WorkflowFileExecution.objects.filter(status=new_status).update(+ status=old_status,+ execution_time=0.0, # Reset execution time on rollback+ )+++class Migration(migrations.Migration):++ dependencies = [+ ("file_execution", "0001_initial"),+ ]++ operations = [+ migrations.RunPython(+ rename_statuses_and_update_execution_time,+ restore_statuses_and_reset_execution_time,+ ),+ ]diff --git a/backend/workflow_manager/file_execution/migrations/0003_alter_workflowfileexecution_status_and_more.py b/backend/workflow_manager/file_execution/migrations/0003_alter_workflowfileexecution_status_and_more.pynew file mode 100644index 000000000..14865d3ed--- /dev/null+++ b/backend/workflow_manager/file_execution/migrations/0003_alter_workflowfileexecution_status_and_more.py@@ -0,0 +1,43 @@+# Generated by Django 4.2.1 on 2025-02-17 10:15++import django.db.models.deletion+from django.db import migrations, models+++class Migration(migrations.Migration):++ dependencies = [+ ("workflow_v2", "0008_workflowexecution_total_files_and_more"),+ ("file_execution", "0002_rename_status_and_update_exec_time"),+ ]++ operations = [+ migrations.AlterField(+ model_name="workflowfileexecution",+ name="status",+ field=models.TextField(+ choices=[+ ("PENDING", "Pending"),+ ("INITIATED", "Initiated"),+ ("QUEUED", "Queued"),+ ("READY", "Ready"),+ ("EXECUTING", "Executing"),+ ("COMPLETED", "Completed"),+ ("STOPPED", "Stopped"),+ ("ERROR", "Error"),+ ],+ db_comment="Current status of the execution",+ ),+ ),+ migrations.AlterField(+ model_name="workflowfileexecution",+ name="workflow_execution",+ field=models.ForeignKey(+ db_comment="Foreign key from WorkflowExecution model",+ editable=False,+ on_delete=django.db.models.deletion.CASCADE,+ related_name="file_executions",+ to="workflow_v2.workflowexecution",+ ),+ ),+ ]diff --git a/backend/workflow_manager/file_execution/models.py b/backend/workflow_manager/file_execution/models.pyindex 9f5edaaa1..51da76af7 100644--- a/backend/workflow_manager/file_execution/models.py+++ b/backend/workflow_manager/file_execution/models.py@@ -2,6 +2,7 @@ import uuidfrom typing import Optionalfrom django.db import models+from django.utils import timezonefrom utils.models.base_model import BaseModelfrom workflow_manager.workflow_v2.enums import ExecutionStatusfrom workflow_manager.workflow_v2.models.execution import WorkflowExecution@@ -58,7 +59,8 @@ class WorkflowFileExecution(BaseModel):on_delete=models.CASCADE,db_index=True,editable=False,- db_comment="Foreign key from WorkflowExecution model",+ db_comment="Foreign key from WorkflowExecution model",+ related_name="file_executions",)file_name = models.CharField(max_length=FILE_NAME_LENGTH, db_comment="Name of the file"@@ -79,7 +81,7 @@ class WorkflowFileExecution(BaseModel):db_comment="MIME type of the file",)status = models.TextField(- choices=ExecutionStatus.choices(),+ choices=ExecutionStatus.choices,db_comment="Current status of the execution",)execution_time = models.FloatField(@@ -101,7 +103,6 @@ class WorkflowFileExecution(BaseModel):def update_status(self,status: ExecutionStatus,- execution_time: int = 0,execution_error: str = None,) -> None:"""@@ -117,7 +118,20 @@ class WorkflowFileExecution(BaseModel):The updated `WorkflowExecutionInputFile` object"""self.status = status- self.execution_time = execution_time++ if (+ status+ in [+ ExecutionStatus.COMPLETED,+ ExecutionStatus.ERROR,+ ExecutionStatus.STOPPED,+ ]+ and not self.execution_time+ ):+ self.execution_time = round(+ (timezone.now() - self.created_at).total_seconds(), 3+ )+self.execution_error = execution_errorself.save()diff --git a/backend/workflow_manager/workflow_v2/enums.py b/backend/workflow_manager/workflow_v2/enums.pyindex 37e4c01bf..377dc1d1a 100644--- a/backend/workflow_manager/workflow_v2/enums.py+++ b/backend/workflow_manager/workflow_v2/enums.py@@ -1,6 +1,6 @@from enum import Enum-from utils.common_utils import ModelEnum+from django.db.models import TextChoicesclass WorkflowExecutionMethod(Enum):@@ -8,7 +8,7 @@ class WorkflowExecutionMethod(Enum):QUEUED = "QUEUED"-class ExecutionStatus(ModelEnum):+class ExecutionStatus(TextChoices):"""An enumeration representing the various statuses of an executionprocess.diff --git a/backend/workflow_manager/workflow_v2/execution.py b/backend/workflow_manager/workflow_v2/execution.pyindex bc7b795ab..0c382ee65 100644--- a/backend/workflow_manager/workflow_v2/execution.py+++ b/backend/workflow_manager/workflow_v2/execution.py@@ -3,6 +3,7 @@ import timefrom typing import Optionalfrom account_v2.constants import Common+from django.utils import timezonefrom platform_settings_v2.platform_auth_service import PlatformAuthenticationServicefrom tags.models import Tagfrom tool_instance_v2.models import ToolInstance@@ -81,7 +82,7 @@ class WorkflowExecutionServiceHelper(WorkflowExecutionService):execution_mode=mode,execution_method=self.execution_method,execution_type=self.execution_type,- status=ExecutionStatus.INITIATED.value,+ status=ExecutionStatus.INITIATED,execution_log_id=self.execution_log_id,)workflow_execution.save()@@ -120,6 +121,7 @@ class WorkflowExecutionServiceHelper(WorkflowExecutionService):execution_id: Optional[str] = None,mode: tuple[str, str] = WorkflowExecution.Mode.INSTANT,tags: Optional[list[Tag]] = None,+ total_files: int = 0,) -> WorkflowExecution:# Validating with existing executionexisting_execution = cls.get_execution_instance_by_id(execution_id)@@ -144,8 +146,9 @@ class WorkflowExecutionServiceHelper(WorkflowExecutionService):execution_mode=mode,execution_method=execution_method,execution_type=execution_type,- status=ExecutionStatus.PENDING.value,+ status=ExecutionStatus.PENDING,execution_log_id=execution_log_id,+ total_files=total_files,)if execution_id:workflow_execution.id = execution_id@@ -157,7 +160,6 @@ class WorkflowExecutionServiceHelper(WorkflowExecutionService):def update_execution(self,status: Optional[ExecutionStatus] = None,- execution_time: Optional[float] = None,error: Optional[str] = None,increment_attempt: bool = False,) -> None:@@ -165,8 +167,19 @@ class WorkflowExecutionServiceHelper(WorkflowExecutionService):if status is not None:execution.status = status.value- if execution_time is not None:- execution.execution_time = execution_time++ if (+ status+ in [+ ExecutionStatus.COMPLETED,+ ExecutionStatus.ERROR,+ ExecutionStatus.STOPPED,+ ]+ and not execution.execution_time+ ):+ execution.execution_time = round(+ (timezone.now() - execution.created_at).total_seconds(), 3+ )if error:execution.error_message = error[:EXECUTION_ERROR_LENGTH]if increment_attempt:@@ -392,7 +405,7 @@ class WorkflowExecutionServiceHelper(WorkflowExecutionService):def update_execution_err(execution_id: str, err_msg: str = "") -> WorkflowExecution:try:execution = WorkflowExecution.objects.get(pk=execution_id)- execution.status = ExecutionStatus.ERROR.value+ execution.status = ExecutionStatus.ERRORexecution.error_message = err_msg[:EXECUTION_ERROR_LENGTH]execution.save()return executiondiff --git a/backend/workflow_manager/workflow_v2/file_history_helper.py b/backend/workflow_manager/workflow_v2/file_history_helper.pyindex 21f8eda93..820146004 100644--- a/backend/workflow_manager/workflow_v2/file_history_helper.py+++ b/backend/workflow_manager/workflow_v2/file_history_helper.py@@ -59,7 +59,7 @@ class FileHistoryHelper:file_history: FileHistory = FileHistory.objects.create(workflow=workflow,cache_key=cache_key,- status=status.value,+ status=status,result=str(result),metadata=str(metadata),error=str(error) if error else "",diff --git a/backend/workflow_manager/workflow_v2/migrations/0007_update_execution_time.py b/backend/workflow_manager/workflow_v2/migrations/0007_update_execution_time.pynew file mode 100644index 000000000..3d65280b9--- /dev/null+++ b/backend/workflow_manager/workflow_v2/migrations/0007_update_execution_time.py@@ -0,0 +1,51 @@+# Generated by Django 4.2.1 on 2025-02-12 08:07++from django.db import migrations+from django.db.models import ExpressionWrapper, F, FloatField, Func+++def update_execution_time_forward(apps, schema_editor):+ """Calculate execution_time as modified_at - created_at in seconds (rounded to 3 decimal places)."""+ WorkflowExecution = apps.get_model("workflow_v2", "WorkflowExecution")++ # Calculate execution_time as (modified_at - created_at) in seconds+ execution_time_expr = ExpressionWrapper(+ Func(+ Func(+ F("modified_at") - F("created_at"),+ function="EXTRACT",+ template="EXTRACT(EPOCH FROM %(expressions)s)",+ ),+ 3, # Round to 3 decimal places+ function="ROUND",+ ),+ output_field=FloatField(),+ )++ WorkflowExecution.objects.update(execution_time=execution_time_expr)+++# NOTE: The reverse migration does affect unintended rows which were not affected during+# the forward migration - however every execution time gets computed as expected+# and this doesn't warrant maintaining a temp table / additional column to+# track the affected rows.+def update_execution_time_backward(apps, schema_editor):+ """Reset execution_time to 0.0 for rollback."""+ WorkflowExecution = apps.get_model("workflow_v2", "WorkflowExecution")+ WorkflowExecution.objects.update(execution_time=0.0)+++class Migration(migrations.Migration):++ dependencies = [+ (+ "workflow_v2",+ "0006_workflowexecution_workflow_ex_workflo_5942c9_idx_and_more",+ ),+ ]++ operations = [+ migrations.RunPython(+ update_execution_time_forward, update_execution_time_backward+ ),+ ]diff --git a/backend/workflow_manager/workflow_v2/migrations/0008_workflowexecution_total_files_and_more.py b/backend/workflow_manager/workflow_v2/migrations/0008_workflowexecution_total_files_and_more.pynew file mode 100644index 000000000..7462c061e--- /dev/null+++ b/backend/workflow_manager/workflow_v2/migrations/0008_workflowexecution_total_files_and_more.py@@ -0,0 +1,64 @@+# Generated by Django 4.2.1 on 2025-02-17 10:15++from django.db import migrations, models+++class Migration(migrations.Migration):++ dependencies = [+ ("workflow_v2", "0007_update_execution_time"),+ ]++ operations = [+ migrations.AddField(+ model_name="workflowexecution",+ name="total_files",+ field=models.PositiveIntegerField(+ db_comment="Number of files to process",+ default=0,+ verbose_name="Total files",+ ),+ ),+ migrations.AlterField(+ model_name="filehistory",+ name="status",+ field=models.TextField(+ choices=[+ ("PENDING", "Pending"),+ ("INITIATED", "Initiated"),+ ("QUEUED", "Queued"),+ ("READY", "Ready"),+ ("EXECUTING", "Executing"),+ ("COMPLETED", "Completed"),+ ("STOPPED", "Stopped"),+ ("ERROR", "Error"),+ ],+ db_comment="Latest status of execution",+ ),+ ),+ migrations.AlterField(+ model_name="workflowexecution",+ name="result_acknowledged",+ field=models.BooleanField(+ db_comment="To track if result is acknowledged by user - used mainly by API deployments",+ default=False,+ ),+ ),+ migrations.AlterField(+ model_name="workflowexecution",+ name="status",+ field=models.CharField(+ choices=[+ ("PENDING", "Pending"),+ ("INITIATED", "Initiated"),+ ("QUEUED", "Queued"),+ ("READY", "Ready"),+ ("EXECUTING", "Executing"),+ ("COMPLETED", "Completed"),+ ("STOPPED", "Stopped"),+ ("ERROR", "Error"),+ ],+ db_comment="Current status of the execution",+ ),+ ),+ ]diff --git a/backend/workflow_manager/workflow_v2/models/execution.py b/backend/workflow_manager/workflow_v2/models/execution.pyindex 905214ced..cacea1e49 100644--- a/backend/workflow_manager/workflow_v2/models/execution.py+++ b/backend/workflow_manager/workflow_v2/models/execution.py@@ -8,6 +8,7 @@ from django.db import modelsfrom pipeline_v2.models import Pipelinefrom tags.models import Tagfrom utils.models.base_model import BaseModel+from workflow_manager.workflow_v2.enums import ExecutionStatusfrom workflow_manager.workflow_v2.models import Workflowlogger = logging.getLogger(__name__)@@ -57,10 +58,19 @@ class WorkflowExecution(BaseModel):execution_log_id = models.CharField(default="", editable=False, db_comment="Execution log events Id")- # TODO: Restrict with an enum- status = models.CharField(default="", db_comment="Current status of execution")+ status = models.CharField(+ choices=ExecutionStatus.choices,+ db_comment="Current status of the execution",+ )result_acknowledged = models.BooleanField(- default=False, db_comment="Result acknowledged"+ default=False,+ db_comment=(+ "To track if result is acknowledged by user - "+ "used mainly by API deployments"+ ),+ )+ total_files = models.PositiveIntegerField(+ default=0, verbose_name="Total files", db_comment="Number of files to process")error_message = models.CharField(max_length=EXECUTION_ERROR_LENGTH,@@ -124,7 +134,7 @@ class WorkflowExecution(BaseModel):f"Workflow execution: {self.id} ("f"pipeline ID: {self.pipeline_id}, "f"workflow iD: {self.workflow_id}, "- f"execution method: {self.execution_method}, "f"status: {self.status}, "+ f"files: {self.total_files}, "f"error message: {self.error_message})")diff --git a/backend/workflow_manager/workflow_v2/models/file_history.py b/backend/workflow_manager/workflow_v2/models/file_history.pyindex c6ca20d0a..afbf8587f 100644--- a/backend/workflow_manager/workflow_v2/models/file_history.py+++ b/backend/workflow_manager/workflow_v2/models/file_history.py@@ -15,9 +15,7 @@ class FileHistory(BaseModel):Returns:bool: True if the execution status is completed, False otherwise."""- return (- self.status is not None and self.status == ExecutionStatus.COMPLETED.value- )+ return self.status is not None and self.status == ExecutionStatus.COMPLETEDid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)cache_key = models.CharField(@@ -30,7 +28,7 @@ class FileHistory(BaseModel):related_name="file_histories",)status = models.TextField(- choices=ExecutionStatus.choices(),+ choices=ExecutionStatus.choices,db_comment="Latest status of execution",)error = models.TextField(diff --git a/backend/workflow_manager/workflow_v2/workflow_helper.py b/backend/workflow_manager/workflow_v2/workflow_helper.pyindex 9b44b0caa..536c98796 100644--- a/backend/workflow_manager/workflow_v2/workflow_helper.py+++ b/backend/workflow_manager/workflow_v2/workflow_helper.py@@ -92,7 +92,7 @@ class WorkflowHelper:single_step: bool,scheduled: bool,execution_mode: tuple[str, str],- workflow_execution: Optional[WorkflowExecution],+ workflow_execution: WorkflowExecution,use_file_history: bool = True, # Will be False for API deployment alone) -> WorkflowExecutionServiceHelper:workflow_execution_service = WorkflowExecutionServiceHelper(@@ -136,9 +136,9 @@ class WorkflowHelper:destination: DestinationConnector,execution_service: WorkflowExecutionServiceHelper,single_step: bool,- hash_values_of_files: dict[str, FileHash] = {},+ input_files: dict[str, FileHash],) -> WorkflowExecution:- input_files, total_files = source.list_files_from_source(hash_values_of_files)+ total_files = len(input_files)error_message = Nonesuccessful_files = 0failed_files = 0@@ -203,6 +203,7 @@ class WorkflowHelper:execution_service.publish_log(message=error_message, level=LogLevel.ERROR)+ # TODO: Store only generic WF errors here (concerning all failed files)# TODO: Review if we need partial successif failed_files and failed_files >= total_files:execution_service.update_execution(@@ -259,11 +260,7 @@ class WorkflowHelper:except Exception as e:error = f"Error processing file '{os.path.basename(input_file)}'. {str(e)}"execution_service.publish_log(error, level=LogLevel.ERROR)- workflow_file_execution.update_status(- status=ExecutionStatus.ERROR,- execution_error=error,- )- # Not propagating error here to continue execution for other files+ # Handling error based on destination and continuing for other filesexecution_service.publish_update_log(LogState.RUNNING,f"Processing output for {file_name}",@@ -298,12 +295,12 @@ class WorkflowHelper:@staticmethoddef run_workflow(workflow: Workflow,+ workflow_execution: WorkflowExecution,hash_values_of_files: dict[str, FileHash] = {},organization_id: Optional[str] = None,pipeline_id: Optional[str] = None,scheduled: bool = False,single_step: bool = False,- workflow_execution: Optional[WorkflowExecution] = None,execution_mode: Optional[tuple[str, str]] = None,use_file_history: bool = True,) -> ExecutionResponse:@@ -343,13 +340,18 @@ class WorkflowHelper:destination.validate()# Execution Processtry:+ input_files, total_files = source.list_files_from_source(+ hash_values_of_files+ )+ workflow_execution.total_files = total_files+ workflow_execution.save()workflow_execution = WorkflowHelper.process_input_files(workflow,source,destination,execution_service,single_step=single_step,- hash_values_of_files=hash_values_of_files,+ input_files=input_files,)WorkflowHelper._update_pipeline_status(pipeline_id=pipeline_id, workflow_execution=workflow_execution@@ -674,6 +676,7 @@ class WorkflowHelper:pipeline_id=pipeline_id,mode=WorkflowExecution.Mode.QUEUE,execution_id=execution_id,+ total_files=len(hash_values),**kwargs, # type: ignore))@@ -724,6 +727,7 @@ class WorkflowHelper:single_step=False,pipeline_id=pipeline_id,mode=execution_mode,+ total_files=len(hash_values_of_files),))execution_id = workflow_execution.id@@ -770,7 +774,7 @@ class WorkflowHelper:# Normal executionworkflow_execution = WorkflowExecution.objects.get(pk=execution_id)if (- workflow_execution.status != ExecutionStatus.PENDING.value+ workflow_execution.status != ExecutionStatus.PENDINGor workflow_execution.execution_type != WorkflowExecution.Type.COMPLETE):raise InvalidRequest(WorkflowErrors.INVALID_EXECUTION_ID)@@ -833,7 +837,7 @@ class WorkflowHelper:except WorkflowExecution.DoesNotExist:raise WorkflowExecutionNotExist(WorkflowErrors.INVALID_EXECUTION_ID)if (- workflow_execution.status != ExecutionStatus.PENDING.value+ workflow_execution.status != ExecutionStatus.PENDINGor workflow_execution.execution_type != WorkflowExecution.Type.STEP):raise InvalidRequest(WorkflowErrors.INVALID_EXECUTION_ID)