summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJahn Thomas Fidje <jtfidje@gmail.com>2022-09-23 03:06:37 +0200
committerGitHub <noreply@github.com>2022-09-23 08:06:37 +0700
commit840438559261fd64b07d1bce489d352e6d553da5 (patch)
treeb5f45d98551301e299fc65ec518c87d420feba53 /docs
parent108c2ea66652737aa54038f7d71477af625b58eb (diff)
downloadrq-840438559261fd64b07d1bce489d352e6d553da5.tar.gz
Add feature to enqueue dependents at the front of queues (#1696)
* Add feature to enqueue dependents at the front of queues * Add documentation for the Dependency(enqueue_at_front=...) parameter * docs: Add `enqueue_at_front` to list of parameters for Dependency * test: Update dependency test to not rely on Redis ordering * refactor: Save enqueue_at_front boolean in job.meta instead of separate instance attr * fix: Made enqueue_at_front an instance attribute instead of putting it inside meta
Diffstat (limited to 'docs')
-rw-r--r--docs/docs/index.md21
1 files changed, 15 insertions, 6 deletions
diff --git a/docs/docs/index.md b/docs/docs/index.md
index 0748846..fb2a68b 100644
--- a/docs/docs/index.md
+++ b/docs/docs/index.md
@@ -167,6 +167,7 @@ The `Dependency(jobs=...)` parameter accepts:
- a string representing a single job id
- a Job object
- an iteratable of job id strings and/or Job objects
+- `enqueue_at_front` boolean parameter to put dependents at the front when they are enqueued
Example:
@@ -177,9 +178,17 @@ from rq import Queue
queue = Queue(connection=Redis())
job_1 = queue.enqueue(div_by_zero)
-dependency = Dependency(jobs=[job_1], allow_failure=True) # allow_failure defaults to False
+dependency = Dependency(
+ jobs=[job_1],
+ allow_failure=True, # allow_failure defaults to False
+ enqueue_at_front=True # enqueue_at_front defaults to False
+)
job_2 = queue.enqueue(say_hello, depends_on=dependency)
-# job_2 will execute even though its dependency (job_1) fails
+
+"""
+ job_2 will execute even though its dependency (job_1) fails,
+ and it will be enqueued at the front of the queue.
+"""
```
@@ -269,10 +278,10 @@ There are two options:
#### Arguments:
-| | plain text | json | [literal-eval](https://docs.python.org/3/library/ast.html#ast.literal_eval) |
-|-|-|-|-|
-| keyword | `[key]=[value]` | `[key]:=[value]` | `[key]%=[value]` |
-| no keyword | `[value]` | `:[value]` | `%[value]` |
+| | plain text | json | [literal-eval](https://docs.python.org/3/library/ast.html#ast.literal_eval) |
+| ---------- | --------------- | ---------------- | --------------------------------------------------------------------------- |
+| keyword | `[key]=[value]` | `[key]:=[value]` | `[key]%=[value]` |
+| no keyword | `[value]` | `:[value]` | `%[value]` |
Where `[key]` is the keyword and `[value]` is the value which is parsed with the corresponding
parsing method.