Skip to content

Commit

Permalink
Merge pull request #815 from orkes-io/liv-update
Browse files Browse the repository at this point in the history
Doc updates
  • Loading branch information
RizaFarheen authored Dec 6, 2024
2 parents 879989e + 6cedabb commit 473333f
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 15 deletions.
8 changes: 4 additions & 4 deletions docs/developer-guides/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ You can set a failure workflow for a workflow in its **workflow definition**. Be

## Workflow rate limits

A workflow’s rate limit controls the number of concurrent executions being worked on. Beyond this limit, workflows will be queued for execution based on their trigger time.
A workflow’s rate limit controls the number of concurrent executions that can be active. Beyond this limit, workflows will be queued for execution based on their start time.

When the number of scheduled workflows exceeds the defined rate limit, the Conductor server will place these workflows in a RUNNING state with the first task set to a PENDING status. Once a workflow completes, the rate limit is freed up and the server will schedule the next first PENDING task for polling.
When the number of scheduled workflows exceeds the defined rate limit, the Conductor server will place these workflows in a RUNNING state with the first task set to a PENDING status. Once a workflow completes, the rate limit is freed up and the server will schedule the next PENDING task for polling.


### Rate limit configuration
Expand All @@ -240,15 +240,15 @@ You can configure the limit on concurrent workflow executions in its **workflow

| Parameter | Description | Required/ Optional |
| --------- | ----------- | ------------------ |
| rateLimitConfig | A map of the workflow rate limit configuration. | Required. |
| rateLimitConfig | A map of the workflow rate limit configuration. | Optional. |
| rateLimitConfig. **rateLimitKey** | A unique identifier to group workflow executions for rate limits. <br/><br/> Can be a fixed value (for example, “max”) or a [dynamic variable](/developer-guides/passing-inputs-to-task-in-conductor#sample-expressions) from the workflow parameters (for example, `${workflow.correlationId}`). | Required. |
| rateLimitConfig. **concurrentExecLimit** | The number of workflow executions that can run concurrently for each rate limit key. Cannot be passed as a dynamic variable. | Required. |

### Routing rate limits with dynamic key

Using a dynamic `rateLimitKey`, you can apply separate rate limit queues based on workflow inputs like `correlationId` or `version`. The rate limit for each group of workflows will be the same, based on the `concurrentExecLimit`.

For example, if workflow executions are grouped according to their correlation ID with `concurrentExecLimit` set to 100, workflows triggered with correlation IDs 1 and 2 will each have their own rate limit queues capped at 100.
For example, if workflow executions are grouped according to their correlation ID with `concurrentExecLimit` set to 100, workflows triggered with correlation IDs 1 and 2 will have their rate limit queues capped at 100 each.

**Example**

Expand Down
1 change: 0 additions & 1 deletion docs/developer-guides/secrets-in-conductor.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
sidebar_position: 6
slug: "/developer-guides/secrets-in-conductor"
description: "Learn how to securely pass sensitive variables using secrets or masked inputs."
---
Expand Down
69 changes: 59 additions & 10 deletions docs/reference-docs/operators/do-while.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@ This is the task configuration for a Do While task.
## Task output
The Do While task will return the following parameters.

| Parameter | Description |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Parameter | Description |
| ------------- | ------------------------------------------------------------------------ |
| iteration | The number of iterations. If the Do While task is in progress, `iteration` will show the current iteration number. If the Do While task is completed, `iteration` will show the final number of iterations. |
| i | The iteration number, mapped to the task references names and their output. |

In addition to the two parameters above, the output payload may also contain any state stored in `loopCondition`. For example, `storage` will exist as an output parameter if the `loopCondition` is `if ($.LoopTask['iteration'] <= 10) {$.LoopTask.storage = 3; true } else {false}`.

In addition, an object will be created for each iteration, keyed by its iteration number (eg. 1, 2, 3) and containing the task reference names of all the loop tasks and their outputs.

The output payload may also contain any state stored in `loopCondition`. For example, `storage` will exist as an output parameter if the `loopCondition` is `if ($.LoopTask['iteration'] <= 10) {$.LoopTask.storage = 3; true } else {false}`.


**Example output**

Expand Down Expand Up @@ -104,18 +107,18 @@ Each time a task in the do while loop is completed, the output is saved and inde
Here are some examples for using the Do While task.


<details><summary>Example Do While task</summary>
<details><summary>Using `graaljs` evaluator</summary>
<p>

```json
{
"name": "Loop Task",
"taskReferenceName": "LoopTask",
"type": "DO_WHILE",
"name": "do_while",
"taskReferenceName": "do_while_ref",
"inputParameters": {
"value": "${workflow.input.value}"
"number": "${workflow.input.qty}"
},
"loopCondition": "if ( ($.LoopTask['iteration'] < $.value ) || ( $.first_task['response']['body'] > 10)) { false; } else { true; }",
"type": "DO_WHILE",
"loopCondition": "(function () {\n if ($.do_while_ref['iteration'] < $.number) {\n return true;\n }\n return false;\n})();",
"loopOver": [
{
"name": "first task",
Expand All @@ -140,6 +143,7 @@ Here are some examples for using the Do While task.
"type": "HTTP"
}
]
"evaluatorType": "graaljs"
}
```

Expand Down Expand Up @@ -238,6 +242,51 @@ The Do While task’s `taskReferenceName` is "get_all_stars_loop_ref". To evalua
</p>
</details>

<details><summary>Iterate over a list of items</summary>
<p>
It is possible to iterate over a list of items as long as the Do While task has `items` as an input parameter.

The number of iterations will be equal to the list size. If `“items”=[“a”,“b”,“c”]`, the loop tasks will be executed three times; if `“items”=[]`, the Do While task will be marked as completed without executing the loop tasks.

Each item in the list is passed into each iteration of the loop task using `${do_while_ref.output.item}`.

``` json
{
"name": "do_while",
"taskReferenceName": "do_while_ref",
"inputParameters": {
"items": [
"a",
"b",
"c"
]
},
"type": "DO_WHILE",
"loopCondition": "",
"loopOver": [
{
"name": "http",
"taskReferenceName": "http_ref",
"inputParameters": {
"uri": "https://orkes-api-tester.orkesconductor.com/api",
"method": "GET",
"accept": "application/json",
"contentType": "application/json",
"encode": true,
"body": {
"item": "${do_while_ref.output.item}"
},
"headers": {}
},
"type": "HTTP"
}
],
"evaluatorType": "value-param"
}
```
</p>
</details>

## Limitations

There are several limitations for the Do While task:
Expand Down

0 comments on commit 473333f

Please sign in to comment.