-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Queues max worker concurrency (#177)
This PR allows users to control the maximum numbers of tasks, in a queue, a single DBOS Transact instance can execute concurrently. This knob is exposed by the new `worker_concurrency` Queue initialization parameter. This is implemented by modifying the queue DB query to only retrieve uncompleted tasks eligible for this worker and limiting the query to either `worker_concurrency` or `concurrency`, with this priority, if they are set.
- Loading branch information
Showing
7 changed files
with
178 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
dbos/_migrations/versions/04ca4f231047_workflow_queues_executor_id.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""workflow_queues_executor_id | ||
Revision ID: 04ca4f231047 | ||
Revises: d76646551a6c | ||
Create Date: 2025-01-15 15:05:08.043190 | ||
""" | ||
|
||
from typing import Sequence, Union | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "04ca4f231047" | ||
down_revision: Union[str, None] = "d76646551a6c" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.add_column( | ||
"workflow_queue", | ||
sa.Column( | ||
"executor_id", | ||
sa.Text(), | ||
nullable=True, | ||
), | ||
schema="dbos", | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_column("workflow_queue", "executor_id", schema="dbos") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters