MCPcopy Create free account
hub / github.com/ScrapeGraphAI/scrapecraft / manual_transition

Function manual_transition

backend/app/api/workflow.py:135–165  ·  view source on GitHub ↗

Manually transition to a different phase.

(
    pipeline_id: str,
    target_phase: WorkflowPhase,
    reason: Optional[str] = None,
    manager: WorkflowManager = Depends(get_manager)
)

Source from the content-addressed store, hash-verified

133
134@router.post("/workflow/{pipeline_id}/transition")
135async def manual_transition(
136 pipeline_id: str,
137 target_phase: WorkflowPhase,
138 reason: Optional[str] = None,
139 manager: WorkflowManager = Depends(get_manager)
140):
141 """Manually transition to a different phase."""
142 workflow = manager.get_workflow(pipeline_id)
143 if not workflow:
144 raise HTTPException(status_code=404, detail="Workflow not found")
145
146 if not workflow.can_transition_to(target_phase):
147 raise HTTPException(
148 status_code=400,
149 detail=f"Cannot transition from {workflow.phase} to {target_phase}"
150 )
151
152 workflow.add_transition(
153 target_phase,
154 reason or "Manual transition",
155 "user"
156 )
157
158 # Broadcast update
159 await manager._broadcast_workflow_update(workflow)
160
161 return {
162 "success": True,
163 "workflow": workflow.dict(),
164 "message": f"Transitioned to {target_phase}"
165 }
166
167
168@router.get("/workflow/{pipeline_id}/history")

Callers

nothing calls this directly

Calls 4

can_transition_toMethod · 0.80
add_transitionMethod · 0.80
get_workflowMethod · 0.45

Tested by

no test coverage detected