Skip to content

Commit

Permalink
Add notes to fallback domain about threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
ystxn committed Nov 26, 2024
1 parent f4f06d1 commit 91c02e3
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions docs/developer-guides/task-to-domain.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ new TaskManager(
options: { concurrency: 5, pollInterval: 100, domain: "domain" },
}
);
// *Note* worker domain has precedence over the domain passed in the poller
// *Note* worker domain has precedence over the domain passed in the poller
```
</TabItem>
Expand Down Expand Up @@ -197,7 +197,7 @@ new TaskManager(
options: { concurrency: 5, pollInterval: 100, domain: "domain" },
}
)
// *Note* worker domain has precedence over the domain passed in the poller
// *Note* worker domain has precedence over the domain passed in the poller
```
</TabItem>
<TabItem value="Clojure" label="Clojure">
Expand All @@ -212,7 +212,7 @@ new TaskManager(
### Workflow configuration
When you start a workflow, you can specify which tasks must run on which domains.
When you start a workflow, you can specify which tasks must run on which domains.
<Tabs>
<TabItem value="Using API" label="Using API">
Expand All @@ -229,7 +229,7 @@ POST /api/workflow/{name}
For running a workflow from the Conductor UI, define the following task-to-domain mapping:
```json
{
{
"task_x": "test"
}
```
Expand All @@ -252,13 +252,20 @@ To enable domain permissions:
5. Enable the **Execute** toggle.
6. Select **Add Permissions**.
The application/group can now execute all tasks under the specified domain.
The application/group can now execute all tasks under the specified domain.
## Fallback task-to-domain​
A fallback domain is a secondary or backup domain that the system will use if the primary domain fails or is unreachable. These domains can only be specified when triggering a workflow, as clients polling for tasks can use only one domain at a time.
The Conductor tracks each worker's last polling time. When assigning tasks, it first checks if any active workers (those who polled within the last x seconds) are available for the primary domain. If no active workers are found, the Conductor tries the next domain in the fallback sequence.
Conductor tracks each worker's last polling time. When assigning tasks, it first checks if any active workers are available for the primary domain. If no active workers are found, the Conductor tries the next domain in the fallback sequence.
:::note Notes
* A worker is considered active if the last time it has polled is within the active threshold, which defaults to 10 seconds
* Workers do not poll when they are busy doing work and resume polling once they have completed their tasks
* The active threshold can be adjusted using the configuration field `conductor.app.activeWorkerLastPollTimeout`. This applies to all worker tasks, so extending the duration slows down the fallback response bahaviour across all tasks.
* The domain of a task is determined at the point in time when the task is scheduled, so a domain worker becoming free after a task gets scheduled will not change the domain of a task that has already been scheduled
:::
A fallback mapping for `task_x’ is as follows:

Expand All @@ -268,7 +275,7 @@ A fallback mapping for `task_x’ is as follows:
}
```

In this configuration,
In this configuration,
* Conductor first assigns the task to workers in the `test` domain if available.
* If no workers are active in the `test` domain, it tries the `fallback` domain.
* If neither `test` nor `fallback` have active workers, the task is assigned to `NO_DOMAIN`.
Expand Down

0 comments on commit 91c02e3

Please sign in to comment.