Monitoring Executions
Check Execution Status
Use the tailor workflow executions command to check the status of a workflow execution:
tailor workflow executions <execution-id>With logs:
tailor workflow executions <execution-id> --logsUsage:
tailor 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 workflow executionsFilter by workflow name:
tailor workflow executions --workflow-name my-workflowFilter by status:
tailor workflow executions --status RUNNINGCombine filters:
tailor 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 or resolve
- running: Currently executing
- waiting: Paused by
wait(), waiting for an externalresolve()signal (see Wait / Resolve) - 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 workflow executions <execution-id> --waitThis will poll for updates until the execution completes.
Customize polling interval:
tailor workflow executions <execution-id> --wait --interval 5sWait and show logs:
tailor workflow executions <execution-id> --wait --logsThe start command returns an execution ID that you can use with workflow executions to monitor progress.
Execution Events
Besides polling, a workflow can publish its execution lifecycle as platform events, so that an executor reacts to each state transition as it happens. Refer to Workflow events for the event catalog and payloads.
Publishing is controlled per resource by publishEvents, and you normally do not have to set it. When an executor subscribes to a workflow's execution events, deploy enables publishing automatically on the resources that produce them:
- A
workflowExecution*trigger enables it on the workflow it names, which publishes theworkflow.workflow_execution.*events. - A
workflowJobExecution*trigger enables it on every job the named workflow runs, which publishes theworkflow.workflow_execution.job_execution.*events.
Set publishEvents explicitly to override that. Use true to publish workflow-level events without a subscribing executor:
import { createWorkflow } from "@tailor-platform/sdk";
import { processOrder } from "./jobs/process-order";
export default createWorkflow({
name: "order-processing",
mainJob: processOrder,
publishEvents: true,
});A job takes the same field for its own execution events:
import { createWorkflowJob } from "@tailor-platform/sdk";
export const processOrder = createWorkflowJob({
name: "process-order",
publishEvents: true,
body: async () => ({ processed: true }),
});Use false to keep publishing off. deploy fails if an executor subscribes to events that the value opts out of, so a subscription cannot silently go unfulfilled.
To consume these events, configure an executor with a workflow execution trigger. See Event-based Trigger.
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 workflow resume <execution-id>Usage:
tailor 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 workflow resume <execution-id> --waitResume and show logs:
tailor 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 againResuming from Code
You can also resume a failed or pending-retry execution from your own code (a workflow job function, an executor, or a resolver) using tailor.workflow.resumeWorkflowExecution(). This lets you build self-healing flows that recover from transient failures automatically, without an operator running tailor workflow resume or using the Tailor Console.
Example:
export async function main(args) {
const resumedId = await tailor.workflow.resumeWorkflowExecution(args.executionId);
console.log("Resumed execution:", resumedId);
return { resumedExecutionId: resumedId };
}API Reference:
- First argument: Execution ID of a failed or pending-retry execution (string)
Return value:
- Execution ID of the resumed execution (string)
resumeWorkflowExecution() behaves like the resume command described above. The workflow restarts from the main function and reuses the cached results of successful job functions, so only failed or not-yet-executed jobs run again. It rejects with an error describing why the execution cannot be resumed when it isn't in a resumable state. Let that error propagate to fail the calling execution, and add a try/catch only when you need to control the error or its message.
When 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 deploy