-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Summary
Currently, users cannot stop or cancel jobs that are running. Once a job execution starts, it must complete or fail naturally. This limits user control and can be problematic for long-running jobs or jobs that get stuck.
Current State
- Job execution is managed through the ExecutionHistory component
- Jobs have states:
pending,running,completed,failed - Users can view results, logs, traces, schedule, and delete completed jobs
- No mechanism exists to interrupt running jobs
Proposed Solution
Frontend Changes
-
Add Stop Button in
ExecutionActions.tsx- Only visible for jobs with
runningstatus - Use Material-UI
StopIconwith error color - Include confirmation dialog for critical jobs
- Only visible for jobs with
-
Update Job Status System
- Add new statuses:
stopping,cancelled - Update status chips and colors in ExecutionHistory
- Add translations for new statuses
- Add new statuses:
-
API Integration
- Add
stopJob(jobId)method toJobExecutionService.ts - Integrate with
runStatusStorefor state management - Handle stop errors gracefully
- Add
Backend Changes
-
New API Endpoint
POST /executions/{job_id}/stop- Gracefully terminate CrewAI execution
- Update job status to
cancelled - Return success/failure response
-
CrewAI Integration
- Implement job termination in CrewAI engine
- Handle cleanup of running tasks
- Ensure database consistency
Technical Details
Frontend Files to Modify:
src/frontend/src/components/Jobs/ExecutionActions.tsx- Add stop buttonsrc/frontend/src/services/JobExecutionService.ts- Add stop API callsrc/frontend/src/store/runStatus.ts- Add stop actionsrc/frontend/src/locales/- Add translations
Backend Files to Modify:
src/backend/src/api/executions/routes.py- Add stop endpointsrc/backend/src/services/execution_service.py- Add stop logicsrc/backend/src/engines/crewai/- Implement job termination
Acceptance Criteria
- Running jobs display a stop button in ExecutionActions
- Stop button shows confirmation dialog before proceeding
- Backend endpoint gracefully terminates CrewAI processes
- Job status updates to "cancelled" when stopped
- Real-time UI updates reflect stopped status
- Error handling for already completed jobs
- Unit tests for stop functionality
- Integration tests for stop endpoint
Priority
Medium - This is a quality-of-life improvement that enhances user control over job execution.
Labels
enhancement, frontend, backend, user-experience
Metadata
Metadata
Assignees
Labels
No labels