Explicit Queue Listening (#537)
By default, a process running DBOS dequeues from all declared queues.
Now, you can instead use `DBOS.listen_queues` to explicitly tell a
process running DBOS to only dequeue workflows from a specific set of
queues.
```python
DBOS.listen_queues(
queues: List[Queue]
)
```
For example, you can use this to manage heterogeneous workers, so
workers of type A only dequeue and execute workflows from queue A while
workers of type B only dequeue and execute workflows from queue B. For
example:
```python
cpu_queue = Queue("queue_one")
gpu_queue = Queue("queue_two")
if __name__ == "__main__":
config = ...
worker_type = ... # "cpu' or 'gpu'
DBOS(config=config)
if worker_type = "gpu":
# GPU workers will only dequeue and execute workflows from the GPU queue
DBOS.listen_queues([gpu_queue])
elif worker_type == "cpu":
# CPU workers will only dequeue and execute workflows from the CPU queue
DBOS.listen_queues([cpu_queue])
DBOS.launch()
```
Also add logging of all queues being listened to. P
Peter Kraft committed
a92c38d8e0e1e2f21f67acc21f276d0764f19ad2
Parent: 977f769
Committed by GitHub <noreply@github.com>
on 12/9/2025, 6:43:14 PM