Workflow execution
Workflow Runs API
This document outlines the API endpoints for running and managing workflow executions in PySpur.
Run Workflow (Blocking)
Description: Executes a workflow synchronously and returns the outputs. This is a blocking call that waits for the workflow to complete before returning a response. If the workflow contains a human intervention node, it may pause execution and return a pause exception.
URL: /wf/{workflow_id}/run/
Method: POST
Parameters:
Request Payload:
Response Schema:
Start Run (Non-Blocking)
Description: Starts a workflow execution asynchronously and returns immediately with the run details. The workflow continues execution in the background. This is useful for long-running workflows where you don’t want to wait for completion.
URL: /wf/{workflow_id}/start_run/
Method: POST
Parameters:
Request Payload: Same as Run Workflow (Blocking)
Response Schema:
Run Partial Workflow
Description: Executes a partial workflow starting from a specific node, using precomputed outputs for upstream nodes. This is useful for testing specific parts of a workflow without running the entire workflow.
URL: /wf/{workflow_id}/run_partial/
Method: POST
Parameters:
Request Payload:
Response Schema:
Start Batch Run
Description: Starts a batch execution of a workflow over a dataset. The workflow is run once for each row in the dataset, with dataset columns mapped to workflow inputs. Results are written to an output file.
URL: /wf/{workflow_id}/start_batch_run/
Method: POST
Parameters:
Request Payload:
Response Schema: Same as Start Run (Non-Blocking)
List Runs
Description: Lists all runs for a specific workflow with pagination support, ordered by start time descending. This endpoint also updates run status based on task status.
URL: /wf/{workflow_id}/runs/
Method: GET
Parameters:
Response Schema:
List Paused Workflows
Description: Lists all workflows that are currently in a paused state, with pagination support. This endpoint is useful for monitoring workflows that require human intervention.
URL: /wf/paused_workflows/
Method: GET
Query Parameters:
Response Schema:
Where PausedWorkflowResponseSchema
contains:
Get Pause History
Description: Retrieves the pause history for a specific workflow run, showing when and why the workflow was paused, and any actions taken to resume it.
URL: /wf/pause_history/{run_id}/
Method: GET
Parameters:
Response Schema:
Where PauseHistoryResponseSchema
contains:
Process Pause Action
Description: Processes an action on a paused workflow, allowing for approval, decline, or override of a workflow that has been paused for human intervention. The workflow will resume execution based on the action taken.
URL: /wf/process_pause_action/{run_id}/
Method: POST
Parameters:
Request Payload:
Response Schema: Same as Start Run (Non-Blocking)
Cancel Workflow
Description: Cancels a workflow that is currently paused or running. This will mark the run as CANCELED in the database and update all pending, running, and paused tasks to CANCELED as well.
URL: /wf/cancel_workflow/{run_id}/
Method: POST
Parameters:
Response Schema: Same as Start Run (Non-Blocking) with a message indicating the workflow has been canceled successfully.