You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR allows you to create "partitioned queues."
Partitioned queues let you distribute work across dynamically created
queue partitions. When you enqueue a workflow on a partitioned queue,
you must supply a "queue partition key." Partitioned queues dequeue
workflows and apply flow control limits for individual partitions, not
for the entire queue. Essentially, you can think of each partition as a
"virtual queue" you can create dynamically by just enqueueing a workflow
with a new partition key.
For example, let's say you want to run only once task at once per user.
You can do this with a partitioned queue where the partition key is the
user ID:
```python
queue = Queue("queue", partition_queue=True, concurrency=1)
@DBOS.workflow()
def process_task(task: Task):
...
def on_user_task_submission(user_id: str, task: Task):
with SetEnqueueOptions(queue_partition_key=user_id):
queue.enqueue(process_task, task)
```
0 commit comments