Monitoring Executions
Check Execution Status
Use the tailor-sdk workflow executions command to check the status of a workflow execution:
tailor-sdk workflow executions <execution-id>With logs:
tailor-sdk workflow executions <execution-id> --logsUsage:
tailor-sdk workflow executions [options] [executionId]Arguments:
[executionId]: Execution ID (optional). If provided, shows execution details. If omitted, lists all executions.
Options:
--logs: Display job execution logs (detail mode only)--wait(-W): Wait for execution to complete--interval <INTERVAL>(-i): Polling interval when using --wait (e.g., '3s', '500ms', '1m', default: '3s')--workflow-name <WORKFLOW_NAME>(-n): Filter by workflow name (list mode only)--status <STATUS>(-s): Filter by status (list mode only)--json(-j): Output as JSON
Output:
Execution ID: yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy
Workflow ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Status: success
Started At: 2025-01-15T10:30:00Z
Finished At: 2025-01-15T10:30:45Z
Job Executions:
1. main (success)
Started: 2025-01-15T10:30:00Z
Finished: 2025-01-15T10:30:45Z
Stacked Task: main
2. fetchData (success)
Started: 2025-01-15T10:30:05Z
Finished: 2025-01-15T10:30:15Z
Stacked Task: main/fetchData
3. processData (success)
Started: 2025-01-15T10:30:20Z
Finished: 2025-01-15T10:30:40Z
Stacked Task: main/processData
Result: {
"success": true,
"processed": {...}
}List All Executions
List all workflow executions in your workspace:
tailor-sdk workflow executionsFilter by workflow name:
tailor-sdk workflow executions --workflow-name my-workflowFilter by status:
tailor-sdk workflow executions --status RUNNINGCombine filters:
tailor-sdk workflow executions --workflow-name my-workflow --status FAILEDExecution Status
A workflow execution can have the following statuses:
- pending: Waiting to be picked up by the scheduler
- pending_resume: Waiting to be resumed after a failure
- running: Currently executing
- success: Completed successfully
- failed: Execution failed (can be resumed)
Follow Execution Progress
You can follow an execution in real-time using the --wait flag:
tailor-sdk workflow executions <execution-id> --waitThis will poll for updates until the execution completes.
Customize polling interval:
tailor-sdk workflow executions <execution-id> --wait --interval 5sWait and show logs:
tailor-sdk workflow executions <execution-id> --wait --logsThe start command returns an execution ID that you can use with workflow executions to monitor progress.
Monitoring in Tailor Console
You can also monitor workflow executions through the Tailor Console web interface.
The console provides:
- Visual execution timeline
- Job function execution details
- Error messages and logs
- Execution history for all workflow runs
Resume and Retry
Resuming Failed Workflows
If a workflow execution fails, you can resume it from the point of failure using the resume command:
tailor-sdk workflow resume <execution-id>Usage:
tailor-sdk workflow resume [options] <executionId>Arguments:
<executionId>: Failed execution ID (required)
Options:
--wait(-W): Wait for execution to complete--interval <INTERVAL>(-i): Polling interval when using --wait (e.g., '3s', '500ms', '1m', default: '3s')--logs(-l): Display job execution logs after completion (requires --wait)--json(-j): Output as JSON
Resume and wait for completion:
tailor-sdk workflow resume <execution-id> --waitResume and show logs:
tailor-sdk workflow resume <execution-id> --wait --logsWhat happens during resume:
- The system retrieves all successful job function results from the previous run
- The workflow restarts from the main function
- Successful job functions are skipped (their cached results are used)
- Failed or not-yet-executed job functions are executed
Example:
Original execution:
fetchData → Success ✓
processData → Success ✓
saveToDb → Failed ✗After resume:
fetchData → Skipped (cached)
processData → Skipped (cached)
saveToDb → Executed againWhen to Use Resume
Resume is useful when:
- External API calls fail temporarily
- Database connections time out
- Rate limits are hit
- Any transient error occurs
Important: Only resume when the failure is transient. If the failure is due to invalid data or logic errors, fix the issue and create a new execution instead.
Idempotency Best Practices
Design your job functions to be idempotent (safe to execute multiple times):
Good - Idempotent:
export async function main(args) {
// Check if record already exists
const existing = await checkRecord(args.id);
if (existing) {
console.log("Record already exists, skipping");
return existing;
}
// Create only if not exists
return await createRecord(args);
}Avoid - Not Idempotent:
export function main(args) {
// This will create duplicate records on retry
return createRecord(args);
}Tips for idempotency:
- Check for existing records before creating
- Use unique identifiers (UUIDs, order IDs, etc.)
- Design operations to be repeatable
- Use database constraints to prevent duplicates
Testing and Development
Creating Workflows with SDK
Workflows are created and managed using the Tailor Platform SDK. Define workflows in your code using createWorkflow:
import { createWorkflow } from "@tailor-platform/sdk";
export const myWorkflow = createWorkflow({
name: "my-workflow",
steps: [
// Define your workflow steps
],
});After defining your workflow, deploy it using:
tailor-sdk apply