dbos-inc / dbos-transact-py

Ultra-Lightweight Durable Execution in Python
https://docs.dbos.dev
MIT License
244 stars 7 forks source link

Job Queue #106

Closed kraftp closed 1 month ago

kraftp commented 1 month ago

Add a queue abstraction for asynchronous processing.

Example usage:

queue = Queue("example_queue")

@DBOS.step()
def process_job(job):
  ...

@DBOS.workflow()
def process_jobs(jobs):
  for job in jobs:
    queue.enqueue(process_job, job)

You can enqueue any DBOS-annotated function (workflows, transactions, or steps).

enqueue returns a workflow handle so you can track the status of enqueued tasks.

You can set a maximum concurrency level for a queue to cap the maximum number of tasks from that queue that can be processed at once.

Scheduled workflows and Kafka workflows now use queues, making them more robust in a distributed setting.