🎯 Issue Summary
Implement execution timeout mechanism and manual cancellation support for long-running pipelines.
📋 Current Behavior
Pipelines can run indefinitely with no timeout or cancellation mechanism.
Current Limitations:
- No execution timeout
- Cannot cancel running executions
- Stuck pipelines consume resources indefinitely
✨ Proposed Solution
Add timeout configuration and cancellation API:
- Per-pipeline timeout settings
- Manual cancellation via API
- Graceful shutdown of running stages
- Timeout tracking in execution logs
🔧 Technical Requirements
1. Timeout Configuration
2. Timeout Enforcement
3. Cancellation API
4. Execution Tracking
📝 Acceptance Criteria
- ✅ Pipelines timeout after configured duration
- ✅ Manual cancellation works via API
- ✅ Execution status updated correctly (TIMEOUT/CANCELLED)
- ✅ Resources cleaned up on timeout/cancellation
- ✅ Logs show timeout/cancellation details
💡 Implementation Example
# backend/core/executor.py [9](#header-9)
import asyncio
async def execute_with_timeout(pipeline: Pipeline, execution_id: str):
timeout = pipeline.timeout_seconds or 3600
try:
await asyncio.wait_for(
execute_pipeline(pipeline, execution_id),
timeout=timeout
)
except asyncio.TimeoutError:
execution = executions_db[execution_id]
execution.status = ExecutionStatus.TIMEOUT
execution.error = f"Execution exceeded timeout of {timeout}s"
raise
# Cancellation check [10](#header-10)
async def execute_stage(stage, execution_id):
execution = executions_db[execution_id]
if execution.cancelled:
raise CancellationError("Execution cancelled by user")
# Execute stage logic
🎯 Issue Summary
Implement execution timeout mechanism and manual cancellation support for long-running pipelines.
📋 Current Behavior
Pipelines can run indefinitely with no timeout or cancellation mechanism.
Current Limitations:
✨ Proposed Solution
Add timeout configuration and cancellation API:
🔧 Technical Requirements
1. Timeout Configuration
timeout_secondsfield to Pipeline model2. Timeout Enforcement
asyncio.wait_for()TimeoutErrorwhen exceededTIMEOUT3. Cancellation API
DELETE /api/executions/{id}endpoint4. Execution Tracking
cancelled_attimestamp field📝 Acceptance Criteria
💡 Implementation Example