repo
stringlengths
7
54
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
20
28.4k
docstring
stringlengths
1
46.3k
docstring_tokens
listlengths
1
1.66k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
summary
stringlengths
4
350
obf_code
stringlengths
7.85k
764k
dpkp/kafka-python
kafka/record/default_records.py
DefaultRecordBatchBuilder.estimate_size_in_bytes
def estimate_size_in_bytes(cls, key, value, headers): """ Get the upper bound estimate on the size of record """ return ( cls.HEADER_STRUCT.size + cls.MAX_RECORD_OVERHEAD + cls.size_of(key, value, headers) )
python
def estimate_size_in_bytes(cls, key, value, headers): """ Get the upper bound estimate on the size of record """ return ( cls.HEADER_STRUCT.size + cls.MAX_RECORD_OVERHEAD + cls.size_of(key, value, headers) )
[ "def", "estimate_size_in_bytes", "(", "cls", ",", "key", ",", "value", ",", "headers", ")", ":", "return", "(", "cls", ".", "HEADER_STRUCT", ".", "size", "+", "cls", ".", "MAX_RECORD_OVERHEAD", "+", "cls", ".", "size_of", "(", "key", ",", "value", ",", ...
Get the upper bound estimate on the size of record
[ "Get", "the", "upper", "bound", "estimate", "on", "the", "size", "of", "record" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/record/default_records.py#L575-L581
train
Estimate the size of the record in bytes based on the size of the headers.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/coordinator/heartbeat.py
Heartbeat.time_to_next_heartbeat
def time_to_next_heartbeat(self): """Returns seconds (float) remaining before next heartbeat should be sent""" time_since_last_heartbeat = time.time() - max(self.last_send, self.last_reset) if self.heartbeat_failed: delay_to_next_heartbeat = self.config['retry_backoff_ms'] / 1000 ...
python
def time_to_next_heartbeat(self): """Returns seconds (float) remaining before next heartbeat should be sent""" time_since_last_heartbeat = time.time() - max(self.last_send, self.last_reset) if self.heartbeat_failed: delay_to_next_heartbeat = self.config['retry_backoff_ms'] / 1000 ...
[ "def", "time_to_next_heartbeat", "(", "self", ")", ":", "time_since_last_heartbeat", "=", "time", ".", "time", "(", ")", "-", "max", "(", "self", ".", "last_send", ",", "self", ".", "last_reset", ")", "if", "self", ".", "heartbeat_failed", ":", "delay_to_nex...
Returns seconds (float) remaining before next heartbeat should be sent
[ "Returns", "seconds", "(", "float", ")", "remaining", "before", "next", "heartbeat", "should", "be", "sent" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/coordinator/heartbeat.py#L46-L53
train
Returns seconds remaining before next heartbeat should be sent
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/conn.py
_address_family
def _address_family(address): """ Attempt to determine the family of an address (or hostname) :return: either socket.AF_INET or socket.AF_INET6 or socket.AF_UNSPEC if the address family could not be determined """ if address.startswith('[') and address.endswith(']'): ...
python
def _address_family(address): """ Attempt to determine the family of an address (or hostname) :return: either socket.AF_INET or socket.AF_INET6 or socket.AF_UNSPEC if the address family could not be determined """ if address.startswith('[') and address.endswith(']'): ...
[ "def", "_address_family", "(", "address", ")", ":", "if", "address", ".", "startswith", "(", "'['", ")", "and", "address", ".", "endswith", "(", "']'", ")", ":", "return", "socket", ".", "AF_INET6", "for", "af", "in", "(", "socket", ".", "AF_INET", ","...
Attempt to determine the family of an address (or hostname) :return: either socket.AF_INET or socket.AF_INET6 or socket.AF_UNSPEC if the address family could not be determined
[ "Attempt", "to", "determine", "the", "family", "of", "an", "address", "(", "or", "hostname", ")" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/conn.py#L1256-L1271
train
Determine the family of an address or hostname
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/conn.py
get_ip_port_afi
def get_ip_port_afi(host_and_port_str): """ Parse the IP and port from a string in the format of: * host_or_ip <- Can be either IPv4 address literal or hostname/fqdn * host_or_ipv4:port <- Can be either IPv4 address literal or hostname/fqdn * [host_or_ip] ...
python
def get_ip_port_afi(host_and_port_str): """ Parse the IP and port from a string in the format of: * host_or_ip <- Can be either IPv4 address literal or hostname/fqdn * host_or_ipv4:port <- Can be either IPv4 address literal or hostname/fqdn * [host_or_ip] ...
[ "def", "get_ip_port_afi", "(", "host_and_port_str", ")", ":", "host_and_port_str", "=", "host_and_port_str", ".", "strip", "(", ")", "if", "host_and_port_str", ".", "startswith", "(", "'['", ")", ":", "af", "=", "socket", ".", "AF_INET6", "host", ",", "rest", ...
Parse the IP and port from a string in the format of: * host_or_ip <- Can be either IPv4 address literal or hostname/fqdn * host_or_ipv4:port <- Can be either IPv4 address literal or hostname/fqdn * [host_or_ip] <- IPv6 address literal * [host_or_ip]:po...
[ "Parse", "the", "IP", "and", "port", "from", "a", "string", "in", "the", "format", "of", ":" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/conn.py#L1274-L1320
train
Parse the IP and port from a string.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/conn.py
collect_hosts
def collect_hosts(hosts, randomize=True): """ Collects a comma-separated set of hosts (host:port) and optionally randomize the returned list. """ if isinstance(hosts, six.string_types): hosts = hosts.strip().split(',') result = [] afi = socket.AF_INET for host_port in hosts: ...
python
def collect_hosts(hosts, randomize=True): """ Collects a comma-separated set of hosts (host:port) and optionally randomize the returned list. """ if isinstance(hosts, six.string_types): hosts = hosts.strip().split(',') result = [] afi = socket.AF_INET for host_port in hosts: ...
[ "def", "collect_hosts", "(", "hosts", ",", "randomize", "=", "True", ")", ":", "if", "isinstance", "(", "hosts", ",", "six", ".", "string_types", ")", ":", "hosts", "=", "hosts", ".", "strip", "(", ")", ".", "split", "(", "','", ")", "result", "=", ...
Collects a comma-separated set of hosts (host:port) and optionally randomize the returned list.
[ "Collects", "a", "comma", "-", "separated", "set", "of", "hosts", "(", "host", ":", "port", ")", "and", "optionally", "randomize", "the", "returned", "list", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/conn.py#L1323-L1346
train
Collects a comma - separated set of hosts and optionally randomize the returned list.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/conn.py
dns_lookup
def dns_lookup(host, port, afi=socket.AF_UNSPEC): """Returns a list of getaddrinfo structs, optionally filtered to an afi (ipv4 / ipv6)""" # XXX: all DNS functions in Python are blocking. If we really # want to be non-blocking here, we need to use a 3rd-party # library like python-adns, or move resoluti...
python
def dns_lookup(host, port, afi=socket.AF_UNSPEC): """Returns a list of getaddrinfo structs, optionally filtered to an afi (ipv4 / ipv6)""" # XXX: all DNS functions in Python are blocking. If we really # want to be non-blocking here, we need to use a 3rd-party # library like python-adns, or move resoluti...
[ "def", "dns_lookup", "(", "host", ",", "port", ",", "afi", "=", "socket", ".", "AF_UNSPEC", ")", ":", "# XXX: all DNS functions in Python are blocking. If we really", "# want to be non-blocking here, we need to use a 3rd-party", "# library like python-adns, or move resolution onto it...
Returns a list of getaddrinfo structs, optionally filtered to an afi (ipv4 / ipv6)
[ "Returns", "a", "list", "of", "getaddrinfo", "structs", "optionally", "filtered", "to", "an", "afi", "(", "ipv4", "/", "ipv6", ")" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/conn.py#L1354-L1372
train
Returns a list of getaddrinfo structs optionally filtered to an AFI.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/conn.py
BrokerConnection.connect
def connect(self): """Attempt to connect and return ConnectionState""" if self.state is ConnectionStates.DISCONNECTED and not self.blacked_out(): self.last_attempt = time.time() next_lookup = self._next_afi_sockaddr() if not next_lookup: self.close(Err...
python
def connect(self): """Attempt to connect and return ConnectionState""" if self.state is ConnectionStates.DISCONNECTED and not self.blacked_out(): self.last_attempt = time.time() next_lookup = self._next_afi_sockaddr() if not next_lookup: self.close(Err...
[ "def", "connect", "(", "self", ")", ":", "if", "self", ".", "state", "is", "ConnectionStates", ".", "DISCONNECTED", "and", "not", "self", ".", "blacked_out", "(", ")", ":", "self", ".", "last_attempt", "=", "time", ".", "time", "(", ")", "next_lookup", ...
Attempt to connect and return ConnectionState
[ "Attempt", "to", "connect", "and", "return", "ConnectionState" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/conn.py#L350-L450
train
Attempts to connect and returns ConnectionState
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/conn.py
BrokerConnection._token_extensions
def _token_extensions(self): """ Return a string representation of the OPTIONAL key-value pairs that can be sent with an OAUTHBEARER initial request. """ token_provider = self.config['sasl_oauth_token_provider'] # Only run if the #extensions() method is implemented by th...
python
def _token_extensions(self): """ Return a string representation of the OPTIONAL key-value pairs that can be sent with an OAUTHBEARER initial request. """ token_provider = self.config['sasl_oauth_token_provider'] # Only run if the #extensions() method is implemented by th...
[ "def", "_token_extensions", "(", "self", ")", ":", "token_provider", "=", "self", ".", "config", "[", "'sasl_oauth_token_provider'", "]", "# Only run if the #extensions() method is implemented by the clients Token Provider class", "# Builds up a string separated by \\x01 via a dict of ...
Return a string representation of the OPTIONAL key-value pairs that can be sent with an OAUTHBEARER initial request.
[ "Return", "a", "string", "representation", "of", "the", "OPTIONAL", "key", "-", "value", "pairs", "that", "can", "be", "sent", "with", "an", "OAUTHBEARER", "initial", "request", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/conn.py#L718-L731
train
Returns a string representation of the OPTIONAL key - value pairs that can be sent with an OAUTHBEARER initial request.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/conn.py
BrokerConnection.blacked_out
def blacked_out(self): """ Return true if we are disconnected from the given node and can't re-establish a connection yet """ if self.state is ConnectionStates.DISCONNECTED: if time.time() < self.last_attempt + self._reconnect_backoff: return True ...
python
def blacked_out(self): """ Return true if we are disconnected from the given node and can't re-establish a connection yet """ if self.state is ConnectionStates.DISCONNECTED: if time.time() < self.last_attempt + self._reconnect_backoff: return True ...
[ "def", "blacked_out", "(", "self", ")", ":", "if", "self", ".", "state", "is", "ConnectionStates", ".", "DISCONNECTED", ":", "if", "time", ".", "time", "(", ")", "<", "self", ".", "last_attempt", "+", "self", ".", "_reconnect_backoff", ":", "return", "Tr...
Return true if we are disconnected from the given node and can't re-establish a connection yet
[ "Return", "true", "if", "we", "are", "disconnected", "from", "the", "given", "node", "and", "can", "t", "re", "-", "establish", "a", "connection", "yet" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/conn.py#L733-L741
train
Return True if we are disconnected from the given node and can t re - establish a connection yet.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/conn.py
BrokerConnection.connection_delay
def connection_delay(self): """ Return the number of milliseconds to wait, based on the connection state, before attempting to send data. When disconnected, this respects the reconnect backoff time. When connecting, returns 0 to allow non-blocking connect to finish. When connecte...
python
def connection_delay(self): """ Return the number of milliseconds to wait, based on the connection state, before attempting to send data. When disconnected, this respects the reconnect backoff time. When connecting, returns 0 to allow non-blocking connect to finish. When connecte...
[ "def", "connection_delay", "(", "self", ")", ":", "time_waited", "=", "time", ".", "time", "(", ")", "-", "(", "self", ".", "last_attempt", "or", "0", ")", "if", "self", ".", "state", "is", "ConnectionStates", ".", "DISCONNECTED", ":", "return", "max", ...
Return the number of milliseconds to wait, based on the connection state, before attempting to send data. When disconnected, this respects the reconnect backoff time. When connecting, returns 0 to allow non-blocking connect to finish. When connected, returns a very large number to handle...
[ "Return", "the", "number", "of", "milliseconds", "to", "wait", "based", "on", "the", "connection", "state", "before", "attempting", "to", "send", "data", ".", "When", "disconnected", "this", "respects", "the", "reconnect", "backoff", "time", ".", "When", "conn...
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/conn.py#L743-L757
train
Returns the number of milliseconds to wait for the connection to finish.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/conn.py
BrokerConnection.connecting
def connecting(self): """Returns True if still connecting (this may encompass several different states, such as SSL handshake, authorization, etc).""" return self.state in (ConnectionStates.CONNECTING, ConnectionStates.HANDSHAKE, Connec...
python
def connecting(self): """Returns True if still connecting (this may encompass several different states, such as SSL handshake, authorization, etc).""" return self.state in (ConnectionStates.CONNECTING, ConnectionStates.HANDSHAKE, Connec...
[ "def", "connecting", "(", "self", ")", ":", "return", "self", ".", "state", "in", "(", "ConnectionStates", ".", "CONNECTING", ",", "ConnectionStates", ".", "HANDSHAKE", ",", "ConnectionStates", ".", "AUTHENTICATING", ")" ]
Returns True if still connecting (this may encompass several different states, such as SSL handshake, authorization, etc).
[ "Returns", "True", "if", "still", "connecting", "(", "this", "may", "encompass", "several", "different", "states", "such", "as", "SSL", "handshake", "authorization", "etc", ")", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/conn.py#L763-L768
train
Returns True if the connection is still connecting.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/conn.py
BrokerConnection.close
def close(self, error=None): """Close socket and fail all in-flight-requests. Arguments: error (Exception, optional): pending in-flight-requests will be failed with this exception. Default: kafka.errors.KafkaConnectionError. """ if self.state ...
python
def close(self, error=None): """Close socket and fail all in-flight-requests. Arguments: error (Exception, optional): pending in-flight-requests will be failed with this exception. Default: kafka.errors.KafkaConnectionError. """ if self.state ...
[ "def", "close", "(", "self", ",", "error", "=", "None", ")", ":", "if", "self", ".", "state", "is", "ConnectionStates", ".", "DISCONNECTED", ":", "return", "with", "self", ".", "_lock", ":", "if", "self", ".", "state", "is", "ConnectionStates", ".", "D...
Close socket and fail all in-flight-requests. Arguments: error (Exception, optional): pending in-flight-requests will be failed with this exception. Default: kafka.errors.KafkaConnectionError.
[ "Close", "socket", "and", "fail", "all", "in", "-", "flight", "-", "requests", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/conn.py#L798-L834
train
Closes the connection and fails all pending in - flight requests.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/conn.py
BrokerConnection.send
def send(self, request, blocking=True): """Queue request for async network send, return Future()""" future = Future() if self.connecting(): return future.failure(Errors.NodeNotReadyError(str(self))) elif not self.connected(): return future.failure(Errors.KafkaConn...
python
def send(self, request, blocking=True): """Queue request for async network send, return Future()""" future = Future() if self.connecting(): return future.failure(Errors.NodeNotReadyError(str(self))) elif not self.connected(): return future.failure(Errors.KafkaConn...
[ "def", "send", "(", "self", ",", "request", ",", "blocking", "=", "True", ")", ":", "future", "=", "Future", "(", ")", "if", "self", ".", "connecting", "(", ")", ":", "return", "future", ".", "failure", "(", "Errors", ".", "NodeNotReadyError", "(", "...
Queue request for async network send, return Future()
[ "Queue", "request", "for", "async", "network", "send", "return", "Future", "()" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/conn.py#L841-L850
train
Queue a request for async network send
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/conn.py
BrokerConnection.send_pending_requests
def send_pending_requests(self): """Can block on network if request is larger than send_buffer_bytes""" try: with self._lock: if not self._can_send_recv(): return Errors.NodeNotReadyError(str(self)) # In the future we might manage an intern...
python
def send_pending_requests(self): """Can block on network if request is larger than send_buffer_bytes""" try: with self._lock: if not self._can_send_recv(): return Errors.NodeNotReadyError(str(self)) # In the future we might manage an intern...
[ "def", "send_pending_requests", "(", "self", ")", ":", "try", ":", "with", "self", ".", "_lock", ":", "if", "not", "self", ".", "_can_send_recv", "(", ")", ":", "return", "Errors", ".", "NodeNotReadyError", "(", "str", "(", "self", ")", ")", "# In the fu...
Can block on network if request is larger than send_buffer_bytes
[ "Can", "block", "on", "network", "if", "request", "is", "larger", "than", "send_buffer_bytes" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/conn.py#L875-L893
train
Send pending requests to the broker.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/conn.py
BrokerConnection.recv
def recv(self): """Non-blocking network receive. Return list of (response, future) tuples """ responses = self._recv() if not responses and self.requests_timed_out(): log.warning('%s timed out after %s ms. Closing connection.', self, self.conf...
python
def recv(self): """Non-blocking network receive. Return list of (response, future) tuples """ responses = self._recv() if not responses and self.requests_timed_out(): log.warning('%s timed out after %s ms. Closing connection.', self, self.conf...
[ "def", "recv", "(", "self", ")", ":", "responses", "=", "self", ".", "_recv", "(", ")", "if", "not", "responses", "and", "self", ".", "requests_timed_out", "(", ")", ":", "log", ".", "warning", "(", "'%s timed out after %s ms. Closing connection.'", ",", "se...
Non-blocking network receive. Return list of (response, future) tuples
[ "Non", "-", "blocking", "network", "receive", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/conn.py#L900-L929
train
Non - blocking network receive.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/conn.py
BrokerConnection._recv
def _recv(self): """Take all available bytes from socket, return list of any responses from parser""" recvd = [] self._lock.acquire() if not self._can_send_recv(): log.warning('%s cannot recv: socket not connected', self) self._lock.release() return ()...
python
def _recv(self): """Take all available bytes from socket, return list of any responses from parser""" recvd = [] self._lock.acquire() if not self._can_send_recv(): log.warning('%s cannot recv: socket not connected', self) self._lock.release() return ()...
[ "def", "_recv", "(", "self", ")", ":", "recvd", "=", "[", "]", "self", ".", "_lock", ".", "acquire", "(", ")", "if", "not", "self", ".", "_can_send_recv", "(", ")", ":", "log", ".", "warning", "(", "'%s cannot recv: socket not connected'", ",", "self", ...
Take all available bytes from socket, return list of any responses from parser
[ "Take", "all", "available", "bytes", "from", "socket", "return", "list", "of", "any", "responses", "from", "parser" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/conn.py#L931-L983
train
Take all available bytes from socket return list of any responses from parser
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/conn.py
BrokerConnection.check_version
def check_version(self, timeout=2, strict=False, topics=[]): """Attempt to guess the broker version. Note: This is a blocking call. Returns: version tuple, i.e. (0, 10), (0, 9), (0, 8, 2), ... """ timeout_at = time.time() + timeout log.info('Probing node %s broker versi...
python
def check_version(self, timeout=2, strict=False, topics=[]): """Attempt to guess the broker version. Note: This is a blocking call. Returns: version tuple, i.e. (0, 10), (0, 9), (0, 8, 2), ... """ timeout_at = time.time() + timeout log.info('Probing node %s broker versi...
[ "def", "check_version", "(", "self", ",", "timeout", "=", "2", ",", "strict", "=", "False", ",", "topics", "=", "[", "]", ")", ":", "timeout_at", "=", "time", ".", "time", "(", ")", "+", "timeout", "log", ".", "info", "(", "'Probing node %s broker vers...
Attempt to guess the broker version. Note: This is a blocking call. Returns: version tuple, i.e. (0, 10), (0, 9), (0, 8, 2), ...
[ "Attempt", "to", "guess", "the", "broker", "version", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/conn.py#L1041-L1139
train
Attempt to guess the broker version.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/producer/sender.py
Sender.run
def run(self): """The main run loop for the sender thread.""" log.debug("Starting Kafka producer I/O thread.") # main loop, runs until close is called while self._running: try: self.run_once() except Exception: log.exception("Uncau...
python
def run(self): """The main run loop for the sender thread.""" log.debug("Starting Kafka producer I/O thread.") # main loop, runs until close is called while self._running: try: self.run_once() except Exception: log.exception("Uncau...
[ "def", "run", "(", "self", ")", ":", "log", ".", "debug", "(", "\"Starting Kafka producer I/O thread.\"", ")", "# main loop, runs until close is called", "while", "self", ".", "_running", ":", "try", ":", "self", ".", "run_once", "(", ")", "except", "Exception", ...
The main run loop for the sender thread.
[ "The", "main", "run", "loop", "for", "the", "sender", "thread", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/sender.py#L53-L88
train
The main loop for the sender thread.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/producer/sender.py
Sender.run_once
def run_once(self): """Run a single iteration of sending.""" while self._topics_to_add: self._client.add_topic(self._topics_to_add.pop()) # get the list of partitions with data ready to send result = self._accumulator.ready(self._metadata) ready_nodes, next_ready_che...
python
def run_once(self): """Run a single iteration of sending.""" while self._topics_to_add: self._client.add_topic(self._topics_to_add.pop()) # get the list of partitions with data ready to send result = self._accumulator.ready(self._metadata) ready_nodes, next_ready_che...
[ "def", "run_once", "(", "self", ")", ":", "while", "self", ".", "_topics_to_add", ":", "self", ".", "_client", ".", "add_topic", "(", "self", ".", "_topics_to_add", ".", "pop", "(", ")", ")", "# get the list of partitions with data ready to send", "result", "=",...
Run a single iteration of sending.
[ "Run", "a", "single", "iteration", "of", "sending", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/sender.py#L90-L160
train
Run a single iteration of sending.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/producer/sender.py
Sender.initiate_close
def initiate_close(self): """Start closing the sender (won't complete until all data is sent).""" self._running = False self._accumulator.close() self.wakeup()
python
def initiate_close(self): """Start closing the sender (won't complete until all data is sent).""" self._running = False self._accumulator.close() self.wakeup()
[ "def", "initiate_close", "(", "self", ")", ":", "self", ".", "_running", "=", "False", "self", ".", "_accumulator", ".", "close", "(", ")", "self", ".", "wakeup", "(", ")" ]
Start closing the sender (won't complete until all data is sent).
[ "Start", "closing", "the", "sender", "(", "won", "t", "complete", "until", "all", "data", "is", "sent", ")", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/sender.py#L162-L166
train
Start closing the sender.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/producer/sender.py
Sender._handle_produce_response
def _handle_produce_response(self, node_id, send_time, batches, response): """Handle a produce response.""" # if we have a response, parse it log.debug('Parsing produce response: %r', response) if response: batches_by_partition = dict([(batch.topic_partition, batch) ...
python
def _handle_produce_response(self, node_id, send_time, batches, response): """Handle a produce response.""" # if we have a response, parse it log.debug('Parsing produce response: %r', response) if response: batches_by_partition = dict([(batch.topic_partition, batch) ...
[ "def", "_handle_produce_response", "(", "self", ",", "node_id", ",", "send_time", ",", "batches", ",", "response", ")", ":", "# if we have a response, parse it", "log", ".", "debug", "(", "'Parsing produce response: %r'", ",", "response", ")", "if", "response", ":",...
Handle a produce response.
[ "Handle", "a", "produce", "response", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/sender.py#L188-L214
train
Handle a produce response.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/producer/sender.py
Sender._complete_batch
def _complete_batch(self, batch, error, base_offset, timestamp_ms=None): """Complete or retry the given batch of records. Arguments: batch (RecordBatch): The record batch error (Exception): The error (or None if none) base_offset (int): The base offset assigned to th...
python
def _complete_batch(self, batch, error, base_offset, timestamp_ms=None): """Complete or retry the given batch of records. Arguments: batch (RecordBatch): The record batch error (Exception): The error (or None if none) base_offset (int): The base offset assigned to th...
[ "def", "_complete_batch", "(", "self", ",", "batch", ",", "error", ",", "base_offset", ",", "timestamp_ms", "=", "None", ")", ":", "# Standardize no-error to None", "if", "error", "is", "Errors", ".", "NoError", ":", "error", "=", "None", "if", "error", "is"...
Complete or retry the given batch of records. Arguments: batch (RecordBatch): The record batch error (Exception): The error (or None if none) base_offset (int): The base offset assigned to the records if successful timestamp_ms (int, optional): The timestamp retu...
[ "Complete", "or", "retry", "the", "given", "batch", "of", "records", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/sender.py#L216-L253
train
Complete the given batch of records.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/producer/sender.py
Sender._can_retry
def _can_retry(self, batch, error): """ We can retry a send if the error is transient and the number of attempts taken is fewer than the maximum allowed """ return (batch.attempts < self.config['retries'] and getattr(error, 'retriable', False))
python
def _can_retry(self, batch, error): """ We can retry a send if the error is transient and the number of attempts taken is fewer than the maximum allowed """ return (batch.attempts < self.config['retries'] and getattr(error, 'retriable', False))
[ "def", "_can_retry", "(", "self", ",", "batch", ",", "error", ")", ":", "return", "(", "batch", ".", "attempts", "<", "self", ".", "config", "[", "'retries'", "]", "and", "getattr", "(", "error", ",", "'retriable'", ",", "False", ")", ")" ]
We can retry a send if the error is transient and the number of attempts taken is fewer than the maximum allowed
[ "We", "can", "retry", "a", "send", "if", "the", "error", "is", "transient", "and", "the", "number", "of", "attempts", "taken", "is", "fewer", "than", "the", "maximum", "allowed" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/sender.py#L255-L261
train
Return whether we can retry a send if the error is transient or not.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/producer/sender.py
Sender._create_produce_requests
def _create_produce_requests(self, collated): """ Transfer the record batches into a list of produce requests on a per-node basis. Arguments: collated: {node_id: [RecordBatch]} Returns: dict: {node_id: ProduceRequest} (version depends on api_version) ...
python
def _create_produce_requests(self, collated): """ Transfer the record batches into a list of produce requests on a per-node basis. Arguments: collated: {node_id: [RecordBatch]} Returns: dict: {node_id: ProduceRequest} (version depends on api_version) ...
[ "def", "_create_produce_requests", "(", "self", ",", "collated", ")", ":", "requests", "=", "{", "}", "for", "node_id", ",", "batches", "in", "six", ".", "iteritems", "(", "collated", ")", ":", "requests", "[", "node_id", "]", "=", "self", ".", "_produce...
Transfer the record batches into a list of produce requests on a per-node basis. Arguments: collated: {node_id: [RecordBatch]} Returns: dict: {node_id: ProduceRequest} (version depends on api_version)
[ "Transfer", "the", "record", "batches", "into", "a", "list", "of", "produce", "requests", "on", "a", "per", "-", "node", "basis", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/sender.py#L263-L279
train
Transfer the record batches into a list of produce requests on a node basis.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/producer/sender.py
Sender._produce_request
def _produce_request(self, node_id, acks, timeout, batches): """Create a produce request from the given record batches. Returns: ProduceRequest (version depends on api_version) """ produce_records_by_partition = collections.defaultdict(dict) for batch in batches: ...
python
def _produce_request(self, node_id, acks, timeout, batches): """Create a produce request from the given record batches. Returns: ProduceRequest (version depends on api_version) """ produce_records_by_partition = collections.defaultdict(dict) for batch in batches: ...
[ "def", "_produce_request", "(", "self", ",", "node_id", ",", "acks", ",", "timeout", ",", "batches", ")", ":", "produce_records_by_partition", "=", "collections", ".", "defaultdict", "(", "dict", ")", "for", "batch", "in", "batches", ":", "topic", "=", "batc...
Create a produce request from the given record batches. Returns: ProduceRequest (version depends on api_version)
[ "Create", "a", "produce", "request", "from", "the", "given", "record", "batches", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/sender.py#L281-L312
train
Create a ProduceRequest object from the given record batches.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/codec.py
snappy_encode
def snappy_encode(payload, xerial_compatible=True, xerial_blocksize=32*1024): """Encodes the given data with snappy compression. If xerial_compatible is set then the stream is encoded in a fashion compatible with the xerial snappy library. The block size (xerial_blocksize) controls how frequent the bl...
python
def snappy_encode(payload, xerial_compatible=True, xerial_blocksize=32*1024): """Encodes the given data with snappy compression. If xerial_compatible is set then the stream is encoded in a fashion compatible with the xerial snappy library. The block size (xerial_blocksize) controls how frequent the bl...
[ "def", "snappy_encode", "(", "payload", ",", "xerial_compatible", "=", "True", ",", "xerial_blocksize", "=", "32", "*", "1024", ")", ":", "if", "not", "has_snappy", "(", ")", ":", "raise", "NotImplementedError", "(", "\"Snappy codec is not available\"", ")", "if...
Encodes the given data with snappy compression. If xerial_compatible is set then the stream is encoded in a fashion compatible with the xerial snappy library. The block size (xerial_blocksize) controls how frequent the blocking occurs 32k is the default in the xerial library. The format winds up ...
[ "Encodes", "the", "given", "data", "with", "snappy", "compression", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/codec.py#L100-L160
train
Encodes the given data with snappy compression.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/codec.py
lz4f_decode
def lz4f_decode(payload): """Decode payload using interoperable LZ4 framing. Requires Kafka >= 0.10""" # pylint: disable-msg=no-member ctx = lz4f.createDecompContext() data = lz4f.decompressFrame(payload, ctx) lz4f.freeDecompContext(ctx) # lz4f python module does not expose how much of the payl...
python
def lz4f_decode(payload): """Decode payload using interoperable LZ4 framing. Requires Kafka >= 0.10""" # pylint: disable-msg=no-member ctx = lz4f.createDecompContext() data = lz4f.decompressFrame(payload, ctx) lz4f.freeDecompContext(ctx) # lz4f python module does not expose how much of the payl...
[ "def", "lz4f_decode", "(", "payload", ")", ":", "# pylint: disable-msg=no-member", "ctx", "=", "lz4f", ".", "createDecompContext", "(", ")", "data", "=", "lz4f", ".", "decompressFrame", "(", "payload", ",", "ctx", ")", "lz4f", ".", "freeDecompContext", "(", "c...
Decode payload using interoperable LZ4 framing. Requires Kafka >= 0.10
[ "Decode", "payload", "using", "interoperable", "LZ4", "framing", ".", "Requires", "Kafka", ">", "=", "0", ".", "10" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/codec.py#L226-L237
train
Decode payload using interoperable LZ4 framing. Requires Kafka >= 0. 10
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/codec.py
lz4_encode_old_kafka
def lz4_encode_old_kafka(payload): """Encode payload for 0.8/0.9 brokers -- requires an incorrect header checksum.""" assert xxhash is not None data = lz4_encode(payload) header_size = 7 flg = data[4] if not isinstance(flg, int): flg = ord(flg) content_size_bit = ((flg >> 3) & 1) ...
python
def lz4_encode_old_kafka(payload): """Encode payload for 0.8/0.9 brokers -- requires an incorrect header checksum.""" assert xxhash is not None data = lz4_encode(payload) header_size = 7 flg = data[4] if not isinstance(flg, int): flg = ord(flg) content_size_bit = ((flg >> 3) & 1) ...
[ "def", "lz4_encode_old_kafka", "(", "payload", ")", ":", "assert", "xxhash", "is", "not", "None", "data", "=", "lz4_encode", "(", "payload", ")", "header_size", "=", "7", "flg", "=", "data", "[", "4", "]", "if", "not", "isinstance", "(", "flg", ",", "i...
Encode payload for 0.8/0.9 brokers -- requires an incorrect header checksum.
[ "Encode", "payload", "for", "0", ".", "8", "/", "0", ".", "9", "brokers", "--", "requires", "an", "incorrect", "header", "checksum", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/codec.py#L250-L278
train
Encode payload for 0. 8 / 0. 9 brokers -- requires an incorrect header checksum.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/cluster.py
ClusterMetadata.brokers
def brokers(self): """Get all BrokerMetadata Returns: set: {BrokerMetadata, ...} """ return set(self._brokers.values()) or set(self._bootstrap_brokers.values())
python
def brokers(self): """Get all BrokerMetadata Returns: set: {BrokerMetadata, ...} """ return set(self._brokers.values()) or set(self._bootstrap_brokers.values())
[ "def", "brokers", "(", "self", ")", ":", "return", "set", "(", "self", ".", "_brokers", ".", "values", "(", ")", ")", "or", "set", "(", "self", ".", "_bootstrap_brokers", ".", "values", "(", ")", ")" ]
Get all BrokerMetadata Returns: set: {BrokerMetadata, ...}
[ "Get", "all", "BrokerMetadata" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/cluster.py#L82-L88
train
Get all BrokerMetadata objects in this cluster
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/cluster.py
ClusterMetadata.broker_metadata
def broker_metadata(self, broker_id): """Get BrokerMetadata Arguments: broker_id (int): node_id for a broker to check Returns: BrokerMetadata or None if not found """ return self._brokers.get(broker_id) or self._bootstrap_brokers.get(broker_id)
python
def broker_metadata(self, broker_id): """Get BrokerMetadata Arguments: broker_id (int): node_id for a broker to check Returns: BrokerMetadata or None if not found """ return self._brokers.get(broker_id) or self._bootstrap_brokers.get(broker_id)
[ "def", "broker_metadata", "(", "self", ",", "broker_id", ")", ":", "return", "self", ".", "_brokers", ".", "get", "(", "broker_id", ")", "or", "self", ".", "_bootstrap_brokers", ".", "get", "(", "broker_id", ")" ]
Get BrokerMetadata Arguments: broker_id (int): node_id for a broker to check Returns: BrokerMetadata or None if not found
[ "Get", "BrokerMetadata" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/cluster.py#L90-L99
train
Get the broker metadata for a specific broker
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/cluster.py
ClusterMetadata.partitions_for_topic
def partitions_for_topic(self, topic): """Return set of all partitions for topic (whether available or not) Arguments: topic (str): topic to check for partitions Returns: set: {partition (int), ...} """ if topic not in self._partitions: retur...
python
def partitions_for_topic(self, topic): """Return set of all partitions for topic (whether available or not) Arguments: topic (str): topic to check for partitions Returns: set: {partition (int), ...} """ if topic not in self._partitions: retur...
[ "def", "partitions_for_topic", "(", "self", ",", "topic", ")", ":", "if", "topic", "not", "in", "self", ".", "_partitions", ":", "return", "None", "return", "set", "(", "self", ".", "_partitions", "[", "topic", "]", ".", "keys", "(", ")", ")" ]
Return set of all partitions for topic (whether available or not) Arguments: topic (str): topic to check for partitions Returns: set: {partition (int), ...}
[ "Return", "set", "of", "all", "partitions", "for", "topic", "(", "whether", "available", "or", "not", ")" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/cluster.py#L101-L112
train
Returns set of all partitions for a topic
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/cluster.py
ClusterMetadata.available_partitions_for_topic
def available_partitions_for_topic(self, topic): """Return set of partitions with known leaders Arguments: topic (str): topic to check for partitions Returns: set: {partition (int), ...} None if topic not found. """ if topic not in self._part...
python
def available_partitions_for_topic(self, topic): """Return set of partitions with known leaders Arguments: topic (str): topic to check for partitions Returns: set: {partition (int), ...} None if topic not found. """ if topic not in self._part...
[ "def", "available_partitions_for_topic", "(", "self", ",", "topic", ")", ":", "if", "topic", "not", "in", "self", ".", "_partitions", ":", "return", "None", "return", "set", "(", "[", "partition", "for", "partition", ",", "metadata", "in", "six", ".", "ite...
Return set of partitions with known leaders Arguments: topic (str): topic to check for partitions Returns: set: {partition (int), ...} None if topic not found.
[ "Return", "set", "of", "partitions", "with", "known", "leaders" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/cluster.py#L114-L128
train
Returns set of partitions with known leaders for topic.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/cluster.py
ClusterMetadata.leader_for_partition
def leader_for_partition(self, partition): """Return node_id of leader, -1 unavailable, None if unknown.""" if partition.topic not in self._partitions: return None elif partition.partition not in self._partitions[partition.topic]: return None return self._partitio...
python
def leader_for_partition(self, partition): """Return node_id of leader, -1 unavailable, None if unknown.""" if partition.topic not in self._partitions: return None elif partition.partition not in self._partitions[partition.topic]: return None return self._partitio...
[ "def", "leader_for_partition", "(", "self", ",", "partition", ")", ":", "if", "partition", ".", "topic", "not", "in", "self", ".", "_partitions", ":", "return", "None", "elif", "partition", ".", "partition", "not", "in", "self", ".", "_partitions", "[", "p...
Return node_id of leader, -1 unavailable, None if unknown.
[ "Return", "node_id", "of", "leader", "-", "1", "unavailable", "None", "if", "unknown", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/cluster.py#L130-L136
train
Return node_id of leader for given partition.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/cluster.py
ClusterMetadata.ttl
def ttl(self): """Milliseconds until metadata should be refreshed""" now = time.time() * 1000 if self._need_update: ttl = 0 else: metadata_age = now - self._last_successful_refresh_ms ttl = self.config['metadata_max_age_ms'] - metadata_age ret...
python
def ttl(self): """Milliseconds until metadata should be refreshed""" now = time.time() * 1000 if self._need_update: ttl = 0 else: metadata_age = now - self._last_successful_refresh_ms ttl = self.config['metadata_max_age_ms'] - metadata_age ret...
[ "def", "ttl", "(", "self", ")", ":", "now", "=", "time", ".", "time", "(", ")", "*", "1000", "if", "self", ".", "_need_update", ":", "ttl", "=", "0", "else", ":", "metadata_age", "=", "now", "-", "self", ".", "_last_successful_refresh_ms", "ttl", "="...
Milliseconds until metadata should be refreshed
[ "Milliseconds", "until", "metadata", "should", "be", "refreshed" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/cluster.py#L162-L174
train
Milliseconds until metadata should be refreshed
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/cluster.py
ClusterMetadata.request_update
def request_update(self): """Flags metadata for update, return Future() Actual update must be handled separately. This method will only change the reported ttl() Returns: kafka.future.Future (value will be the cluster object after update) """ with self._lock...
python
def request_update(self): """Flags metadata for update, return Future() Actual update must be handled separately. This method will only change the reported ttl() Returns: kafka.future.Future (value will be the cluster object after update) """ with self._lock...
[ "def", "request_update", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "self", ".", "_need_update", "=", "True", "if", "not", "self", ".", "_future", "or", "self", ".", "_future", ".", "is_done", ":", "self", ".", "_future", "=", "Future", ...
Flags metadata for update, return Future() Actual update must be handled separately. This method will only change the reported ttl() Returns: kafka.future.Future (value will be the cluster object after update)
[ "Flags", "metadata", "for", "update", "return", "Future", "()" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/cluster.py#L180-L193
train
Request metadata for update
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/cluster.py
ClusterMetadata.topics
def topics(self, exclude_internal_topics=True): """Get set of known topics. Arguments: exclude_internal_topics (bool): Whether records from internal topics (such as offsets) should be exposed to the consumer. If set to True the only way to receive records fro...
python
def topics(self, exclude_internal_topics=True): """Get set of known topics. Arguments: exclude_internal_topics (bool): Whether records from internal topics (such as offsets) should be exposed to the consumer. If set to True the only way to receive records fro...
[ "def", "topics", "(", "self", ",", "exclude_internal_topics", "=", "True", ")", ":", "topics", "=", "set", "(", "self", ".", "_partitions", ".", "keys", "(", ")", ")", "if", "exclude_internal_topics", ":", "return", "topics", "-", "self", ".", "internal_to...
Get set of known topics. Arguments: exclude_internal_topics (bool): Whether records from internal topics (such as offsets) should be exposed to the consumer. If set to True the only way to receive records from an internal topic is subscribing to it. D...
[ "Get", "set", "of", "known", "topics", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/cluster.py#L195-L211
train
Get set of known topics.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/cluster.py
ClusterMetadata.failed_update
def failed_update(self, exception): """Update cluster state given a failed MetadataRequest.""" f = None with self._lock: if self._future: f = self._future self._future = None if f: f.failure(exception) self._last_refresh_ms ...
python
def failed_update(self, exception): """Update cluster state given a failed MetadataRequest.""" f = None with self._lock: if self._future: f = self._future self._future = None if f: f.failure(exception) self._last_refresh_ms ...
[ "def", "failed_update", "(", "self", ",", "exception", ")", ":", "f", "=", "None", "with", "self", ".", "_lock", ":", "if", "self", ".", "_future", ":", "f", "=", "self", ".", "_future", "self", ".", "_future", "=", "None", "if", "f", ":", "f", "...
Update cluster state given a failed MetadataRequest.
[ "Update", "cluster", "state", "given", "a", "failed", "MetadataRequest", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/cluster.py#L213-L222
train
Update the state of the cluster with a failed MetadataRequest.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/cluster.py
ClusterMetadata.update_metadata
def update_metadata(self, metadata): """Update cluster state given a MetadataResponse. Arguments: metadata (MetadataResponse): broker response to a metadata request Returns: None """ # In the common case where we ask for a single topic and get back an # erro...
python
def update_metadata(self, metadata): """Update cluster state given a MetadataResponse. Arguments: metadata (MetadataResponse): broker response to a metadata request Returns: None """ # In the common case where we ask for a single topic and get back an # erro...
[ "def", "update_metadata", "(", "self", ",", "metadata", ")", ":", "# In the common case where we ask for a single topic and get back an", "# error, we should fail the future", "if", "len", "(", "metadata", ".", "topics", ")", "==", "1", "and", "metadata", ".", "topics", ...
Update cluster state given a MetadataResponse. Arguments: metadata (MetadataResponse): broker response to a metadata request Returns: None
[ "Update", "cluster", "state", "given", "a", "MetadataResponse", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/cluster.py#L224-L326
train
Update the state of the cluster given a MetadataResponse.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/cluster.py
ClusterMetadata.add_group_coordinator
def add_group_coordinator(self, group, response): """Update with metadata for a group coordinator Arguments: group (str): name of group from GroupCoordinatorRequest response (GroupCoordinatorResponse): broker response Returns: bool: True if metadata is updat...
python
def add_group_coordinator(self, group, response): """Update with metadata for a group coordinator Arguments: group (str): name of group from GroupCoordinatorRequest response (GroupCoordinatorResponse): broker response Returns: bool: True if metadata is updat...
[ "def", "add_group_coordinator", "(", "self", ",", "group", ",", "response", ")", ":", "log", ".", "debug", "(", "\"Updating coordinator for %s: %s\"", ",", "group", ",", "response", ")", "error_type", "=", "Errors", ".", "for_code", "(", "response", ".", "erro...
Update with metadata for a group coordinator Arguments: group (str): name of group from GroupCoordinatorRequest response (GroupCoordinatorResponse): broker response Returns: bool: True if metadata is updated, False on error
[ "Update", "with", "metadata", "for", "a", "group", "coordinator" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/cluster.py#L336-L378
train
Update with metadata for a group coordinator
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/cluster.py
ClusterMetadata.with_partitions
def with_partitions(self, partitions_to_add): """Returns a copy of cluster metadata with partitions added""" new_metadata = ClusterMetadata(**self.config) new_metadata._brokers = copy.deepcopy(self._brokers) new_metadata._partitions = copy.deepcopy(self._partitions) new_metadata....
python
def with_partitions(self, partitions_to_add): """Returns a copy of cluster metadata with partitions added""" new_metadata = ClusterMetadata(**self.config) new_metadata._brokers = copy.deepcopy(self._brokers) new_metadata._partitions = copy.deepcopy(self._partitions) new_metadata....
[ "def", "with_partitions", "(", "self", ",", "partitions_to_add", ")", ":", "new_metadata", "=", "ClusterMetadata", "(", "*", "*", "self", ".", "config", ")", "new_metadata", ".", "_brokers", "=", "copy", ".", "deepcopy", "(", "self", ".", "_brokers", ")", ...
Returns a copy of cluster metadata with partitions added
[ "Returns", "a", "copy", "of", "cluster", "metadata", "with", "partitions", "added" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/cluster.py#L380-L397
train
Returns a copy of this cluster metadata with partitions added
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.assign
def assign(self, partitions): """Manually assign a list of TopicPartitions to this consumer. Arguments: partitions (list of TopicPartition): Assignment for this instance. Raises: IllegalStateError: If consumer has already called :meth:`~kafka.KafkaConsumer.s...
python
def assign(self, partitions): """Manually assign a list of TopicPartitions to this consumer. Arguments: partitions (list of TopicPartition): Assignment for this instance. Raises: IllegalStateError: If consumer has already called :meth:`~kafka.KafkaConsumer.s...
[ "def", "assign", "(", "self", ",", "partitions", ")", ":", "self", ".", "_subscription", ".", "assign_from_user", "(", "partitions", ")", "self", ".", "_client", ".", "set_topics", "(", "[", "tp", ".", "topic", "for", "tp", "in", "partitions", "]", ")" ]
Manually assign a list of TopicPartitions to this consumer. Arguments: partitions (list of TopicPartition): Assignment for this instance. Raises: IllegalStateError: If consumer has already called :meth:`~kafka.KafkaConsumer.subscribe`. Warning: ...
[ "Manually", "assign", "a", "list", "of", "TopicPartitions", "to", "this", "consumer", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L393-L419
train
Manually assign a list of TopicPartitions to this consumer.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.close
def close(self, autocommit=True): """Close the consumer, waiting indefinitely for any needed cleanup. Keyword Arguments: autocommit (bool): If auto-commit is configured for this consumer, this optional flag causes the consumer to attempt to commit any pending...
python
def close(self, autocommit=True): """Close the consumer, waiting indefinitely for any needed cleanup. Keyword Arguments: autocommit (bool): If auto-commit is configured for this consumer, this optional flag causes the consumer to attempt to commit any pending...
[ "def", "close", "(", "self", ",", "autocommit", "=", "True", ")", ":", "if", "self", ".", "_closed", ":", "return", "log", ".", "debug", "(", "\"Closing the KafkaConsumer.\"", ")", "self", ".", "_closed", "=", "True", "self", ".", "_coordinator", ".", "c...
Close the consumer, waiting indefinitely for any needed cleanup. Keyword Arguments: autocommit (bool): If auto-commit is configured for this consumer, this optional flag causes the consumer to attempt to commit any pending consumed offsets prior to close. Default: Tr...
[ "Close", "the", "consumer", "waiting", "indefinitely", "for", "any", "needed", "cleanup", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L437-L460
train
Closes the consumer and all associated resources.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.commit_async
def commit_async(self, offsets=None, callback=None): """Commit offsets to kafka asynchronously, optionally firing callback. This commits offsets only to Kafka. The offsets committed using this API will be used on the first fetch after every rebalance and also on startup. As such, if you...
python
def commit_async(self, offsets=None, callback=None): """Commit offsets to kafka asynchronously, optionally firing callback. This commits offsets only to Kafka. The offsets committed using this API will be used on the first fetch after every rebalance and also on startup. As such, if you...
[ "def", "commit_async", "(", "self", ",", "offsets", "=", "None", ",", "callback", "=", "None", ")", ":", "assert", "self", ".", "config", "[", "'api_version'", "]", ">=", "(", "0", ",", "8", ",", "1", ")", ",", "'Requires >= Kafka 0.8.1'", "assert", "s...
Commit offsets to kafka asynchronously, optionally firing callback. This commits offsets only to Kafka. The offsets committed using this API will be used on the first fetch after every rebalance and also on startup. As such, if you need to store offsets in anything other than Kafka, thi...
[ "Commit", "offsets", "to", "kafka", "asynchronously", "optionally", "firing", "callback", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L462-L494
train
Commits the current consumed offsets to Kafka asynchronously.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.commit
def commit(self, offsets=None): """Commit offsets to kafka, blocking until success or error. This commits offsets only to Kafka. The offsets committed using this API will be used on the first fetch after every rebalance and also on startup. As such, if you need to store offsets in anyth...
python
def commit(self, offsets=None): """Commit offsets to kafka, blocking until success or error. This commits offsets only to Kafka. The offsets committed using this API will be used on the first fetch after every rebalance and also on startup. As such, if you need to store offsets in anyth...
[ "def", "commit", "(", "self", ",", "offsets", "=", "None", ")", ":", "assert", "self", ".", "config", "[", "'api_version'", "]", ">=", "(", "0", ",", "8", ",", "1", ")", ",", "'Requires >= Kafka 0.8.1'", "assert", "self", ".", "config", "[", "'group_id...
Commit offsets to kafka, blocking until success or error. This commits offsets only to Kafka. The offsets committed using this API will be used on the first fetch after every rebalance and also on startup. As such, if you need to store offsets in anything other than Kafka, this API shou...
[ "Commit", "offsets", "to", "kafka", "blocking", "until", "success", "or", "error", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L496-L520
train
Commits the current consumed offsets to Kafka.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.committed
def committed(self, partition): """Get the last committed offset for the given partition. This offset will be used as the position for the consumer in the event of a failure. This call may block to do a remote call if the partition in question isn't assigned to this consumer or...
python
def committed(self, partition): """Get the last committed offset for the given partition. This offset will be used as the position for the consumer in the event of a failure. This call may block to do a remote call if the partition in question isn't assigned to this consumer or...
[ "def", "committed", "(", "self", ",", "partition", ")", ":", "assert", "self", ".", "config", "[", "'api_version'", "]", ">=", "(", "0", ",", "8", ",", "1", ")", ",", "'Requires >= Kafka 0.8.1'", "assert", "self", ".", "config", "[", "'group_id'", "]", ...
Get the last committed offset for the given partition. This offset will be used as the position for the consumer in the event of a failure. This call may block to do a remote call if the partition in question isn't assigned to this consumer or if the consumer hasn't yet initial...
[ "Get", "the", "last", "committed", "offset", "for", "the", "given", "partition", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L522-L553
train
Get the last committed offset for the given partition.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.topics
def topics(self): """Get all topics the user is authorized to view. Returns: set: topics """ cluster = self._client.cluster if self._client._metadata_refresh_in_progress and self._client._topics: future = cluster.request_update() self._client....
python
def topics(self): """Get all topics the user is authorized to view. Returns: set: topics """ cluster = self._client.cluster if self._client._metadata_refresh_in_progress and self._client._topics: future = cluster.request_update() self._client....
[ "def", "topics", "(", "self", ")", ":", "cluster", "=", "self", ".", "_client", ".", "cluster", "if", "self", ".", "_client", ".", "_metadata_refresh_in_progress", "and", "self", ".", "_client", ".", "_topics", ":", "future", "=", "cluster", ".", "request_...
Get all topics the user is authorized to view. Returns: set: topics
[ "Get", "all", "topics", "the", "user", "is", "authorized", "to", "view", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L555-L570
train
Get all topics the user is authorized to view.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.poll
def poll(self, timeout_ms=0, max_records=None): """Fetch data from assigned topics / partitions. Records are fetched and returned in batches by topic-partition. On each poll, consumer will try to use the last consumed offset as the starting offset and fetch sequentially. The last consum...
python
def poll(self, timeout_ms=0, max_records=None): """Fetch data from assigned topics / partitions. Records are fetched and returned in batches by topic-partition. On each poll, consumer will try to use the last consumed offset as the starting offset and fetch sequentially. The last consum...
[ "def", "poll", "(", "self", ",", "timeout_ms", "=", "0", ",", "max_records", "=", "None", ")", ":", "assert", "timeout_ms", ">=", "0", ",", "'Timeout must not be negative'", "if", "max_records", "is", "None", ":", "max_records", "=", "self", ".", "config", ...
Fetch data from assigned topics / partitions. Records are fetched and returned in batches by topic-partition. On each poll, consumer will try to use the last consumed offset as the starting offset and fetch sequentially. The last consumed offset can be manually set through :meth:`~kafka...
[ "Fetch", "data", "from", "assigned", "topics", "/", "partitions", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L583-L625
train
Poll for new data from assigned topics and partitions.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer._poll_once
def _poll_once(self, timeout_ms, max_records): """Do one round of polling. In addition to checking for new data, this does any needed heart-beating, auto-commits, and offset updates. Arguments: timeout_ms (int): The maximum time in milliseconds to block. Returns: ...
python
def _poll_once(self, timeout_ms, max_records): """Do one round of polling. In addition to checking for new data, this does any needed heart-beating, auto-commits, and offset updates. Arguments: timeout_ms (int): The maximum time in milliseconds to block. Returns: ...
[ "def", "_poll_once", "(", "self", ",", "timeout_ms", ",", "max_records", ")", ":", "self", ".", "_coordinator", ".", "poll", "(", ")", "# Fetch positions if we have partitions we're subscribed to that we", "# don't know the offset for", "if", "not", "self", ".", "_subsc...
Do one round of polling. In addition to checking for new data, this does any needed heart-beating, auto-commits, and offset updates. Arguments: timeout_ms (int): The maximum time in milliseconds to block. Returns: dict: Map of topic to list of records (may be empty).
[ "Do", "one", "round", "of", "polling", ".", "In", "addition", "to", "checking", "for", "new", "data", "this", "does", "any", "needed", "heart", "-", "beating", "auto", "-", "commits", "and", "offset", "updates", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L627-L667
train
Do one round of polling.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.position
def position(self, partition): """Get the offset of the next record that will be fetched Arguments: partition (TopicPartition): Partition to check Returns: int: Offset """ if not isinstance(partition, TopicPartition): raise TypeError('partiti...
python
def position(self, partition): """Get the offset of the next record that will be fetched Arguments: partition (TopicPartition): Partition to check Returns: int: Offset """ if not isinstance(partition, TopicPartition): raise TypeError('partiti...
[ "def", "position", "(", "self", ",", "partition", ")", ":", "if", "not", "isinstance", "(", "partition", ",", "TopicPartition", ")", ":", "raise", "TypeError", "(", "'partition must be a TopicPartition namedtuple'", ")", "assert", "self", ".", "_subscription", "."...
Get the offset of the next record that will be fetched Arguments: partition (TopicPartition): Partition to check Returns: int: Offset
[ "Get", "the", "offset", "of", "the", "next", "record", "that", "will", "be", "fetched" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L669-L685
train
Get the offset of the next record that will be fetched by the given partition
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.highwater
def highwater(self, partition): """Last known highwater offset for a partition. A highwater offset is the offset that will be assigned to the next message that is produced. It may be useful for calculating lag, by comparing with the reported position. Note that both position and ...
python
def highwater(self, partition): """Last known highwater offset for a partition. A highwater offset is the offset that will be assigned to the next message that is produced. It may be useful for calculating lag, by comparing with the reported position. Note that both position and ...
[ "def", "highwater", "(", "self", ",", "partition", ")", ":", "if", "not", "isinstance", "(", "partition", ",", "TopicPartition", ")", ":", "raise", "TypeError", "(", "'partition must be a TopicPartition namedtuple'", ")", "assert", "self", ".", "_subscription", "....
Last known highwater offset for a partition. A highwater offset is the offset that will be assigned to the next message that is produced. It may be useful for calculating lag, by comparing with the reported position. Note that both position and highwater refer to the *next* offset -- i....
[ "Last", "known", "highwater", "offset", "for", "a", "partition", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L687-L709
train
Returns the last known highwater offset for a topic partition.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.pause
def pause(self, *partitions): """Suspend fetching from the requested partitions. Future calls to :meth:`~kafka.KafkaConsumer.poll` will not return any records from these partitions until they have been resumed using :meth:`~kafka.KafkaConsumer.resume`. Note: This method does no...
python
def pause(self, *partitions): """Suspend fetching from the requested partitions. Future calls to :meth:`~kafka.KafkaConsumer.poll` will not return any records from these partitions until they have been resumed using :meth:`~kafka.KafkaConsumer.resume`. Note: This method does no...
[ "def", "pause", "(", "self", ",", "*", "partitions", ")", ":", "if", "not", "all", "(", "[", "isinstance", "(", "p", ",", "TopicPartition", ")", "for", "p", "in", "partitions", "]", ")", ":", "raise", "TypeError", "(", "'partitions must be TopicPartition n...
Suspend fetching from the requested partitions. Future calls to :meth:`~kafka.KafkaConsumer.poll` will not return any records from these partitions until they have been resumed using :meth:`~kafka.KafkaConsumer.resume`. Note: This method does not affect partition subscription. In parti...
[ "Suspend", "fetching", "from", "the", "requested", "partitions", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L711-L728
train
Suspend fetching records from the requested partitions.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.seek
def seek(self, partition, offset): """Manually specify the fetch offset for a TopicPartition. Overrides the fetch offsets that the consumer will use on the next :meth:`~kafka.KafkaConsumer.poll`. If this API is invoked for the same partition more than once, the latest offset will be use...
python
def seek(self, partition, offset): """Manually specify the fetch offset for a TopicPartition. Overrides the fetch offsets that the consumer will use on the next :meth:`~kafka.KafkaConsumer.poll`. If this API is invoked for the same partition more than once, the latest offset will be use...
[ "def", "seek", "(", "self", ",", "partition", ",", "offset", ")", ":", "if", "not", "isinstance", "(", "partition", ",", "TopicPartition", ")", ":", "raise", "TypeError", "(", "'partition must be a TopicPartition namedtuple'", ")", "assert", "isinstance", "(", "...
Manually specify the fetch offset for a TopicPartition. Overrides the fetch offsets that the consumer will use on the next :meth:`~kafka.KafkaConsumer.poll`. If this API is invoked for the same partition more than once, the latest offset will be used on the next :meth:`~kafka.KafkaConsu...
[ "Manually", "specify", "the", "fetch", "offset", "for", "a", "TopicPartition", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L751-L775
train
Seek to a specific offset for a topic partition.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.seek_to_beginning
def seek_to_beginning(self, *partitions): """Seek to the oldest available offset for partitions. Arguments: *partitions: Optionally provide specific TopicPartitions, otherwise default to all assigned partitions. Raises: AssertionError: If any partition i...
python
def seek_to_beginning(self, *partitions): """Seek to the oldest available offset for partitions. Arguments: *partitions: Optionally provide specific TopicPartitions, otherwise default to all assigned partitions. Raises: AssertionError: If any partition i...
[ "def", "seek_to_beginning", "(", "self", ",", "*", "partitions", ")", ":", "if", "not", "all", "(", "[", "isinstance", "(", "p", ",", "TopicPartition", ")", "for", "p", "in", "partitions", "]", ")", ":", "raise", "TypeError", "(", "'partitions must be Topi...
Seek to the oldest available offset for partitions. Arguments: *partitions: Optionally provide specific TopicPartitions, otherwise default to all assigned partitions. Raises: AssertionError: If any partition is not currently assigned, or if no pa...
[ "Seek", "to", "the", "oldest", "available", "offset", "for", "partitions", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L777-L799
train
Seek to the oldest available offset for partitions.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.seek_to_end
def seek_to_end(self, *partitions): """Seek to the most recent available offset for partitions. Arguments: *partitions: Optionally provide specific TopicPartitions, otherwise default to all assigned partitions. Raises: AssertionError: If any partition is...
python
def seek_to_end(self, *partitions): """Seek to the most recent available offset for partitions. Arguments: *partitions: Optionally provide specific TopicPartitions, otherwise default to all assigned partitions. Raises: AssertionError: If any partition is...
[ "def", "seek_to_end", "(", "self", ",", "*", "partitions", ")", ":", "if", "not", "all", "(", "[", "isinstance", "(", "p", ",", "TopicPartition", ")", "for", "p", "in", "partitions", "]", ")", ":", "raise", "TypeError", "(", "'partitions must be TopicParti...
Seek to the most recent available offset for partitions. Arguments: *partitions: Optionally provide specific TopicPartitions, otherwise default to all assigned partitions. Raises: AssertionError: If any partition is not currently assigned, or if ...
[ "Seek", "to", "the", "most", "recent", "available", "offset", "for", "partitions", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L801-L823
train
Seek to the most recent available offset for partitions.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.subscribe
def subscribe(self, topics=(), pattern=None, listener=None): """Subscribe to a list of topics, or a topic regex pattern. Partitions will be dynamically assigned via a group coordinator. Topic subscriptions are not incremental: this list will replace the current assignment (if there is o...
python
def subscribe(self, topics=(), pattern=None, listener=None): """Subscribe to a list of topics, or a topic regex pattern. Partitions will be dynamically assigned via a group coordinator. Topic subscriptions are not incremental: this list will replace the current assignment (if there is o...
[ "def", "subscribe", "(", "self", ",", "topics", "=", "(", ")", ",", "pattern", "=", "None", ",", "listener", "=", "None", ")", ":", "# SubscriptionState handles error checking", "self", ".", "_subscription", ".", "subscribe", "(", "topics", "=", "topics", ",...
Subscribe to a list of topics, or a topic regex pattern. Partitions will be dynamically assigned via a group coordinator. Topic subscriptions are not incremental: this list will replace the current assignment (if there is one). This method is incompatible with :meth:`~kafka.KafkaConsum...
[ "Subscribe", "to", "a", "list", "of", "topics", "or", "a", "topic", "regex", "pattern", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L825-L880
train
Subscribe to a list of topics or a regex pattern.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.unsubscribe
def unsubscribe(self): """Unsubscribe from all topics and clear all assigned partitions.""" self._subscription.unsubscribe() self._coordinator.close() self._client.cluster.need_all_topic_metadata = False self._client.set_topics([]) log.debug("Unsubscribed all topics or pa...
python
def unsubscribe(self): """Unsubscribe from all topics and clear all assigned partitions.""" self._subscription.unsubscribe() self._coordinator.close() self._client.cluster.need_all_topic_metadata = False self._client.set_topics([]) log.debug("Unsubscribed all topics or pa...
[ "def", "unsubscribe", "(", "self", ")", ":", "self", ".", "_subscription", ".", "unsubscribe", "(", ")", "self", ".", "_coordinator", ".", "close", "(", ")", "self", ".", "_client", ".", "cluster", ".", "need_all_topic_metadata", "=", "False", "self", ".",...
Unsubscribe from all topics and clear all assigned partitions.
[ "Unsubscribe", "from", "all", "topics", "and", "clear", "all", "assigned", "partitions", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L892-L898
train
Unsubscribe from all topics and clear all assigned partitions.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.offsets_for_times
def offsets_for_times(self, timestamps): """Look up the offsets for the given partitions by timestamp. The returned offset for each partition is the earliest offset whose timestamp is greater than or equal to the given timestamp in the corresponding partition. This is a blocking...
python
def offsets_for_times(self, timestamps): """Look up the offsets for the given partitions by timestamp. The returned offset for each partition is the earliest offset whose timestamp is greater than or equal to the given timestamp in the corresponding partition. This is a blocking...
[ "def", "offsets_for_times", "(", "self", ",", "timestamps", ")", ":", "if", "self", ".", "config", "[", "'api_version'", "]", "<=", "(", "0", ",", "10", ",", "0", ")", ":", "raise", "UnsupportedVersionError", "(", "\"offsets_for_times API not supported for clust...
Look up the offsets for the given partitions by timestamp. The returned offset for each partition is the earliest offset whose timestamp is greater than or equal to the given timestamp in the corresponding partition. This is a blocking call. The consumer does not have to be assigned the...
[ "Look", "up", "the", "offsets", "for", "the", "given", "partitions", "by", "timestamp", ".", "The", "returned", "offset", "for", "each", "partition", "is", "the", "earliest", "offset", "whose", "timestamp", "is", "greater", "than", "or", "equal", "to", "the"...
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L922-L966
train
Look up the offsets for the given timestamps.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.beginning_offsets
def beginning_offsets(self, partitions): """Get the first offset for the given partitions. This method does not change the current consumer position of the partitions. Note: This method may block indefinitely if the partition does not exist. Arguments: ...
python
def beginning_offsets(self, partitions): """Get the first offset for the given partitions. This method does not change the current consumer position of the partitions. Note: This method may block indefinitely if the partition does not exist. Arguments: ...
[ "def", "beginning_offsets", "(", "self", ",", "partitions", ")", ":", "offsets", "=", "self", ".", "_fetcher", ".", "beginning_offsets", "(", "partitions", ",", "self", ".", "config", "[", "'request_timeout_ms'", "]", ")", "return", "offsets" ]
Get the first offset for the given partitions. This method does not change the current consumer position of the partitions. Note: This method may block indefinitely if the partition does not exist. Arguments: partitions (list): List of TopicPartition instances ...
[ "Get", "the", "first", "offset", "for", "the", "given", "partitions", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L968-L992
train
Get the earliest available offsets for the given partitions.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer.end_offsets
def end_offsets(self, partitions): """Get the last offset for the given partitions. The last offset of a partition is the offset of the upcoming message, i.e. the offset of the last available message + 1. This method does not change the current consumer position of the partition...
python
def end_offsets(self, partitions): """Get the last offset for the given partitions. The last offset of a partition is the offset of the upcoming message, i.e. the offset of the last available message + 1. This method does not change the current consumer position of the partition...
[ "def", "end_offsets", "(", "self", ",", "partitions", ")", ":", "offsets", "=", "self", ".", "_fetcher", ".", "end_offsets", "(", "partitions", ",", "self", ".", "config", "[", "'request_timeout_ms'", "]", ")", "return", "offsets" ]
Get the last offset for the given partitions. The last offset of a partition is the offset of the upcoming message, i.e. the offset of the last available message + 1. This method does not change the current consumer position of the partitions. Note: This method may ...
[ "Get", "the", "last", "offset", "for", "the", "given", "partitions", ".", "The", "last", "offset", "of", "a", "partition", "is", "the", "offset", "of", "the", "upcoming", "message", "i", ".", "e", ".", "the", "offset", "of", "the", "last", "available", ...
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L994-L1019
train
Get the last offset for the given partitions.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer._use_consumer_group
def _use_consumer_group(self): """Return True iff this consumer can/should join a broker-coordinated group.""" if self.config['api_version'] < (0, 9): return False elif self.config['group_id'] is None: return False elif not self._subscription.partitions_auto_assig...
python
def _use_consumer_group(self): """Return True iff this consumer can/should join a broker-coordinated group.""" if self.config['api_version'] < (0, 9): return False elif self.config['group_id'] is None: return False elif not self._subscription.partitions_auto_assig...
[ "def", "_use_consumer_group", "(", "self", ")", ":", "if", "self", ".", "config", "[", "'api_version'", "]", "<", "(", "0", ",", "9", ")", ":", "return", "False", "elif", "self", ".", "config", "[", "'group_id'", "]", "is", "None", ":", "return", "Fa...
Return True iff this consumer can/should join a broker-coordinated group.
[ "Return", "True", "iff", "this", "consumer", "can", "/", "should", "join", "a", "broker", "-", "coordinated", "group", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L1021-L1029
train
Return True iff this consumer can join a broker - coordinated group.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/consumer/group.py
KafkaConsumer._update_fetch_positions
def _update_fetch_positions(self, partitions): """Set the fetch position to the committed position (if there is one) or reset it using the offset reset policy the user has configured. Arguments: partitions (List[TopicPartition]): The partitions that need updating fet...
python
def _update_fetch_positions(self, partitions): """Set the fetch position to the committed position (if there is one) or reset it using the offset reset policy the user has configured. Arguments: partitions (List[TopicPartition]): The partitions that need updating fet...
[ "def", "_update_fetch_positions", "(", "self", ",", "partitions", ")", ":", "# Lookup any positions for partitions which are awaiting reset (which may be the", "# case if the user called :meth:`seek_to_beginning` or :meth:`seek_to_end`. We do", "# this check first to avoid an unnecessary lookup ...
Set the fetch position to the committed position (if there is one) or reset it using the offset reset policy the user has configured. Arguments: partitions (List[TopicPartition]): The partitions that need updating fetch positions. Raises: NoOffsetForPart...
[ "Set", "the", "fetch", "position", "to", "the", "committed", "position", "(", "if", "there", "is", "one", ")", "or", "reset", "it", "using", "the", "offset", "reset", "policy", "the", "user", "has", "configured", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/group.py#L1031-L1059
train
Update the fetch positions for the given partitions.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/metrics/dict_reporter.py
DictReporter.snapshot
def snapshot(self): """ Return a nested dictionary snapshot of all metrics and their values at this time. Example: { 'category': { 'metric1_name': 42.0, 'metric2_name': 'foo' } } """ return dict((category, di...
python
def snapshot(self): """ Return a nested dictionary snapshot of all metrics and their values at this time. Example: { 'category': { 'metric1_name': 42.0, 'metric2_name': 'foo' } } """ return dict((category, di...
[ "def", "snapshot", "(", "self", ")", ":", "return", "dict", "(", "(", "category", ",", "dict", "(", "(", "name", ",", "metric", ".", "value", "(", ")", ")", "for", "name", ",", "metric", "in", "list", "(", "metrics", ".", "items", "(", ")", ")", ...
Return a nested dictionary snapshot of all metrics and their values at this time. Example: { 'category': { 'metric1_name': 42.0, 'metric2_name': 'foo' } }
[ "Return", "a", "nested", "dictionary", "snapshot", "of", "all", "metrics", "and", "their", "values", "at", "this", "time", ".", "Example", ":", "{", "category", ":", "{", "metric1_name", ":", "42", ".", "0", "metric2_name", ":", "foo", "}", "}" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/dict_reporter.py#L21-L35
train
Return a nested dictionary snapshot of all metrics and their values at this time.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/metrics/dict_reporter.py
DictReporter.get_category
def get_category(self, metric): """ Return a string category for the metric. The category is made up of this reporter's prefix and the metric's group and tags. Examples: prefix = 'foo', group = 'bar', tags = {'a': 1, 'b': 2} returns: 'foo.bar.a=1,b=2' ...
python
def get_category(self, metric): """ Return a string category for the metric. The category is made up of this reporter's prefix and the metric's group and tags. Examples: prefix = 'foo', group = 'bar', tags = {'a': 1, 'b': 2} returns: 'foo.bar.a=1,b=2' ...
[ "def", "get_category", "(", "self", ",", "metric", ")", ":", "tags", "=", "','", ".", "join", "(", "'%s=%s'", "%", "(", "k", ",", "v", ")", "for", "k", ",", "v", "in", "sorted", "(", "metric", ".", "metric_name", ".", "tags", ".", "items", "(", ...
Return a string category for the metric. The category is made up of this reporter's prefix and the metric's group and tags. Examples: prefix = 'foo', group = 'bar', tags = {'a': 1, 'b': 2} returns: 'foo.bar.a=1,b=2' prefix = 'foo', group = 'bar', tags = Non...
[ "Return", "a", "string", "category", "for", "the", "metric", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/dict_reporter.py#L57-L77
train
Returns a string category for the metric.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client_async.py
KafkaClient.maybe_connect
def maybe_connect(self, node_id, wakeup=True): """Queues a node for asynchronous connection during the next .poll()""" if self._can_connect(node_id): self._connecting.add(node_id) # Wakeup signal is useful in case another thread is # blocked waiting for incoming netwo...
python
def maybe_connect(self, node_id, wakeup=True): """Queues a node for asynchronous connection during the next .poll()""" if self._can_connect(node_id): self._connecting.add(node_id) # Wakeup signal is useful in case another thread is # blocked waiting for incoming netwo...
[ "def", "maybe_connect", "(", "self", ",", "node_id", ",", "wakeup", "=", "True", ")", ":", "if", "self", ".", "_can_connect", "(", "node_id", ")", ":", "self", ".", "_connecting", ".", "add", "(", "node_id", ")", "# Wakeup signal is useful in case another thre...
Queues a node for asynchronous connection during the next .poll()
[ "Queues", "a", "node", "for", "asynchronous", "connection", "during", "the", "next", ".", "poll", "()" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client_async.py#L329-L339
train
Checks if a node is ready to be connected to the broker.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client_async.py
KafkaClient._maybe_connect
def _maybe_connect(self, node_id): """Idempotent non-blocking connection attempt to the given node id.""" with self._lock: conn = self._conns.get(node_id) if conn is None: broker = self.cluster.broker_metadata(node_id) assert broker, 'Broker id %s...
python
def _maybe_connect(self, node_id): """Idempotent non-blocking connection attempt to the given node id.""" with self._lock: conn = self._conns.get(node_id) if conn is None: broker = self.cluster.broker_metadata(node_id) assert broker, 'Broker id %s...
[ "def", "_maybe_connect", "(", "self", ",", "node_id", ")", ":", "with", "self", ".", "_lock", ":", "conn", "=", "self", ".", "_conns", ".", "get", "(", "node_id", ")", "if", "conn", "is", "None", ":", "broker", "=", "self", ".", "cluster", ".", "br...
Idempotent non-blocking connection attempt to the given node id.
[ "Idempotent", "non", "-", "blocking", "connection", "attempt", "to", "the", "given", "node", "id", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client_async.py#L360-L388
train
Idempotent non - blocking connection attempt to the given node id.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client_async.py
KafkaClient.ready
def ready(self, node_id, metadata_priority=True): """Check whether a node is connected and ok to send more requests. Arguments: node_id (int): the id of the node to check metadata_priority (bool): Mark node as not-ready if a metadata refresh is required. Default:...
python
def ready(self, node_id, metadata_priority=True): """Check whether a node is connected and ok to send more requests. Arguments: node_id (int): the id of the node to check metadata_priority (bool): Mark node as not-ready if a metadata refresh is required. Default:...
[ "def", "ready", "(", "self", ",", "node_id", ",", "metadata_priority", "=", "True", ")", ":", "self", ".", "maybe_connect", "(", "node_id", ")", "return", "self", ".", "is_ready", "(", "node_id", ",", "metadata_priority", "=", "metadata_priority", ")" ]
Check whether a node is connected and ok to send more requests. Arguments: node_id (int): the id of the node to check metadata_priority (bool): Mark node as not-ready if a metadata refresh is required. Default: True Returns: bool: True if we are read...
[ "Check", "whether", "a", "node", "is", "connected", "and", "ok", "to", "send", "more", "requests", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client_async.py#L390-L402
train
Check whether a node is ready to send more requests.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client_async.py
KafkaClient.connected
def connected(self, node_id): """Return True iff the node_id is connected.""" conn = self._conns.get(node_id) if conn is None: return False return conn.connected()
python
def connected(self, node_id): """Return True iff the node_id is connected.""" conn = self._conns.get(node_id) if conn is None: return False return conn.connected()
[ "def", "connected", "(", "self", ",", "node_id", ")", ":", "conn", "=", "self", ".", "_conns", ".", "get", "(", "node_id", ")", "if", "conn", "is", "None", ":", "return", "False", "return", "conn", ".", "connected", "(", ")" ]
Return True iff the node_id is connected.
[ "Return", "True", "iff", "the", "node_id", "is", "connected", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client_async.py#L404-L409
train
Return True iff the node_id is connected.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client_async.py
KafkaClient.close
def close(self, node_id=None): """Close one or all broker connections. Arguments: node_id (int, optional): the id of the node to close """ with self._lock: if node_id is None: self._close() conns = list(self._conns.values()) ...
python
def close(self, node_id=None): """Close one or all broker connections. Arguments: node_id (int, optional): the id of the node to close """ with self._lock: if node_id is None: self._close() conns = list(self._conns.values()) ...
[ "def", "close", "(", "self", ",", "node_id", "=", "None", ")", ":", "with", "self", ".", "_lock", ":", "if", "node_id", "is", "None", ":", "self", ".", "_close", "(", ")", "conns", "=", "list", "(", "self", ".", "_conns", ".", "values", "(", ")",...
Close one or all broker connections. Arguments: node_id (int, optional): the id of the node to close
[ "Close", "one", "or", "all", "broker", "connections", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client_async.py#L418-L435
train
Closes one or all broker connections.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client_async.py
KafkaClient.is_disconnected
def is_disconnected(self, node_id): """Check whether the node connection has been disconnected or failed. A disconnected node has either been closed or has failed. Connection failures are usually transient and can be resumed in the next ready() call, but there are cases where transient ...
python
def is_disconnected(self, node_id): """Check whether the node connection has been disconnected or failed. A disconnected node has either been closed or has failed. Connection failures are usually transient and can be resumed in the next ready() call, but there are cases where transient ...
[ "def", "is_disconnected", "(", "self", ",", "node_id", ")", ":", "conn", "=", "self", ".", "_conns", ".", "get", "(", "node_id", ")", "if", "conn", "is", "None", ":", "return", "False", "return", "conn", ".", "disconnected", "(", ")" ]
Check whether the node connection has been disconnected or failed. A disconnected node has either been closed or has failed. Connection failures are usually transient and can be resumed in the next ready() call, but there are cases where transient failures need to be caught and re-acted...
[ "Check", "whether", "the", "node", "connection", "has", "been", "disconnected", "or", "failed", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client_async.py#L440-L457
train
Checks whether the node connection has been disconnected or failed.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client_async.py
KafkaClient.connection_delay
def connection_delay(self, node_id): """ Return the number of milliseconds to wait, based on the connection state, before attempting to send data. When disconnected, this respects the reconnect backoff time. When connecting, returns 0 to allow non-blocking connect to finish. When...
python
def connection_delay(self, node_id): """ Return the number of milliseconds to wait, based on the connection state, before attempting to send data. When disconnected, this respects the reconnect backoff time. When connecting, returns 0 to allow non-blocking connect to finish. When...
[ "def", "connection_delay", "(", "self", ",", "node_id", ")", ":", "conn", "=", "self", ".", "_conns", ".", "get", "(", "node_id", ")", "if", "conn", "is", "None", ":", "return", "0", "return", "conn", ".", "connection_delay", "(", ")" ]
Return the number of milliseconds to wait, based on the connection state, before attempting to send data. When disconnected, this respects the reconnect backoff time. When connecting, returns 0 to allow non-blocking connect to finish. When connected, returns a very large number to handle...
[ "Return", "the", "number", "of", "milliseconds", "to", "wait", "based", "on", "the", "connection", "state", "before", "attempting", "to", "send", "data", ".", "When", "disconnected", "this", "respects", "the", "reconnect", "backoff", "time", ".", "When", "conn...
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client_async.py#L459-L476
train
Returns the number of milliseconds to wait for the connection to finish.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client_async.py
KafkaClient.is_ready
def is_ready(self, node_id, metadata_priority=True): """Check whether a node is ready to send more requests. In addition to connection-level checks, this method also is used to block additional requests from being sent during a metadata refresh. Arguments: node_id (int): id...
python
def is_ready(self, node_id, metadata_priority=True): """Check whether a node is ready to send more requests. In addition to connection-level checks, this method also is used to block additional requests from being sent during a metadata refresh. Arguments: node_id (int): id...
[ "def", "is_ready", "(", "self", ",", "node_id", ",", "metadata_priority", "=", "True", ")", ":", "if", "not", "self", ".", "_can_send_request", "(", "node_id", ")", ":", "return", "False", "# if we need to update our metadata now declare all requests unready to", "# m...
Check whether a node is ready to send more requests. In addition to connection-level checks, this method also is used to block additional requests from being sent during a metadata refresh. Arguments: node_id (int): id of the node to check metadata_priority (bool): Mark...
[ "Check", "whether", "a", "node", "is", "ready", "to", "send", "more", "requests", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client_async.py#L478-L502
train
Check whether a node is ready to send more requests.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client_async.py
KafkaClient.send
def send(self, node_id, request, wakeup=True): """Send a request to a specific node. Bytes are placed on an internal per-connection send-queue. Actual network I/O will be triggered in a subsequent call to .poll() Arguments: node_id (int): destination node request...
python
def send(self, node_id, request, wakeup=True): """Send a request to a specific node. Bytes are placed on an internal per-connection send-queue. Actual network I/O will be triggered in a subsequent call to .poll() Arguments: node_id (int): destination node request...
[ "def", "send", "(", "self", ",", "node_id", ",", "request", ",", "wakeup", "=", "True", ")", ":", "conn", "=", "self", ".", "_conns", ".", "get", "(", "node_id", ")", "if", "not", "conn", "or", "not", "self", ".", "_can_send_request", "(", "node_id",...
Send a request to a specific node. Bytes are placed on an internal per-connection send-queue. Actual network I/O will be triggered in a subsequent call to .poll() Arguments: node_id (int): destination node request (Struct): request object (not-encoded) wakeup...
[ "Send", "a", "request", "to", "a", "specific", "node", ".", "Bytes", "are", "placed", "on", "an", "internal", "per", "-", "connection", "send", "-", "queue", ".", "Actual", "network", "I", "/", "O", "will", "be", "triggered", "in", "a", "subsequent", "...
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client_async.py#L510-L542
train
Send a request to a specific node.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client_async.py
KafkaClient.poll
def poll(self, timeout_ms=None, future=None): """Try to read and write to sockets. This method will also attempt to complete node connections, refresh stale metadata, and run previously-scheduled tasks. Arguments: timeout_ms (int, optional): maximum amount of time to wait (...
python
def poll(self, timeout_ms=None, future=None): """Try to read and write to sockets. This method will also attempt to complete node connections, refresh stale metadata, and run previously-scheduled tasks. Arguments: timeout_ms (int, optional): maximum amount of time to wait (...
[ "def", "poll", "(", "self", ",", "timeout_ms", "=", "None", ",", "future", "=", "None", ")", ":", "if", "future", "is", "not", "None", ":", "timeout_ms", "=", "100", "elif", "timeout_ms", "is", "None", ":", "timeout_ms", "=", "self", ".", "config", "...
Try to read and write to sockets. This method will also attempt to complete node connections, refresh stale metadata, and run previously-scheduled tasks. Arguments: timeout_ms (int, optional): maximum amount of time to wait (in ms) for at least one response. Must be...
[ "Try", "to", "read", "and", "write", "to", "sockets", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client_async.py#L544-L602
train
Try to read and write to sockets.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client_async.py
KafkaClient.in_flight_request_count
def in_flight_request_count(self, node_id=None): """Get the number of in-flight requests for a node or all nodes. Arguments: node_id (int, optional): a specific node to check. If unspecified, return the total for all nodes Returns: int: pending in-flight...
python
def in_flight_request_count(self, node_id=None): """Get the number of in-flight requests for a node or all nodes. Arguments: node_id (int, optional): a specific node to check. If unspecified, return the total for all nodes Returns: int: pending in-flight...
[ "def", "in_flight_request_count", "(", "self", ",", "node_id", "=", "None", ")", ":", "if", "node_id", "is", "not", "None", ":", "conn", "=", "self", ".", "_conns", ".", "get", "(", "node_id", ")", "if", "conn", "is", "None", ":", "return", "0", "ret...
Get the number of in-flight requests for a node or all nodes. Arguments: node_id (int, optional): a specific node to check. If unspecified, return the total for all nodes Returns: int: pending in-flight requests for the node, or all nodes if None
[ "Get", "the", "number", "of", "in", "-", "flight", "requests", "for", "a", "node", "or", "all", "nodes", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client_async.py#L671-L688
train
Get the number of in - flight requests for a specific node or all nodes.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client_async.py
KafkaClient.least_loaded_node
def least_loaded_node(self): """Choose the node with fewest outstanding requests, with fallbacks. This method will prefer a node with an existing connection and no in-flight-requests. If no such node is found, a node will be chosen randomly from disconnected nodes that are not "blacked ...
python
def least_loaded_node(self): """Choose the node with fewest outstanding requests, with fallbacks. This method will prefer a node with an existing connection and no in-flight-requests. If no such node is found, a node will be chosen randomly from disconnected nodes that are not "blacked ...
[ "def", "least_loaded_node", "(", "self", ")", ":", "nodes", "=", "[", "broker", ".", "nodeId", "for", "broker", "in", "self", ".", "cluster", ".", "brokers", "(", ")", "]", "random", ".", "shuffle", "(", "nodes", ")", "inflight", "=", "float", "(", "...
Choose the node with fewest outstanding requests, with fallbacks. This method will prefer a node with an existing connection and no in-flight-requests. If no such node is found, a node will be chosen randomly from disconnected nodes that are not "blacked out" (i.e., are not subject to a...
[ "Choose", "the", "node", "with", "fewest", "outstanding", "requests", "with", "fallbacks", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client_async.py#L704-L738
train
Choose the least loaded node with few outstanding requests with fallbacks.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client_async.py
KafkaClient.set_topics
def set_topics(self, topics): """Set specific topics to track for metadata. Arguments: topics (list of str): topics to check for metadata Returns: Future: resolves after metadata request/response """ if set(topics).difference(self._topics): f...
python
def set_topics(self, topics): """Set specific topics to track for metadata. Arguments: topics (list of str): topics to check for metadata Returns: Future: resolves after metadata request/response """ if set(topics).difference(self._topics): f...
[ "def", "set_topics", "(", "self", ",", "topics", ")", ":", "if", "set", "(", "topics", ")", ".", "difference", "(", "self", ".", "_topics", ")", ":", "future", "=", "self", ".", "cluster", ".", "request_update", "(", ")", "else", ":", "future", "=", ...
Set specific topics to track for metadata. Arguments: topics (list of str): topics to check for metadata Returns: Future: resolves after metadata request/response
[ "Set", "specific", "topics", "to", "track", "for", "metadata", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client_async.py#L740-L754
train
Set specific topics to track for metadata.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client_async.py
KafkaClient.add_topic
def add_topic(self, topic): """Add a topic to the list of topics tracked via metadata. Arguments: topic (str): topic to track Returns: Future: resolves after metadata request/response """ if topic in self._topics: return Future().success(set(...
python
def add_topic(self, topic): """Add a topic to the list of topics tracked via metadata. Arguments: topic (str): topic to track Returns: Future: resolves after metadata request/response """ if topic in self._topics: return Future().success(set(...
[ "def", "add_topic", "(", "self", ",", "topic", ")", ":", "if", "topic", "in", "self", ".", "_topics", ":", "return", "Future", "(", ")", ".", "success", "(", "set", "(", "self", ".", "_topics", ")", ")", "self", ".", "_topics", ".", "add", "(", "...
Add a topic to the list of topics tracked via metadata. Arguments: topic (str): topic to track Returns: Future: resolves after metadata request/response
[ "Add", "a", "topic", "to", "the", "list", "of", "topics", "tracked", "via", "metadata", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client_async.py#L756-L769
train
Add a topic to the list of topics tracked via metadata.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client_async.py
KafkaClient._maybe_refresh_metadata
def _maybe_refresh_metadata(self, wakeup=False): """Send a metadata request if needed. Returns: int: milliseconds until next refresh """ ttl = self.cluster.ttl() wait_for_in_progress_ms = self.config['request_timeout_ms'] if self._metadata_refresh_in_progress else 0 ...
python
def _maybe_refresh_metadata(self, wakeup=False): """Send a metadata request if needed. Returns: int: milliseconds until next refresh """ ttl = self.cluster.ttl() wait_for_in_progress_ms = self.config['request_timeout_ms'] if self._metadata_refresh_in_progress else 0 ...
[ "def", "_maybe_refresh_metadata", "(", "self", ",", "wakeup", "=", "False", ")", ":", "ttl", "=", "self", ".", "cluster", ".", "ttl", "(", ")", "wait_for_in_progress_ms", "=", "self", ".", "config", "[", "'request_timeout_ms'", "]", "if", "self", ".", "_me...
Send a metadata request if needed. Returns: int: milliseconds until next refresh
[ "Send", "a", "metadata", "request", "if", "needed", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client_async.py#L772-L827
train
Send a metadata request if needed.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client_async.py
KafkaClient.check_version
def check_version(self, node_id=None, timeout=2, strict=False): """Attempt to guess the version of a Kafka broker. Note: It is possible that this method blocks longer than the specified timeout. This can happen if the entire cluster is down and the client enters a bootstrap back...
python
def check_version(self, node_id=None, timeout=2, strict=False): """Attempt to guess the version of a Kafka broker. Note: It is possible that this method blocks longer than the specified timeout. This can happen if the entire cluster is down and the client enters a bootstrap back...
[ "def", "check_version", "(", "self", ",", "node_id", "=", "None", ",", "timeout", "=", "2", ",", "strict", "=", "False", ")", ":", "self", ".", "_lock", ".", "acquire", "(", ")", "end", "=", "time", ".", "time", "(", ")", "+", "timeout", "while", ...
Attempt to guess the version of a Kafka broker. Note: It is possible that this method blocks longer than the specified timeout. This can happen if the entire cluster is down and the client enters a bootstrap backoff sleep. This is only possible if node_id is None. R...
[ "Attempt", "to", "guess", "the", "version", "of", "a", "Kafka", "broker", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client_async.py#L840-L892
train
Attempt to guess the version of a Kafka broker.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/metrics/stats/rate.py
Rate.window_size
def window_size(self, config, now): # purge old samples before we compute the window size self._stat.purge_obsolete_samples(config, now) """ Here we check the total amount of time elapsed since the oldest non-obsolete window. This give the total window_size of the batch ...
python
def window_size(self, config, now): # purge old samples before we compute the window size self._stat.purge_obsolete_samples(config, now) """ Here we check the total amount of time elapsed since the oldest non-obsolete window. This give the total window_size of the batch ...
[ "def", "window_size", "(", "self", ",", "config", ",", "now", ")", ":", "# purge old samples before we compute the window size", "self", ".", "_stat", ".", "purge_obsolete_samples", "(", "config", ",", "now", ")", "total_elapsed_time_ms", "=", "now", "-", "self", ...
Here we check the total amount of time elapsed since the oldest non-obsolete window. This give the total window_size of the batch which is the time used for Rate computation. However, there is an issue if we do not have sufficient data for e.g. if only 1 second has elapsed in a 30 second...
[ "Here", "we", "check", "the", "total", "amount", "of", "time", "elapsed", "since", "the", "oldest", "non", "-", "obsolete", "window", ".", "This", "give", "the", "total", "window_size", "of", "the", "batch", "which", "is", "the", "time", "used", "for", "...
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/stats/rate.py#L54-L86
train
Compute the total size of the batch record for this time window.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/producer/base.py
Producer.send_messages
def send_messages(self, topic, partition, *msg): """Helper method to send produce requests. Note that msg type *must* be encoded to bytes by user. Passing unicode message will not work, for example you should encode before calling send_messages via something like `unicode_message.encode...
python
def send_messages(self, topic, partition, *msg): """Helper method to send produce requests. Note that msg type *must* be encoded to bytes by user. Passing unicode message will not work, for example you should encode before calling send_messages via something like `unicode_message.encode...
[ "def", "send_messages", "(", "self", ",", "topic", ",", "partition", ",", "*", "msg", ")", ":", "return", "self", ".", "_send_messages", "(", "topic", ",", "partition", ",", "*", "msg", ")" ]
Helper method to send produce requests. Note that msg type *must* be encoded to bytes by user. Passing unicode message will not work, for example you should encode before calling send_messages via something like `unicode_message.encode('utf-8')` All messages will set the message 'key' t...
[ "Helper", "method", "to", "send", "produce", "requests", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/base.py#L356-L387
train
This method sends a message to the broker.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/producer/base.py
Producer.stop
def stop(self, timeout=None): """ Stop the producer (async mode). Blocks until async thread completes. """ if timeout is not None: log.warning('timeout argument to stop() is deprecated - ' 'it will be removed in future release') if not self.as...
python
def stop(self, timeout=None): """ Stop the producer (async mode). Blocks until async thread completes. """ if timeout is not None: log.warning('timeout argument to stop() is deprecated - ' 'it will be removed in future release') if not self.as...
[ "def", "stop", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "timeout", "is", "not", "None", ":", "log", ".", "warning", "(", "'timeout argument to stop() is deprecated - '", "'it will be removed in future release'", ")", "if", "not", "self", ".", "a...
Stop the producer (async mode). Blocks until async thread completes.
[ "Stop", "the", "producer", "(", "async", "mode", ")", ".", "Blocks", "until", "async", "thread", "completes", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/base.py#L437-L478
train
Stop the producer.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/record/legacy_records.py
LegacyRecordBatchBuilder.append
def append(self, offset, timestamp, key, value, headers=None): """ Append message to batch. """ assert not headers, "Headers not supported in v0/v1" # Check types if type(offset) != int: raise TypeError(offset) if self._magic == 0: timestamp = self...
python
def append(self, offset, timestamp, key, value, headers=None): """ Append message to batch. """ assert not headers, "Headers not supported in v0/v1" # Check types if type(offset) != int: raise TypeError(offset) if self._magic == 0: timestamp = self...
[ "def", "append", "(", "self", ",", "offset", ",", "timestamp", ",", "key", ",", "value", ",", "headers", "=", "None", ")", ":", "assert", "not", "headers", ",", "\"Headers not supported in v0/v1\"", "# Check types", "if", "type", "(", "offset", ")", "!=", ...
Append message to batch.
[ "Append", "message", "to", "batch", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/record/legacy_records.py#L345-L382
train
Append a new record to the batch.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/record/legacy_records.py
LegacyRecordBatchBuilder._encode_msg
def _encode_msg(self, start_pos, offset, timestamp, key, value, attributes=0): """ Encode msg data into the `msg_buffer`, which should be allocated to at least the size of this message. """ magic = self._magic buf = self._buffer pos = start_pos ...
python
def _encode_msg(self, start_pos, offset, timestamp, key, value, attributes=0): """ Encode msg data into the `msg_buffer`, which should be allocated to at least the size of this message. """ magic = self._magic buf = self._buffer pos = start_pos ...
[ "def", "_encode_msg", "(", "self", ",", "start_pos", ",", "offset", ",", "timestamp", ",", "key", ",", "value", ",", "attributes", "=", "0", ")", ":", "magic", "=", "self", ".", "_magic", "buf", "=", "self", ".", "_buffer", "pos", "=", "start_pos", "...
Encode msg data into the `msg_buffer`, which should be allocated to at least the size of this message.
[ "Encode", "msg", "data", "into", "the", "msg_buffer", "which", "should", "be", "allocated", "to", "at", "least", "the", "size", "of", "this", "message", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/record/legacy_records.py#L384-L431
train
Encode the message into the msg_buffer.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/record/legacy_records.py
LegacyRecordBatchBuilder.size_in_bytes
def size_in_bytes(self, offset, timestamp, key, value, headers=None): """ Actual size of message to add """ assert not headers, "Headers not supported in v0/v1" magic = self._magic return self.LOG_OVERHEAD + self.record_size(magic, key, value)
python
def size_in_bytes(self, offset, timestamp, key, value, headers=None): """ Actual size of message to add """ assert not headers, "Headers not supported in v0/v1" magic = self._magic return self.LOG_OVERHEAD + self.record_size(magic, key, value)
[ "def", "size_in_bytes", "(", "self", ",", "offset", ",", "timestamp", ",", "key", ",", "value", ",", "headers", "=", "None", ")", ":", "assert", "not", "headers", ",", "\"Headers not supported in v0/v1\"", "magic", "=", "self", ".", "_magic", "return", "self...
Actual size of message to add
[ "Actual", "size", "of", "message", "to", "add" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/record/legacy_records.py#L472-L477
train
Return the size of the record in bytes.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/record/legacy_records.py
LegacyRecordBatchBuilder.estimate_size_in_bytes
def estimate_size_in_bytes(cls, magic, compression_type, key, value): """ Upper bound estimate of record size. """ assert magic in [0, 1], "Not supported magic" # In case of compression we may need another overhead for inner msg if compression_type: return ( ...
python
def estimate_size_in_bytes(cls, magic, compression_type, key, value): """ Upper bound estimate of record size. """ assert magic in [0, 1], "Not supported magic" # In case of compression we may need another overhead for inner msg if compression_type: return ( ...
[ "def", "estimate_size_in_bytes", "(", "cls", ",", "magic", ",", "compression_type", ",", "key", ",", "value", ")", ":", "assert", "magic", "in", "[", "0", ",", "1", "]", ",", "\"Not supported magic\"", "# In case of compression we may need another overhead for inner m...
Upper bound estimate of record size.
[ "Upper", "bound", "estimate", "of", "record", "size", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/record/legacy_records.py#L497-L507
train
Estimate the size of a record in bytes.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/producer/buffer.py
SimpleBufferPool.allocate
def allocate(self, size, max_time_to_block_ms): """ Allocate a buffer of the given size. This method blocks if there is not enough memory and the buffer pool is configured with blocking mode. Arguments: size (int): The buffer size to allocate in bytes [ignored] m...
python
def allocate(self, size, max_time_to_block_ms): """ Allocate a buffer of the given size. This method blocks if there is not enough memory and the buffer pool is configured with blocking mode. Arguments: size (int): The buffer size to allocate in bytes [ignored] m...
[ "def", "allocate", "(", "self", ",", "size", ",", "max_time_to_block_ms", ")", ":", "with", "self", ".", "_lock", ":", "# check if we have a free buffer of the right size pooled", "if", "self", ".", "_free", ":", "return", "self", ".", "_free", ".", "popleft", "...
Allocate a buffer of the given size. This method blocks if there is not enough memory and the buffer pool is configured with blocking mode. Arguments: size (int): The buffer size to allocate in bytes [ignored] max_time_to_block_ms (int): The maximum time in milliseconds to ...
[ "Allocate", "a", "buffer", "of", "the", "given", "size", ".", "This", "method", "blocks", "if", "there", "is", "not", "enough", "memory", "and", "the", "buffer", "pool", "is", "configured", "with", "blocking", "mode", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/buffer.py#L38-L92
train
Allocate a buffer of the given size. This method blocks if there is not enough memory and the buffer pool is configured with blocking mode.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/producer/buffer.py
SimpleBufferPool.deallocate
def deallocate(self, buf): """ Return buffers to the pool. If they are of the poolable size add them to the free list, otherwise just mark the memory as free. Arguments: buffer_ (io.BytesIO): The buffer to return """ with self._lock: # BytesIO.tru...
python
def deallocate(self, buf): """ Return buffers to the pool. If they are of the poolable size add them to the free list, otherwise just mark the memory as free. Arguments: buffer_ (io.BytesIO): The buffer to return """ with self._lock: # BytesIO.tru...
[ "def", "deallocate", "(", "self", ",", "buf", ")", ":", "with", "self", ".", "_lock", ":", "# BytesIO.truncate here makes the pool somewhat pointless", "# but we stick with the BufferPool API until migrating to", "# bytesarray / memoryview. The buffer we return must not", "# expose a...
Return buffers to the pool. If they are of the poolable size add them to the free list, otherwise just mark the memory as free. Arguments: buffer_ (io.BytesIO): The buffer to return
[ "Return", "buffers", "to", "the", "pool", ".", "If", "they", "are", "of", "the", "poolable", "size", "add", "them", "to", "the", "free", "list", "otherwise", "just", "mark", "the", "memory", "as", "free", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/buffer.py#L94-L110
train
Deallocate a buffer from the pool.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/protocol/message.py
MessageSet.decode
def decode(cls, data, bytes_to_read=None): """Compressed messages should pass in bytes_to_read (via message size) otherwise, we decode from data as Int32 """ if isinstance(data, bytes): data = io.BytesIO(data) if bytes_to_read is None: bytes_to_read = Int3...
python
def decode(cls, data, bytes_to_read=None): """Compressed messages should pass in bytes_to_read (via message size) otherwise, we decode from data as Int32 """ if isinstance(data, bytes): data = io.BytesIO(data) if bytes_to_read is None: bytes_to_read = Int3...
[ "def", "decode", "(", "cls", ",", "data", ",", "bytes_to_read", "=", "None", ")", ":", "if", "isinstance", "(", "data", ",", "bytes", ")", ":", "data", "=", "io", ".", "BytesIO", "(", "data", ")", "if", "bytes_to_read", "is", "None", ":", "bytes_to_r...
Compressed messages should pass in bytes_to_read (via message size) otherwise, we decode from data as Int32
[ "Compressed", "messages", "should", "pass", "in", "bytes_to_read", "(", "via", "message", "size", ")", "otherwise", "we", "decode", "from", "data", "as", "Int32" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/message.py#L178-L203
train
Decode a message set into a list of items.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/record/util.py
encode_varint
def encode_varint(value, write): """ Encode an integer to a varint presentation. See https://developers.google.com/protocol-buffers/docs/encoding?csw=1#varints on how those can be produced. Arguments: value (int): Value to encode write (function): Called per byte that needs ...
python
def encode_varint(value, write): """ Encode an integer to a varint presentation. See https://developers.google.com/protocol-buffers/docs/encoding?csw=1#varints on how those can be produced. Arguments: value (int): Value to encode write (function): Called per byte that needs ...
[ "def", "encode_varint", "(", "value", ",", "write", ")", ":", "value", "=", "(", "value", "<<", "1", ")", "^", "(", "value", ">>", "63", ")", "if", "value", "<=", "0x7f", ":", "# 1 byte", "write", "(", "value", ")", "return", "1", "if", "value", ...
Encode an integer to a varint presentation. See https://developers.google.com/protocol-buffers/docs/encoding?csw=1#varints on how those can be produced. Arguments: value (int): Value to encode write (function): Called per byte that needs to be writen Returns: ...
[ "Encode", "an", "integer", "to", "a", "varint", "presentation", ".", "See", "https", ":", "//", "developers", ".", "google", ".", "com", "/", "protocol", "-", "buffers", "/", "docs", "/", "encoding?csw", "=", "1#varints", "on", "how", "those", "can", "be...
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/record/util.py#L10-L60
train
Encode an integer to a varint presentation.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/record/util.py
size_of_varint
def size_of_varint(value): """ Number of bytes needed to encode an integer in variable-length format. """ value = (value << 1) ^ (value >> 63) if value <= 0x7f: return 1 if value <= 0x3fff: return 2 if value <= 0x1fffff: return 3 if value <= 0xfffffff: return ...
python
def size_of_varint(value): """ Number of bytes needed to encode an integer in variable-length format. """ value = (value << 1) ^ (value >> 63) if value <= 0x7f: return 1 if value <= 0x3fff: return 2 if value <= 0x1fffff: return 3 if value <= 0xfffffff: return ...
[ "def", "size_of_varint", "(", "value", ")", ":", "value", "=", "(", "value", "<<", "1", ")", "^", "(", "value", ">>", "63", ")", "if", "value", "<=", "0x7f", ":", "return", "1", "if", "value", "<=", "0x3fff", ":", "return", "2", "if", "value", "<...
Number of bytes needed to encode an integer in variable-length format.
[ "Number", "of", "bytes", "needed", "to", "encode", "an", "integer", "in", "variable", "-", "length", "format", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/record/util.py#L63-L85
train
Returns the number of bytes needed to encode an integer in variable - length format.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/record/util.py
decode_varint
def decode_varint(buffer, pos=0): """ Decode an integer from a varint presentation. See https://developers.google.com/protocol-buffers/docs/encoding?csw=1#varints on how those can be produced. Arguments: buffer (bytearry): buffer to read from. pos (int): optional position to...
python
def decode_varint(buffer, pos=0): """ Decode an integer from a varint presentation. See https://developers.google.com/protocol-buffers/docs/encoding?csw=1#varints on how those can be produced. Arguments: buffer (bytearry): buffer to read from. pos (int): optional position to...
[ "def", "decode_varint", "(", "buffer", ",", "pos", "=", "0", ")", ":", "result", "=", "buffer", "[", "pos", "]", "if", "not", "(", "result", "&", "0x81", ")", ":", "return", "(", "result", ">>", "1", ")", ",", "pos", "+", "1", "if", "not", "(",...
Decode an integer from a varint presentation. See https://developers.google.com/protocol-buffers/docs/encoding?csw=1#varints on how those can be produced. Arguments: buffer (bytearry): buffer to read from. pos (int): optional position to read from Returns: (...
[ "Decode", "an", "integer", "from", "a", "varint", "presentation", ".", "See", "https", ":", "//", "developers", ".", "google", ".", "com", "/", "protocol", "-", "buffers", "/", "docs", "/", "encoding?csw", "=", "1#varints", "on", "how", "those", "can", "...
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/record/util.py#L88-L117
train
Decodes an integer from a varint presentation.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/protocol/parser.py
KafkaProtocol.send_request
def send_request(self, request, correlation_id=None): """Encode and queue a kafka api request for sending. Arguments: request (object): An un-encoded kafka request. correlation_id (int, optional): Optionally specify an ID to correlate requests with responses. If ...
python
def send_request(self, request, correlation_id=None): """Encode and queue a kafka api request for sending. Arguments: request (object): An un-encoded kafka request. correlation_id (int, optional): Optionally specify an ID to correlate requests with responses. If ...
[ "def", "send_request", "(", "self", ",", "request", ",", "correlation_id", "=", "None", ")", ":", "log", ".", "debug", "(", "'Sending request %s'", ",", "request", ")", "if", "correlation_id", "is", "None", ":", "correlation_id", "=", "self", ".", "_next_cor...
Encode and queue a kafka api request for sending. Arguments: request (object): An un-encoded kafka request. correlation_id (int, optional): Optionally specify an ID to correlate requests with responses. If not provided, an ID will be generated automatical...
[ "Encode", "and", "queue", "a", "kafka", "api", "request", "for", "sending", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/parser.py#L47-L72
train
Encode and queue a kafka api request for sending.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/protocol/parser.py
KafkaProtocol.send_bytes
def send_bytes(self): """Retrieve all pending bytes to send on the network""" data = b''.join(self.bytes_to_send) self.bytes_to_send = [] return data
python
def send_bytes(self): """Retrieve all pending bytes to send on the network""" data = b''.join(self.bytes_to_send) self.bytes_to_send = [] return data
[ "def", "send_bytes", "(", "self", ")", ":", "data", "=", "b''", ".", "join", "(", "self", ".", "bytes_to_send", ")", "self", ".", "bytes_to_send", "=", "[", "]", "return", "data" ]
Retrieve all pending bytes to send on the network
[ "Retrieve", "all", "pending", "bytes", "to", "send", "on", "the", "network" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/parser.py#L74-L78
train
Retrieve all pending bytes to send on the network
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/protocol/parser.py
KafkaProtocol.receive_bytes
def receive_bytes(self, data): """Process bytes received from the network. Arguments: data (bytes): any length bytes received from a network connection to a kafka broker. Returns: responses (list of (correlation_id, response)): any/all completed ...
python
def receive_bytes(self, data): """Process bytes received from the network. Arguments: data (bytes): any length bytes received from a network connection to a kafka broker. Returns: responses (list of (correlation_id, response)): any/all completed ...
[ "def", "receive_bytes", "(", "self", ",", "data", ")", ":", "i", "=", "0", "n", "=", "len", "(", "data", ")", "responses", "=", "[", "]", "while", "i", "<", "n", ":", "# Not receiving is the state of reading the payload header", "if", "not", "self", ".", ...
Process bytes received from the network. Arguments: data (bytes): any length bytes received from a network connection to a kafka broker. Returns: responses (list of (correlation_id, response)): any/all completed responses, decoded from bytes to p...
[ "Process", "bytes", "received", "from", "the", "network", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/parser.py#L80-L135
train
Process bytes received from a Kafka broker to a Kafka broker.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client.py
SimpleClient._get_conn
def _get_conn(self, host, port, afi): """Get or create a connection to a broker using host and port""" host_key = (host, port) if host_key not in self._conns: self._conns[host_key] = BrokerConnection( host, port, afi, request_timeout_ms=self.timeout * ...
python
def _get_conn(self, host, port, afi): """Get or create a connection to a broker using host and port""" host_key = (host, port) if host_key not in self._conns: self._conns[host_key] = BrokerConnection( host, port, afi, request_timeout_ms=self.timeout * ...
[ "def", "_get_conn", "(", "self", ",", "host", ",", "port", ",", "afi", ")", ":", "host_key", "=", "(", "host", ",", "port", ")", "if", "host_key", "not", "in", "self", ".", "_conns", ":", "self", ".", "_conns", "[", "host_key", "]", "=", "BrokerCon...
Get or create a connection to a broker using host and port
[ "Get", "or", "create", "a", "connection", "to", "a", "broker", "using", "host", "and", "port" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client.py#L63-L77
train
Get or create a connection to a broker using host and port
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client.py
SimpleClient._get_leader_for_partition
def _get_leader_for_partition(self, topic, partition): """ Returns the leader for a partition or None if the partition exists but has no leader. Raises: UnknownTopicOrPartitionError: If the topic or partition is not part of the metadata. LeaderNot...
python
def _get_leader_for_partition(self, topic, partition): """ Returns the leader for a partition or None if the partition exists but has no leader. Raises: UnknownTopicOrPartitionError: If the topic or partition is not part of the metadata. LeaderNot...
[ "def", "_get_leader_for_partition", "(", "self", ",", "topic", ",", "partition", ")", ":", "key", "=", "TopicPartition", "(", "topic", ",", "partition", ")", "# Use cached metadata if it is there", "if", "self", ".", "topics_to_brokers", ".", "get", "(", "key", ...
Returns the leader for a partition or None if the partition exists but has no leader. Raises: UnknownTopicOrPartitionError: If the topic or partition is not part of the metadata. LeaderNotAvailableError: If the server has metadata, but there is no current...
[ "Returns", "the", "leader", "for", "a", "partition", "or", "None", "if", "the", "partition", "exists", "but", "has", "no", "leader", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client.py#L79-L114
train
Returns the leader for a topic and partition.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client.py
SimpleClient._get_coordinator_for_group
def _get_coordinator_for_group(self, group): """ Returns the coordinator broker for a consumer group. GroupCoordinatorNotAvailableError will be raised if the coordinator does not currently exist for the group. GroupLoadInProgressError is raised if the coordinator is available ...
python
def _get_coordinator_for_group(self, group): """ Returns the coordinator broker for a consumer group. GroupCoordinatorNotAvailableError will be raised if the coordinator does not currently exist for the group. GroupLoadInProgressError is raised if the coordinator is available ...
[ "def", "_get_coordinator_for_group", "(", "self", ",", "group", ")", ":", "resp", "=", "self", ".", "send_consumer_metadata_request", "(", "group", ")", "# If there's a problem with finding the coordinator, raise the", "# provided error", "kafka", ".", "errors", ".", "che...
Returns the coordinator broker for a consumer group. GroupCoordinatorNotAvailableError will be raised if the coordinator does not currently exist for the group. GroupLoadInProgressError is raised if the coordinator is available but is still loading offsets from the internal topic
[ "Returns", "the", "coordinator", "broker", "for", "a", "consumer", "group", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client.py#L116-L134
train
Returns the coordinator broker for a given consumer group.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client.py
SimpleClient._send_broker_unaware_request
def _send_broker_unaware_request(self, payloads, encoder_fn, decoder_fn): """ Attempt to send a broker-agnostic request to one of the available brokers. Keep trying until you succeed. """ hosts = set() for broker in self.brokers.values(): host, port, afi = get...
python
def _send_broker_unaware_request(self, payloads, encoder_fn, decoder_fn): """ Attempt to send a broker-agnostic request to one of the available brokers. Keep trying until you succeed. """ hosts = set() for broker in self.brokers.values(): host, port, afi = get...
[ "def", "_send_broker_unaware_request", "(", "self", ",", "payloads", ",", "encoder_fn", ",", "decoder_fn", ")", ":", "hosts", "=", "set", "(", ")", "for", "broker", "in", "self", ".", "brokers", ".", "values", "(", ")", ":", "host", ",", "port", ",", "...
Attempt to send a broker-agnostic request to one of the available brokers. Keep trying until you succeed.
[ "Attempt", "to", "send", "a", "broker", "-", "agnostic", "request", "to", "one", "of", "the", "available", "brokers", ".", "Keep", "trying", "until", "you", "succeed", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client.py#L142-L177
train
Send a broker - aware request to all available brokers.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client.py
SimpleClient._send_broker_aware_request
def _send_broker_aware_request(self, payloads, encoder_fn, decoder_fn): """ Group a list of request payloads by topic+partition and send them to the leader broker for that partition using the supplied encode/decode functions Arguments: payloads: list of object-like enti...
python
def _send_broker_aware_request(self, payloads, encoder_fn, decoder_fn): """ Group a list of request payloads by topic+partition and send them to the leader broker for that partition using the supplied encode/decode functions Arguments: payloads: list of object-like enti...
[ "def", "_send_broker_aware_request", "(", "self", ",", "payloads", ",", "encoder_fn", ",", "decoder_fn", ")", ":", "# encoders / decoders do not maintain ordering currently", "# so we need to keep this so we can rebuild order before returning", "original_ordering", "=", "[", "(", ...
Group a list of request payloads by topic+partition and send them to the leader broker for that partition using the supplied encode/decode functions Arguments: payloads: list of object-like entities with a topic (str) and partition (int) attribute; payloads with duplicate t...
[ "Group", "a", "list", "of", "request", "payloads", "by", "topic", "+", "partition", "and", "send", "them", "to", "the", "leader", "broker", "for", "that", "partition", "using", "the", "supplied", "encode", "/", "decode", "functions" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client.py#L190-L301
train
Send a list of payloads to the broker and return a list of response objects.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...