Skip to content

Change Python's InternalQueue to use LinkedBlockingMultiQueue - #1725

Merged
Yicong-Huang merged 41 commits into
masterfrom
yicong-linked-blocking-multi-queue
Nov 29, 2022
Merged

Change Python's InternalQueue to use LinkedBlockingMultiQueue#1725
Yicong-Huang merged 41 commits into
masterfrom
yicong-linked-blocking-multi-queue

Conversation

@Yicong-Huang

@Yicong-Huang Yicong-Huang commented Nov 11, 2022

Copy link
Copy Markdown
Contributor

This PR updates the Python engine's InternalQueue implementation from DoubleBlockingQueue to LinkedBlockingMultiQueue.

Motivation

A major reason for the change is that we need to satisfy a few more requirements:

  1. multiple consumers (including those accessing size of the queue), for CP+DP separation and flow control.
  2. multiple sub-queues, for chaining operator's in-operator tuples.

Implementation

The LinkedBlockingMultiQueue is mimicking from Java's version marianobarrios/linked-blocking-multi-queue (at commit 9209d8), with some modifications:

  1. For locks, since Python does not have an equivalent lockInterruptibly() method, we are using Lock.acquire().
  2. Since we do not need capacities on queues, the capacity-related concept is intentionally not implemented.

@Yicong-Huang
Yicong-Huang requested a review from zuozhiw November 11, 2022 22:35
@Yicong-Huang Yicong-Huang self-assigned this Nov 11, 2022
@Yicong-Huang Yicong-Huang changed the title Change InternalQueue to use LinkedBlockingMultiQueue Change Python's InternalQueue to use LinkedBlockingMultiQueue Nov 11, 2022

@zuozhiw zuozhiw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did a side-by-side comparison with the original java version and this implementation looks very good, left some minor changes,

@Yicong-Huang
Yicong-Huang merged commit 9936958 into master Nov 29, 2022
@Yicong-Huang
Yicong-Huang deleted the yicong-linked-blocking-multi-queue branch November 29, 2022 21:30
yangzhang75 pushed a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
…#1725)

This PR updates the Python engine's `InternalQueue` implementation from `DoubleBlockingQueue` to `LinkedBlockingMultiQueue`.

## Motivation
A major reason for the change is that we need to satisfy a few more requirements:
1. multiple consumers (including those accessing size of the queue), for CP+DP separation and flow control.
2. multiple sub-queues, for chaining operator's in-operator tuples.

## Implementation
The `LinkedBlockingMultiQueue` is mimicking from Java's version [marianobarrios/linked-blocking-multi-queue](https://github.com/marianobarrios/linked-blocking-multi-queue/blob/master/src/main/java/lbmq/LinkedBlockingMultiQueue.java) (at commit [9209d8](marianobarrios/linked-blocking-multi-queue@9209d83)), with some modifications:
1. For locks, since Python does not have an equivalent `lockInterruptibly()` method, we are using `Lock.acquire()`.
2. Since we do not need capacities on queues, the capacity-related concept is intentionally not implemented.
renovate-bot pushed a commit to renovate-bot/apache-_-texera that referenced this pull request Jul 30, 2026
…che#7034)

### What changes were proposed in this PR?

Deletes
`amber/src/main/python/core/util/customized_queue/double_blocking_queue.py`,
which has contained no code since 2022. All 16 remaining lines are the
ASF license header.

| When | What |
| --- | --- |
| 2021-07-23 | `DoubleBlockingQueue` added by apache#1262 |
| 2022-11-29 | apache#1725 switched `InternalQueue` to
`LinkedBlockingMultiQueue` and emptied the class — but left the file
behind |
| 2025-05-03 | apache#3415 stamped an ASF license header onto the now-empty
file |

Nothing imports it. The package barrel `customized_queue/__init__.py`
exports only `LinkedBlockingMultiQueue` and `IQueue`, so no `__init__`
change is needed.

−16 lines, no behaviour change.

### Any related issues, documentation, discussions?

Closes apache#7033

### How was this PR tested?

Existing tests only — there is nothing to add or remove, since the file
has no code and no spec.

From `amber/`:

- `python -m pytest src/test/python/core/util/customized_queue/` — 54
passed.
- `python -m ruff check src/main/python/core/util/customized_queue/` —
all checks passed.
- `python -m ruff format --check
src/main/python/core/util/customized_queue/` — 4 files already
formatted.

Verification that the file is empty and unreferenced, re-runnable by a
reviewer:

```
grep -vc '^\s*#\|^\s*$' amber/src/main/python/core/util/customized_queue/double_blocking_queue.py
grep -rn "double_blocking_queue\|DoubleBlockingQueue" . --include=*.py --include=*.scala --include=*.txt --include=*.toml
```

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants