What is the difference between WorkflowRunTimeout and WorkflowTaskTimeout?

Workflow docs (Workflows | Temporal) mention WorkflowRunTimeout and WorkflowTaskTimeout.

Run timeout clearly covers the entire run of the workflow, but I don’t understand what is a task here?

1 Like

TLDR; When a new external event is received a workflow task is responsible for determining which next commands to execute.

Temporal workflows are executed by an external worker. So the only way to learn about which next steps a workflow has to take is to ask it every time new information is available. The only way to dispatch such a request to a worker is to put a workflow task into a task queue. The workflow worker picks it up, gets workflow out of its cache, and applies new events to it. After the new events are applied the workflow code executes producing a new set of commands. After the workflow code is blocked and cannot make any forward progress the workflow task is reported as completed back to the service. The list of commands to execute is included in the completion request.

The above means that during a lifetime of a workflow multiple workflow tasks have to be executed. For example for a workflow that calls two activities in a sequence:

a();
b();

The tasks will be executed for every state transition:

-> workflow task at the beginning: command is ScheduleActivity "a"
    a();
-> workflow task when "a" completes: command is ScheduleActivity "b"
    b();
-> workflow task when "b" completes: command is CompleteWorkflowExecution
1 Like