Skip to content

Workflow Priority

Workflow priority controls which waiting task is handed to a worker first when tasks of the same type are queued up. When workers can't keep up with demand, tasks from higher-priority workflows go to the front of the line.

Priority is set per workflow execution, and every task in that execution inherits it.

How priority works

You can give a workflow a priority from 0 to 99 when you start it. A lower number means higher priority: 1 is the highest and 99 the lowest.

Priority Behavior
1 to 99 Handled ahead of any workflow started without a priority. Within this range, tasks from priority 1 are handed to workers first.
0 (default) Used when you don't set a priority. Ranks below all of 1 to 99. Workflows with no priority are handled roughly in the order they were started, oldest first.

Priority of sub-workflows and event handlers

  • Sub-workflows take their parent's priority unless you set a different one on the Sub Workflow task.
  • Workflows started by event handlers always use the default priority (0).

Setting priority

Via the Start Workflow API

Use the Start Workflow API and pass the priority in the priority query parameter:

curl -X 'POST' \
  'https://<YOUR-SERVER-URL>/api/workflow/<WORKFLOW-NAME>?priority=5' \
  -H 'accept: text/plain' \
  -H 'X-Authorization: <TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
  "input1": "someValue"
}'

You can also pass priority in the request body of the Start Workflow API (POST /api/workflow):

{
  "name": "<WORKFLOW-NAME>",
  "version": 1,
  "priority": 5,
  "input": {
    "input1": "someValue"
  }
}

Via the SDK

var request = new StartWorkflowRequest();
request.setName("order-processing-workflow");
request.setVersion(1);
request.setPriority(5);

String workflowId = workflowClient.startWorkflow(request);
from conductor.client.http.models import StartWorkflowRequest

request = StartWorkflowRequest(
    name="order-processing-workflow",
    version=1,
    priority=5
)

workflow_id = workflow_client.start_workflow(request)
const workflowId = await executor.startWorkflow({
  name: "order-processing-workflow",
  version: 1,
  priority: 5,
});
var request = new StartWorkflowRequest(
    name: "order-processing-workflow",
    version: 1,
    priority: 5
);

string workflowId = workflowExecutor.StartWorkflow(request);
request := &model.StartWorkflowRequest{
    Name:     "order-processing-workflow",
    Version:  1,
    Priority: 5,
}

workflowId, err := executor.StartWorkflow(request)
request = Conductor::Http::Models::StartWorkflowRequest.new(
  name: 'order-processing-workflow',
  version: 1,
  priority: 5
)

workflow_id = workflow_executor.start_workflow(request)

Via the Start Workflow task

Use the Start Workflow task inside a workflow to trigger another workflow with a priority. Unlike the Sub Workflow task, the Start Workflow task does not inherit the parent's priority. If you don't set priority, the started workflow runs at priority 0.

{
  "name": "start_workflow",
  "taskReferenceName": "start_workflow_ref",
  "inputParameters": {
    "startWorkflow": {
      "name": "<WORKFLOW-NAME>",
      "input": {
        "someKey": "someValue"
      },
      "priority": 5
    }
  },
  "type": "START_WORKFLOW"
}

Via the Sub Workflow task

The Sub Workflow task takes the parent's priority by default. To use a different one, set priority in subWorkflowParam:

{
  "name": "sub_workflow",
  "taskReferenceName": "sub_workflow_ref",
  "inputParameters": {
    "someKey": "someValue"
  },
  "type": "SUB_WORKFLOW",
  "subWorkflowParam": {
    "name": "<SUB-WORKFLOW-NAME>",
    "version": 3,
    "priority": 5
  }
}

The priority can also be dynamic. For example, set "priority": "${taskRef.output.someValue}" to use a value produced by an earlier task.

Via the Scheduler

When defining a workflow schedule, set priority in the startWorkflowRequest. It supports values from 0 to 99.

{
  "name": "sample_scheduler",
  "cronExpression": "0 0 0 * * ?",
  "startWorkflowRequest": {
    "name": "<WORKFLOW-NAME>",
    "version": "",
    "input": {
      "input1": "123"
    },
    "priority": 5
  },
  "zoneId": "UTC"
}

What priority does

Priority decides which waiting task is handed out next when tasks of the same type are queued up waiting for workers.

  • When there's a backlog, tasks from higher-priority workflows go to the front of the line. The next available worker gets them first.
  • It applies at every step. Each task a higher-priority workflow schedules also goes ahead of other waiting tasks of its type. This includes built-in tasks such as HTTP.

What priority doesn't do

  • It doesn't add capacity. If your workers keep up with demand, nothing is waiting and priority has no visible effect. It only matters when tasks are queued.
  • It doesn't interrupt running work. Tasks that are already running are never paused or pre-empted.
  • It doesn't work across task types or domains. Priority orders tasks within one task type in one domain. A high-priority task on a busy task type still waits for a worker of that type.
  • It doesn't apply to tasks that run inline. When a workflow runs with SYNCHRONOUS consistency, tasks such as HTTP run directly on the server instead of waiting in a queue for a worker, so there is no queue for priority to reorder.
  • It is lost on delayed or throttled tasks. If a task is held back, it rejoins the queue by time rather than by priority. See Delayed and throttled tasks.
  • It doesn't affect workflow-level limits. Workflows waiting for a concurrency slot are let through in arrival order, not by priority.

Delayed and throttled tasks

A task loses its priority advantage when it is held back. This happens when:

  • it is retried with a delay
  • it hits a concurrency or rate limit
  • it asks to be checked again later

Under heavy load, that task can end up behind newer tasks that are ready to run straight away.

Best practices

  • Use priority to favour urgent work when there's a backlog, not to guarantee speed. Priority only reorders tasks that are already waiting.
  • Use a separate task domain for guaranteed capacity. If you need isolation for critical workloads, run them in a separate task domain with their own workers.
  • Be careful combining priority with task rate limits, concurrency limits, and retry delays. A task that is delayed or held back loses its advantage.
  • Set priority explicitly when you use it. Default-priority workflows are always handled after any workflow that has one.