-
Notifications
You must be signed in to change notification settings - Fork 901
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
Add AdminClient.list_groups API #948
Conversation
It looks like @messense hasn't signed our Contributor License Agreement, yet.
You can read and sign our full Contributor License Agreement here. Once you've signed reply with Appreciation of efforts, clabot |
[clabot:check] |
@confluentinc It looks like @messense just signed our Contributor License Agreement. 👍 Always at your service, clabot |
fastavro 1.0 dropped Python 2 support
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.
Great stuff!
:ivar str client_id: Client id | ||
:ivar str client_host: Client hostname | ||
:ivar bytes metadata: Member metadata(binary), format depends on protocol type | ||
:ivar bytes assignment: Member assignment(binary), format depends on protocol type |
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.
Would be great to have APIs to parse metadata
and assignment
.
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.
That'd be great, but could be provided as a separate python utility package, perhaps auto-generated from the AK json protocol specs.
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'm interested in decoding this data... is this work in progress somewhere? Or maybe point me to the spec you're referring to (I couldn't find it with limited googling) and I can take a crack at it.
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.
Found the spec:
https://kafka.apache.org/protocol
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.
@snagafritz What's your solution to decode it? Could you share it out?
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.
def parse_member_assignment(buf):
'''Parse Kafka group assignment'''
import struct
assigns = []
if not buf:
return assigns
index = struct.calcsize('>hi')
_version, assign_len = struct.unpack('>hi', buf[0:index])
for _ in range(assign_len):
size = struct.calcsize('>h')
str_len = struct.unpack('>h', buf[index:index + size])[0]
index += size
topic = buf[index: index + str_len].decode('utf-8')
index += str_len;
size = struct.calcsize('>i')
part_len = struct.unpack('>i', buf[index:index + size])[0]
index += size
parts = []
for _ in range(part_len):
part = struct.unpack('>i', buf[index:index + size])[0]
parts.append(part)
index += size
assigns.append((topic, parts))
return assigns
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.
@messense Very helpful! Thanks
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.
Solid stuff!
I think it would be useful to print the protocol and type in the example.
After that we're good to go
groups = set(group.id for group in a.list_groups(group1)) | ||
assert group1 in groups, "Consumer group {} not found".format(group1) | ||
groups = set(group.id for group in a.list_groups(group2)) | ||
assert group2 in groups, "Consumer group {} not found".format(group2) |
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.
👏
:ivar str client_id: Client id | ||
:ivar str client_host: Client hostname | ||
:ivar bytes metadata: Member metadata(binary), format depends on protocol type | ||
:ivar bytes assignment: Member assignment(binary), format depends on protocol type |
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.
That'd be great, but could be provided as a separate python utility package, perhaps auto-generated from the AK json protocol specs.
@@ -25,7 +25,8 @@ | |||
|
|||
SCHEMA_REGISTRY_REQUIRES = ['requests'] | |||
|
|||
AVRO_REQUIRES = ['fastavro>=0.23.0', | |||
AVRO_REQUIRES = ['fastavro>=0.23.0,<1.0;python_version<"3.0"', |
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.
Thanks for fixing this.
Great work on this, thank you! |
@edenhill Is there a timeline when this change will make to a release? |
We'll release v1.6.0 after the holidays. |
Closes #223
Not sure how to add test cases for this feature.