Skip to content

Commit dea9276

Browse files
committed
TASK: partitioned_replace documented in README
1 parent a371849 commit dea9276

File tree

1 file changed

+55
-4
lines changed

1 file changed

+55
-4
lines changed

README.md

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This is NOT a fully featured CI pipeline solution.
1919
<!-- TOC -->
2020
* [Badges](#badges)
2121
* [Components](#components)
22-
* [prunner (this repository)](#prunner--this-repository-)
22+
* [prunner (this repository)](#prunner-this-repository)
2323
* [prunner-ui](#prunner-ui)
2424
* [Flowpack.Prunner](#flowpackprunner)
2525
* [User guide](#user-guide)
@@ -32,7 +32,10 @@ This is NOT a fully featured CI pipeline solution.
3232
* [Limiting concurrency](#limiting-concurrency)
3333
* [The wait list](#the-wait-list)
3434
* [Debounce jobs with a start delay](#debounce-jobs-with-a-start-delay)
35+
* [Partitioned Wait Lists](#partitioned-wait-lists)
3536
* [Disabling fail-fast behavior](#disabling-fail-fast-behavior)
37+
* [Error handling with on_error](#error-handling-with-on_error)
38+
* [Important notes:](#important-notes)
3639
* [Configuring retention period](#configuring-retention-period)
3740
* [Handling of child processes](#handling-of-child-processes)
3841
* [Graceful shutdown](#graceful-shutdown)
@@ -44,11 +47,11 @@ This is NOT a fully featured CI pipeline solution.
4447
* [Development](#development)
4548
* [Requirements](#requirements)
4649
* [Running locally](#running-locally)
47-
* [IDE Setup (IntelliJ/GoLand)](#ide-setup--intellijgoland-)
50+
* [IDE Setup (IntelliJ/GoLand)](#ide-setup-intellijgoland)
4851
* [Building for different operating systems.](#building-for-different-operating-systems)
4952
* [Running Tests](#running-tests)
5053
* [Memory Leak Debugging](#memory-leak-debugging)
51-
* [Generate OpenAPI (Swagger) spec](#generate-openapi--swagger--spec)
54+
* [Generate OpenAPI (Swagger) spec](#generate-openapi-swagger-spec)
5255
* [Releasing](#releasing)
5356
* [Security concept](#security-concept)
5457
* [License](#license)
@@ -222,7 +225,8 @@ pipelines:
222225

223226
To deactivate the queuing altogether, set `queue_limit: 0`.
224227

225-
Now, if the queue is limited, an error occurs when it is full and you try to add a new job.
228+
Now, if the queue is limited (and default `queue_strategy: append` is configured),
229+
an error occurs when it is full and you try to add a new job.
226230

227231
Alternatively, you can also set `queue_strategy: replace` to replace the last job in the
228232
queue by the newly added one:
@@ -257,6 +261,7 @@ in form of a zero or positive decimal value with a time unit ("ms", "s", "m", "h
257261
```yaml
258262
pipelines:
259263
do_something:
264+
# NOTE: to prevent starvation, use queue_limit >= 2x
260265
queue_limit: 1
261266
queue_strategy: replace
262267
concurrency: 1
@@ -265,6 +270,52 @@ pipelines:
265270
tasks: # as usual
266271
```
267272

273+
NOTE: If you use `queue_limit: 1` and `start_delay`, you will run into **starvation** (=the job never starts)
274+
if jobs are submitted quicker than `start_delay`. If you instead use `queue_limit: 2` or higher, you can
275+
avoid this issue: Then, the 1st slot will always be worked on after `start_delay`, while the 2nd slot will
276+
be replaced quickly.
277+
278+
### Partitioned Wait Lists
279+
280+
If you have a multi-tenant application, you might want to use **one wait-list per tenant** (e.g. for import jobs),
281+
combined with global `concurrency` limits (depending on the globally available server resources).
282+
283+
To enable this, do the following:
284+
285+
- `queue_strategy: partitioned_replace`: Enabled partitioned wait list
286+
- `queue_partition_limit: 1` (or higher): Configure the number of wait-list slots per tenant. The last slot gets replaced
287+
when the wait-list is full.
288+
- can be combined with arbitrary `start_delay` and `concurrency` as expected
289+
290+
Full example:
291+
292+
```
293+
pipelines:
294+
do_something:
295+
queue_strategy: partitioned_replace
296+
# prevent starvation
297+
queue_partition_limit: 2
298+
concurrency: 1
299+
# Queues a run of the job and only starts it after 10 seconds have passed (if no other run was triggered which replaced the queued job)
300+
start_delay: 10s
301+
tasks: # as usual
302+
303+
```
304+
305+
Additionally, when submitting a job, you need to specify the `queuePartition` argument:
306+
307+
```
308+
POST /pipelines/schedule
309+
310+
{
311+
"pipeline": "my_pipeline",
312+
"variables": {
313+
...
314+
},
315+
"queuePartition": "tenant_foo"
316+
}
317+
```
318+
268319

269320
### Disabling fail-fast behavior
270321

0 commit comments

Comments
 (0)