-
Notifications
You must be signed in to change notification settings - Fork 9
Create admin client #44
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
Conversation
kafka/admin_client.py
Outdated
timeout=timeout, | ||
) | ||
return self._send_request(request) | ||
|
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.
Please check it with flake8. I am pretty sure it will complain about empty lines
kafka/admin_client.py
Outdated
Arguments: | ||
new_topics (list of NewTopic): A list containing new | ||
topics to be created | ||
validate_only (bool): True if we just want to validate the request |
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.
There are no validate_only param for the method
kafka/admin_client.py
Outdated
""" Create topics on the cluster | ||
|
||
Arguments: | ||
new_topics (list of NewTopic): A list containing new |
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.
Please rename it to topics as param.
kafka/admin_client.py
Outdated
topics to be created | ||
validate_only (bool): True if we just want to validate the request | ||
timeout (int): timeout in seconds | ||
max_retry (int): num of times we want to retry to send a create |
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.
There are no max_retry any more.
test/test_admin_client.py
Outdated
)]) | ||
|
||
|
||
class TestTopicAdmin(): |
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.
Can we have a unit test for delete topics?
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.
response = admin.create_topics(topics=[topic], timeout=1) | ||
self.assertTrue( | ||
response[0].topic_error_codes[0][1] == 0 or | ||
response[0].topic_error_codes[0][1] == 7 |
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.
Why is code 7 good? Can we add a comment?
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.
@ecanzonieri 7 is RequestTimedOut but we can safely assume the topic is created or will be created eventually.
for more information see this https://cwiki.apache.org/confluence/display/KAFKA/KIP-4+-+Command+line+and+centralized+administrative+operations
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.
Can we add a comment in the code?
test/test_admin_client.py
Outdated
assert response == topic_response | ||
|
||
|
||
def delete_topics( |
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.
test_
I dont why the other branch showing ' branch upto date' so created this one. Also for the integrations test please look for my comment in the previous branch.