LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
UN-2862 [FIX] Remove legacy QUEUED and CANCELED statuses from ExecutionStatus enum (#1571)
alid7113fcf807f
diff --git a/backend/workflow_manager/file_execution/models.py b/backend/workflow_manager/file_execution/models.pyindex 9a1508cb3..d5106855e 100644--- a/backend/workflow_manager/file_execution/models.py+++ b/backend/workflow_manager/file_execution/models.py@@ -208,13 +208,6 @@ class WorkflowFileExecution(BaseModel):fields=["workflow_execution", "provider_file_uuid", "file_path"],name="unique_workflow_provider_uuid_path",),- # CRITICAL FIX: Add constraint for API files where file_path is None- # This prevents duplicate entries for same file_hash- models.UniqueConstraint(- fields=["workflow_execution", "file_hash"],- condition=models.Q(file_path__isnull=True),- name="unique_workflow_api_file_hash",- ),]@propertydiff --git a/unstract/core/src/unstract/core/data_models.py b/unstract/core/src/unstract/core/data_models.pyindex eb26ed749..7900ca22e 100644--- a/unstract/core/src/unstract/core/data_models.py+++ b/unstract/core/src/unstract/core/data_models.py@@ -355,10 +355,6 @@ class ExecutionStatus(Enum):STOPPED = "STOPPED" # Added to match backendERROR = "ERROR" # Changed from FAILED to match backend- # Keep legacy statuses for backward compatibility during transition- QUEUED = "QUEUED" # Legacy - consider deprecated- CANCELED = "CANCELED" # Legacy - maps to STOPPED-def __str__(self):"""Return enum value for Django CharField compatibility.@@ -373,9 +369,9 @@ class ExecutionStatus(Enum):return f"ExecutionStatus.{self.name}"-# Add Django-compatible choices attribute after class definition+# Add Django-compatible choices attribute with human-readable labelsExecutionStatus.choices = tuple(- (status.value, status.value) for status in ExecutionStatus+ (status.value, status.name.replace("_", " ").title()) for status in ExecutionStatus)diff --git a/unstract/core/src/unstract/core/worker_models.py b/unstract/core/src/unstract/core/worker_models.pyindex 6c77c9836..af81cea72 100644--- a/unstract/core/src/unstract/core/worker_models.py+++ b/unstract/core/src/unstract/core/worker_models.py@@ -135,8 +135,6 @@ class StatusMappings:ExecutionStatus.STOPPED: PipelineStatus.FAILURE,ExecutionStatus.EXECUTING: PipelineStatus.INPROGRESS,ExecutionStatus.PENDING: PipelineStatus.YET_TO_START,- ExecutionStatus.QUEUED: PipelineStatus.YET_TO_START, # Legacy compatibility- ExecutionStatus.CANCELED: PipelineStatus.FAILURE, # Legacy compatibility}PIPELINE_TO_EXECUTION = {diff --git a/workers/callback/tasks.py b/workers/callback/tasks.pyindex 93c5ded15..088cdc6f8 100644--- a/workers/callback/tasks.py+++ b/workers/callback/tasks.py@@ -120,8 +120,6 @@ def _map_execution_status_to_pipeline_status(execution_status: str) -> str:ExecutionStatus.EXECUTING.value: PipelineStatus.INPROGRESS.value,ExecutionStatus.PENDING.value: PipelineStatus.YET_TO_START.value,ExecutionStatus.STOPPED.value: PipelineStatus.FAILURE.value,- ExecutionStatus.QUEUED.value: PipelineStatus.INPROGRESS.value,- ExecutionStatus.CANCELED.value: PipelineStatus.FAILURE.value,# Legacy status values for backward compatibility"SUCCESS": PipelineStatus.SUCCESS.value, # Legacy alias for COMPLETED"FAILED": PipelineStatus.FAILURE.value, # Legacy alias for ERRORdiff --git a/workers/shared/api/internal_client.py b/workers/shared/api/internal_client.pyindex 9689687cb..be8d89a48 100644--- a/workers/shared/api/internal_client.py+++ b/workers/shared/api/internal_client.py@@ -940,7 +940,7 @@ class InternalAPIClient(CachedAPIClientMixin):mime_type: str = "",provider_file_uuid: str | None = None,fs_metadata: dict[str, Any] | None = None,- status: str = "QUEUED",+ status: str | ExecutionStatus = ExecutionStatus.PENDING,) -> dict[str, Any]:"""Create WorkflowFileExecution record via internal API with complete metadata."""return self.file_client.create_workflow_file_execution(diff --git a/workers/shared/clients/execution_client.py b/workers/shared/clients/execution_client.pyindex d84ced3a7..80e9ca656 100644--- a/workers/shared/clients/execution_client.py+++ b/workers/shared/clients/execution_client.py@@ -445,8 +445,6 @@ class ExecutionAPIClient(BaseAPIClient):ExecutionStatus.STOPPED.value: PipelineStatus.FAILURE.value,ExecutionStatus.EXECUTING.value: PipelineStatus.INPROGRESS.value,ExecutionStatus.PENDING.value: PipelineStatus.YET_TO_START.value,- ExecutionStatus.QUEUED.value: PipelineStatus.INPROGRESS.value,- ExecutionStatus.CANCELED.value: PipelineStatus.FAILURE.value,}# Map to pipeline status if it's an execution status, otherwise use as-isdiff --git a/workers/shared/enums.py b/workers/shared/enums.pyindex 4ffb4430a..4a26ae403 100644--- a/workers/shared/enums.py+++ b/workers/shared/enums.py@@ -151,13 +151,6 @@ class FileHistoryStatus(Enum):return self.value-# Legacy compatibility mappings-LEGACY_STATUS_MAPPING = {- "INPROGRESS": "EXECUTING",- "FAILED": "ERROR",- "CANCELED": "STOPPED",-}-LEGACY_CONNECTION_TYPES = {"APPDEPLOYMENT": "API","FILESYSTEM": "FILESYSTEM",diff --git a/workers/shared/utils/status_mapping.py b/workers/shared/utils/status_mapping.pyindex c21d9cb37..e106ca61f 100644--- a/workers/shared/utils/status_mapping.py+++ b/workers/shared/utils/status_mapping.py@@ -23,8 +23,6 @@ class StatusMappings:ExecutionStatus.STOPPED: PipelineStatus.FAILURE,ExecutionStatus.EXECUTING: PipelineStatus.INPROGRESS,ExecutionStatus.PENDING: PipelineStatus.YET_TO_START,- ExecutionStatus.QUEUED: PipelineStatus.YET_TO_START, # Legacy compatibility- ExecutionStatus.CANCELED: PipelineStatus.FAILURE, # Legacy compatibility}PIPELINE_TO_EXECUTION = {