-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using additional params for MP consumer child process #336
Conversation
Something strange with the Travis tests: I got 2 builds with 1 different job failed per test:
It seems that it's not related with the PR itself. Have you seen that before? I'll try to rebuild it one more time by reopening the PR, but probably there's a need to go deeper in the tests implementation. |
It's fine now, although I don't like these cases with the tests. |
|
||
def _mp_consume(client, group, topic, chunk, queue, start, exit, pause, size): | ||
def _mp_consume(client, group, topic, queue, size, events, consumer_options): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about **consumer_options
and passing them as kwargs?
Again this issue with tests, reopened the PR. |
- Moved the events params to a separate param for consistency - Passing additional params to internal SimpleConsumer worker for multiprocessing high-level consumer. It allows to use non-default consumer settings (fetch_size_bytes, buffer_size, max_buffer_size).
@@ -105,7 +108,8 @@ class MultiProcessConsumer(Consumer): | |||
def __init__(self, client, group, topic, auto_commit=True, | |||
auto_commit_every_n=AUTO_COMMIT_MSG_COUNT, | |||
auto_commit_every_t=AUTO_COMMIT_INTERVAL, | |||
num_procs=1, partitions_per_proc=0): | |||
num_procs=1, partitions_per_proc=0, | |||
simple_consumer_options=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be **simple_consumer_options
to keep kwargs interface simple and consistent. agree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, fixed.
There's another issue that I've encountered: I've seen a stalled MP consumer after It's easy to reproduce, you need a non-void topic, then create
According to multiprocessing docs: There's also a note that |
I also added an exception for However I've just understood that it's not directly related with the PR issue, do you want me to split it to the other PR? Though I assume that some of Travis fails could be related with the issue. |
Ok, it works but doesn't help when the queue is full:
It seems that there's something wrong with event flags, I'll try to solve the puzzle. |
After the problem was localized, it was pretty obvious that the issue is infinite timeout for |
This looks great -- thanks for taking this on! The latest test failures look like they were caused by intermittent failures in starting zookeeper and kafka brokers on travis within the timeouts. That should have nothing to do with python client code (although we need to address those tests separately so they stop flapping). |
Using additional params for MP consumer child process
This PR is a continuation of #248 and #255.
I cleaned the code a little bit and did the following changes:
(it's simpler to work with an events group, plus it reduces params count for
_mp_consume()
.Though it's weakly related with the PR content itself and I can move it to the other PR if you want).SimpleConsumer
consumer.Also I moved
partitions
param toconsumer_options
too, as it's an optional param too (for SimpleConsumer), and should work under the same logic.Any comments are highly appreciated!