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/coordinator/base.py | BaseCoordinator.maybe_leave_group | def maybe_leave_group(self):
"""Leave the current group and reset local generation/memberId."""
with self._client._lock, self._lock:
if (not self.coordinator_unknown()
and self.state is not MemberState.UNJOINED
and self._generation is not Generation.NO_GENERAT... | python | def maybe_leave_group(self):
"""Leave the current group and reset local generation/memberId."""
with self._client._lock, self._lock:
if (not self.coordinator_unknown()
and self.state is not MemberState.UNJOINED
and self._generation is not Generation.NO_GENERAT... | [
"def",
"maybe_leave_group",
"(",
"self",
")",
":",
"with",
"self",
".",
"_client",
".",
"_lock",
",",
"self",
".",
"_lock",
":",
"if",
"(",
"not",
"self",
".",
"coordinator_unknown",
"(",
")",
"and",
"self",
".",
"state",
"is",
"not",
"MemberState",
".... | Leave the current group and reset local generation/memberId. | [
"Leave",
"the",
"current",
"group",
"and",
"reset",
"local",
"generation",
"/",
"memberId",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/coordinator/base.py#L758-L775 | train | Leave the current group and reset local generation and memberId. | 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/base.py | BaseCoordinator._send_heartbeat_request | def _send_heartbeat_request(self):
"""Send a heartbeat request"""
if self.coordinator_unknown():
e = Errors.GroupCoordinatorNotAvailableError(self.coordinator_id)
return Future().failure(e)
elif not self._client.ready(self.coordinator_id, metadata_priority=False):
... | python | def _send_heartbeat_request(self):
"""Send a heartbeat request"""
if self.coordinator_unknown():
e = Errors.GroupCoordinatorNotAvailableError(self.coordinator_id)
return Future().failure(e)
elif not self._client.ready(self.coordinator_id, metadata_priority=False):
... | [
"def",
"_send_heartbeat_request",
"(",
"self",
")",
":",
"if",
"self",
".",
"coordinator_unknown",
"(",
")",
":",
"e",
"=",
"Errors",
".",
"GroupCoordinatorNotAvailableError",
"(",
"self",
".",
"coordinator_id",
")",
"return",
"Future",
"(",
")",
".",
"failure... | Send a heartbeat request | [
"Send",
"a",
"heartbeat",
"request"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/coordinator/base.py#L786-L806 | train | Send a heartbeat request to the 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/metrics/metrics.py | Metrics.metric_name | def metric_name(self, name, group, description='', tags=None):
"""
Create a MetricName with the given name, group, description and tags,
plus default tags specified in the metric configuration.
Tag in tags takes precedence if the same tag key is specified in
the default metric co... | python | def metric_name(self, name, group, description='', tags=None):
"""
Create a MetricName with the given name, group, description and tags,
plus default tags specified in the metric configuration.
Tag in tags takes precedence if the same tag key is specified in
the default metric co... | [
"def",
"metric_name",
"(",
"self",
",",
"name",
",",
"group",
",",
"description",
"=",
"''",
",",
"tags",
"=",
"None",
")",
":",
"combined_tags",
"=",
"dict",
"(",
"self",
".",
"config",
".",
"tags",
")",
"combined_tags",
".",
"update",
"(",
"tags",
... | Create a MetricName with the given name, group, description and tags,
plus default tags specified in the metric configuration.
Tag in tags takes precedence if the same tag key is specified in
the default metric configuration.
Arguments:
name (str): The name of the metric
... | [
"Create",
"a",
"MetricName",
"with",
"the",
"given",
"name",
"group",
"description",
"and",
"tags",
"plus",
"default",
"tags",
"specified",
"in",
"the",
"metric",
"configuration",
".",
"Tag",
"in",
"tags",
"takes",
"precedence",
"if",
"the",
"same",
"tag",
"... | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/metrics.py#L85-L103 | train | Creates a MetricName object with the given name group description and tags. | 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/metrics.py | Metrics.sensor | def sensor(self, name, config=None,
inactive_sensor_expiration_time_seconds=sys.maxsize,
parents=None):
"""
Get or create a sensor with the given unique name and zero or
more parent sensors. All parent sensors will receive every value
recorded with this sens... | python | def sensor(self, name, config=None,
inactive_sensor_expiration_time_seconds=sys.maxsize,
parents=None):
"""
Get or create a sensor with the given unique name and zero or
more parent sensors. All parent sensors will receive every value
recorded with this sens... | [
"def",
"sensor",
"(",
"self",
",",
"name",
",",
"config",
"=",
"None",
",",
"inactive_sensor_expiration_time_seconds",
"=",
"sys",
".",
"maxsize",
",",
"parents",
"=",
"None",
")",
":",
"sensor",
"=",
"self",
".",
"get_sensor",
"(",
"name",
")",
"if",
"s... | Get or create a sensor with the given unique name and zero or
more parent sensors. All parent sensors will receive every value
recorded with this sensor.
Arguments:
name (str): The name of the sensor
config (MetricConfig, optional): A default configuration to use
... | [
"Get",
"or",
"create",
"a",
"sensor",
"with",
"the",
"given",
"unique",
"name",
"and",
"zero",
"or",
"more",
"parent",
"sensors",
".",
"All",
"parent",
"sensors",
"will",
"receive",
"every",
"value",
"recorded",
"with",
"this",
"sensor",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/metrics.py#L119-L157 | train | Get or create a Sensor with the given unique name and configuration. | 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/metrics.py | Metrics.remove_sensor | def remove_sensor(self, name):
"""
Remove a sensor (if it exists), associated metrics and its children.
Arguments:
name (str): The name of the sensor to be removed
"""
sensor = self._sensors.get(name)
if sensor:
child_sensors = None
wi... | python | def remove_sensor(self, name):
"""
Remove a sensor (if it exists), associated metrics and its children.
Arguments:
name (str): The name of the sensor to be removed
"""
sensor = self._sensors.get(name)
if sensor:
child_sensors = None
wi... | [
"def",
"remove_sensor",
"(",
"self",
",",
"name",
")",
":",
"sensor",
"=",
"self",
".",
"_sensors",
".",
"get",
"(",
"name",
")",
"if",
"sensor",
":",
"child_sensors",
"=",
"None",
"with",
"sensor",
".",
"_lock",
":",
"with",
"self",
".",
"_lock",
":... | Remove a sensor (if it exists), associated metrics and its children.
Arguments:
name (str): The name of the sensor to be removed | [
"Remove",
"a",
"sensor",
"(",
"if",
"it",
"exists",
")",
"associated",
"metrics",
"and",
"its",
"children",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/metrics.py#L159-L179 | train | Removes a sensor from the cache. | 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/metrics.py | Metrics.add_metric | def add_metric(self, metric_name, measurable, config=None):
"""
Add a metric to monitor an object that implements measurable.
This metric won't be associated with any sensor.
This is a way to expose existing values as metrics.
Arguments:
metricName (MetricName): The ... | python | def add_metric(self, metric_name, measurable, config=None):
"""
Add a metric to monitor an object that implements measurable.
This metric won't be associated with any sensor.
This is a way to expose existing values as metrics.
Arguments:
metricName (MetricName): The ... | [
"def",
"add_metric",
"(",
"self",
",",
"metric_name",
",",
"measurable",
",",
"config",
"=",
"None",
")",
":",
"# NOTE there was a lock here, but i don't think it's needed",
"metric",
"=",
"KafkaMetric",
"(",
"metric_name",
",",
"measurable",
",",
"config",
"or",
"s... | Add a metric to monitor an object that implements measurable.
This metric won't be associated with any sensor.
This is a way to expose existing values as metrics.
Arguments:
metricName (MetricName): The name of the metric
measurable (AbstractMeasurable): The measurable t... | [
"Add",
"a",
"metric",
"to",
"monitor",
"an",
"object",
"that",
"implements",
"measurable",
".",
"This",
"metric",
"won",
"t",
"be",
"associated",
"with",
"any",
"sensor",
".",
"This",
"is",
"a",
"way",
"to",
"expose",
"existing",
"values",
"as",
"metrics",... | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/metrics.py#L181-L196 | train | Add a metric to monitor an object that implements measurable. This metric will be added to any existing sensors. | 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/metrics.py | Metrics.remove_metric | def remove_metric(self, metric_name):
"""
Remove a metric if it exists and return it. Return None otherwise.
If a metric is removed, `metric_removal` will be invoked
for each reporter.
Arguments:
metric_name (MetricName): The name of the metric
Returns:
... | python | def remove_metric(self, metric_name):
"""
Remove a metric if it exists and return it. Return None otherwise.
If a metric is removed, `metric_removal` will be invoked
for each reporter.
Arguments:
metric_name (MetricName): The name of the metric
Returns:
... | [
"def",
"remove_metric",
"(",
"self",
",",
"metric_name",
")",
":",
"with",
"self",
".",
"_lock",
":",
"metric",
"=",
"self",
".",
"_metrics",
".",
"pop",
"(",
"metric_name",
",",
"None",
")",
"if",
"metric",
":",
"for",
"reporter",
"in",
"self",
".",
... | Remove a metric if it exists and return it. Return None otherwise.
If a metric is removed, `metric_removal` will be invoked
for each reporter.
Arguments:
metric_name (MetricName): The name of the metric
Returns:
KafkaMetric: the removed `KafkaMetric` or None if ... | [
"Remove",
"a",
"metric",
"if",
"it",
"exists",
"and",
"return",
"it",
".",
"Return",
"None",
"otherwise",
".",
"If",
"a",
"metric",
"is",
"removed",
"metric_removal",
"will",
"be",
"invoked",
"for",
"each",
"reporter",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/metrics.py#L198-L216 | train | Removes a metric from the internal cache if it exists and return it. | 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/metrics.py | Metrics.add_reporter | def add_reporter(self, reporter):
"""Add a MetricReporter"""
with self._lock:
reporter.init(list(self.metrics.values()))
self._reporters.append(reporter) | python | def add_reporter(self, reporter):
"""Add a MetricReporter"""
with self._lock:
reporter.init(list(self.metrics.values()))
self._reporters.append(reporter) | [
"def",
"add_reporter",
"(",
"self",
",",
"reporter",
")",
":",
"with",
"self",
".",
"_lock",
":",
"reporter",
".",
"init",
"(",
"list",
"(",
"self",
".",
"metrics",
".",
"values",
"(",
")",
")",
")",
"self",
".",
"_reporters",
".",
"append",
"(",
"... | Add a MetricReporter | [
"Add",
"a",
"MetricReporter"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/metrics.py#L218-L222 | train | Adds a MetricReporter to the list of available metrics. | 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/metrics.py | Metrics.close | def close(self):
"""Close this metrics repository."""
for reporter in self._reporters:
reporter.close()
self._metrics.clear() | python | def close(self):
"""Close this metrics repository."""
for reporter in self._reporters:
reporter.close()
self._metrics.clear() | [
"def",
"close",
"(",
"self",
")",
":",
"for",
"reporter",
"in",
"self",
".",
"_reporters",
":",
"reporter",
".",
"close",
"(",
")",
"self",
".",
"_metrics",
".",
"clear",
"(",
")"
] | Close this metrics repository. | [
"Close",
"this",
"metrics",
"repository",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/metrics.py#L256-L261 | train | Close this metrics repository. | 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/legacy.py | create_snappy_message | def create_snappy_message(payloads, key=None):
"""
Construct a Snappy Message containing multiple Messages
The given payloads will be encoded, compressed, and sent as a single atomic
message to Kafka.
Arguments:
payloads: list(bytes), a list of payload to send be sent to Kafka
key:... | python | def create_snappy_message(payloads, key=None):
"""
Construct a Snappy Message containing multiple Messages
The given payloads will be encoded, compressed, and sent as a single atomic
message to Kafka.
Arguments:
payloads: list(bytes), a list of payload to send be sent to Kafka
key:... | [
"def",
"create_snappy_message",
"(",
"payloads",
",",
"key",
"=",
"None",
")",
":",
"message_set",
"=",
"KafkaProtocol",
".",
"_encode_message_set",
"(",
"[",
"create_message",
"(",
"payload",
",",
"pl_key",
")",
"for",
"payload",
",",
"pl_key",
"in",
"payload... | Construct a Snappy Message containing multiple Messages
The given payloads will be encoded, compressed, and sent as a single atomic
message to Kafka.
Arguments:
payloads: list(bytes), a list of payload to send be sent to Kafka
key: bytes, a key used for partition routing (optional) | [
"Construct",
"a",
"Snappy",
"Message",
"containing",
"multiple",
"Messages"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/legacy.py#L440-L458 | train | Construct a Snappy Message containing multiple Messages
| 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/legacy.py | create_message_set | def create_message_set(messages, codec=CODEC_NONE, key=None, compresslevel=None):
"""Create a message set using the given codec.
If codec is CODEC_NONE, return a list of raw Kafka messages. Otherwise,
return a list containing a single codec-encoded message.
"""
if codec == CODEC_NONE:
retur... | python | def create_message_set(messages, codec=CODEC_NONE, key=None, compresslevel=None):
"""Create a message set using the given codec.
If codec is CODEC_NONE, return a list of raw Kafka messages. Otherwise,
return a list containing a single codec-encoded message.
"""
if codec == CODEC_NONE:
retur... | [
"def",
"create_message_set",
"(",
"messages",
",",
"codec",
"=",
"CODEC_NONE",
",",
"key",
"=",
"None",
",",
"compresslevel",
"=",
"None",
")",
":",
"if",
"codec",
"==",
"CODEC_NONE",
":",
"return",
"[",
"create_message",
"(",
"m",
",",
"k",
")",
"for",
... | Create a message set using the given codec.
If codec is CODEC_NONE, return a list of raw Kafka messages. Otherwise,
return a list containing a single codec-encoded message. | [
"Create",
"a",
"message",
"set",
"using",
"the",
"given",
"codec",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/legacy.py#L461-L474 | train | Create a message set using the given codec. | 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/legacy.py | KafkaProtocol._encode_message_header | def _encode_message_header(cls, client_id, correlation_id, request_key,
version=0):
"""
Encode the common request envelope
"""
return struct.pack('>hhih%ds' % len(client_id),
request_key, # ApiKey
... | python | def _encode_message_header(cls, client_id, correlation_id, request_key,
version=0):
"""
Encode the common request envelope
"""
return struct.pack('>hhih%ds' % len(client_id),
request_key, # ApiKey
... | [
"def",
"_encode_message_header",
"(",
"cls",
",",
"client_id",
",",
"correlation_id",
",",
"request_key",
",",
"version",
"=",
"0",
")",
":",
"return",
"struct",
".",
"pack",
"(",
"'>hhih%ds'",
"%",
"len",
"(",
"client_id",
")",
",",
"request_key",
",",
"#... | Encode the common request envelope | [
"Encode",
"the",
"common",
"request",
"envelope"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/legacy.py#L52-L62 | train | Encode the message header. | 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/legacy.py | KafkaProtocol._encode_message_set | def _encode_message_set(cls, messages):
"""
Encode a MessageSet. Unlike other arrays in the protocol,
MessageSets are not length-prefixed
Format
======
MessageSet => [Offset MessageSize Message]
Offset => int64
MessageSize => int32
"""
... | python | def _encode_message_set(cls, messages):
"""
Encode a MessageSet. Unlike other arrays in the protocol,
MessageSets are not length-prefixed
Format
======
MessageSet => [Offset MessageSize Message]
Offset => int64
MessageSize => int32
"""
... | [
"def",
"_encode_message_set",
"(",
"cls",
",",
"messages",
")",
":",
"message_set",
"=",
"[",
"]",
"for",
"message",
"in",
"messages",
":",
"encoded_message",
"=",
"KafkaProtocol",
".",
"_encode_message",
"(",
"message",
")",
"message_set",
".",
"append",
"(",... | Encode a MessageSet. Unlike other arrays in the protocol,
MessageSets are not length-prefixed
Format
======
MessageSet => [Offset MessageSize Message]
Offset => int64
MessageSize => int32 | [
"Encode",
"a",
"MessageSet",
".",
"Unlike",
"other",
"arrays",
"in",
"the",
"protocol",
"MessageSets",
"are",
"not",
"length",
"-",
"prefixed"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/legacy.py#L65-L82 | train | Encode a list of messages into a message set. | 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/legacy.py | KafkaProtocol.encode_produce_request | def encode_produce_request(cls, payloads=(), acks=1, timeout=1000):
"""
Encode a ProduceRequest struct
Arguments:
payloads: list of ProduceRequestPayload
acks: How "acky" you want the request to be
1: written to disk by the leader
0: immed... | python | def encode_produce_request(cls, payloads=(), acks=1, timeout=1000):
"""
Encode a ProduceRequest struct
Arguments:
payloads: list of ProduceRequestPayload
acks: How "acky" you want the request to be
1: written to disk by the leader
0: immed... | [
"def",
"encode_produce_request",
"(",
"cls",
",",
"payloads",
"=",
"(",
")",
",",
"acks",
"=",
"1",
",",
"timeout",
"=",
"1000",
")",
":",
"if",
"acks",
"not",
"in",
"(",
"1",
",",
"0",
",",
"-",
"1",
")",
":",
"raise",
"ValueError",
"(",
"'Produ... | Encode a ProduceRequest struct
Arguments:
payloads: list of ProduceRequestPayload
acks: How "acky" you want the request to be
1: written to disk by the leader
0: immediate response
-1: waits for all replicas to be in sync
timeo... | [
"Encode",
"a",
"ProduceRequest",
"struct"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/legacy.py#L118-L155 | train | Encodes ProduceRequest struct into a ProduceRequest structure. | 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/legacy.py | KafkaProtocol.decode_produce_response | def decode_produce_response(cls, response):
"""
Decode ProduceResponse to ProduceResponsePayload
Arguments:
response: ProduceResponse
Return: list of ProduceResponsePayload
"""
return [
kafka.structs.ProduceResponsePayload(topic, partition, error... | python | def decode_produce_response(cls, response):
"""
Decode ProduceResponse to ProduceResponsePayload
Arguments:
response: ProduceResponse
Return: list of ProduceResponsePayload
"""
return [
kafka.structs.ProduceResponsePayload(topic, partition, error... | [
"def",
"decode_produce_response",
"(",
"cls",
",",
"response",
")",
":",
"return",
"[",
"kafka",
".",
"structs",
".",
"ProduceResponsePayload",
"(",
"topic",
",",
"partition",
",",
"error",
",",
"offset",
")",
"for",
"topic",
",",
"partitions",
"in",
"respon... | Decode ProduceResponse to ProduceResponsePayload
Arguments:
response: ProduceResponse
Return: list of ProduceResponsePayload | [
"Decode",
"ProduceResponse",
"to",
"ProduceResponsePayload"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/legacy.py#L158-L171 | train | Decode ProduceResponse to ProduceResponsePayloads | 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/legacy.py | KafkaProtocol.encode_fetch_request | def encode_fetch_request(cls, payloads=(), max_wait_time=100, min_bytes=4096):
"""
Encodes a FetchRequest struct
Arguments:
payloads: list of FetchRequestPayload
max_wait_time (int, optional): ms to block waiting for min_bytes
data. Defaults to 100.
... | python | def encode_fetch_request(cls, payloads=(), max_wait_time=100, min_bytes=4096):
"""
Encodes a FetchRequest struct
Arguments:
payloads: list of FetchRequestPayload
max_wait_time (int, optional): ms to block waiting for min_bytes
data. Defaults to 100.
... | [
"def",
"encode_fetch_request",
"(",
"cls",
",",
"payloads",
"=",
"(",
")",
",",
"max_wait_time",
"=",
"100",
",",
"min_bytes",
"=",
"4096",
")",
":",
"return",
"kafka",
".",
"protocol",
".",
"fetch",
".",
"FetchRequest",
"[",
"0",
"]",
"(",
"replica_id",... | Encodes a FetchRequest struct
Arguments:
payloads: list of FetchRequestPayload
max_wait_time (int, optional): ms to block waiting for min_bytes
data. Defaults to 100.
min_bytes (int, optional): minimum bytes required to return before
max_wait_... | [
"Encodes",
"a",
"FetchRequest",
"struct"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/legacy.py#L174-L198 | train | Encodes a FetchRequest struct into a FetchRequest struct. | 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/legacy.py | KafkaProtocol.decode_fetch_response | def decode_fetch_response(cls, response):
"""
Decode FetchResponse struct to FetchResponsePayloads
Arguments:
response: FetchResponse
"""
return [
kafka.structs.FetchResponsePayload(
topic, partition, error, highwater_offset, [
... | python | def decode_fetch_response(cls, response):
"""
Decode FetchResponse struct to FetchResponsePayloads
Arguments:
response: FetchResponse
"""
return [
kafka.structs.FetchResponsePayload(
topic, partition, error, highwater_offset, [
... | [
"def",
"decode_fetch_response",
"(",
"cls",
",",
"response",
")",
":",
"return",
"[",
"kafka",
".",
"structs",
".",
"FetchResponsePayload",
"(",
"topic",
",",
"partition",
",",
"error",
",",
"highwater_offset",
",",
"[",
"offset_and_msg",
"for",
"offset_and_msg"... | Decode FetchResponse struct to FetchResponsePayloads
Arguments:
response: FetchResponse | [
"Decode",
"FetchResponse",
"struct",
"to",
"FetchResponsePayloads"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/legacy.py#L201-L215 | train | Decodes FetchResponse struct to FetchResponsePayloads
| 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/legacy.py | KafkaProtocol.decode_offset_response | def decode_offset_response(cls, response):
"""
Decode OffsetResponse into OffsetResponsePayloads
Arguments:
response: OffsetResponse
Returns: list of OffsetResponsePayloads
"""
return [
kafka.structs.OffsetResponsePayload(topic, partition, error,... | python | def decode_offset_response(cls, response):
"""
Decode OffsetResponse into OffsetResponsePayloads
Arguments:
response: OffsetResponse
Returns: list of OffsetResponsePayloads
"""
return [
kafka.structs.OffsetResponsePayload(topic, partition, error,... | [
"def",
"decode_offset_response",
"(",
"cls",
",",
"response",
")",
":",
"return",
"[",
"kafka",
".",
"structs",
".",
"OffsetResponsePayload",
"(",
"topic",
",",
"partition",
",",
"error",
",",
"tuple",
"(",
"offsets",
")",
")",
"for",
"topic",
",",
"partit... | Decode OffsetResponse into OffsetResponsePayloads
Arguments:
response: OffsetResponse
Returns: list of OffsetResponsePayloads | [
"Decode",
"OffsetResponse",
"into",
"OffsetResponsePayloads"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/legacy.py#L242-L255 | train | Decodes OffsetResponse into OffsetResponsePayloads
| 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/legacy.py | KafkaProtocol.decode_list_offset_response | def decode_list_offset_response(cls, response):
"""
Decode OffsetResponse_v2 into ListOffsetResponsePayloads
Arguments:
response: OffsetResponse_v2
Returns: list of ListOffsetResponsePayloads
"""
return [
kafka.structs.ListOffsetResponsePayload(t... | python | def decode_list_offset_response(cls, response):
"""
Decode OffsetResponse_v2 into ListOffsetResponsePayloads
Arguments:
response: OffsetResponse_v2
Returns: list of ListOffsetResponsePayloads
"""
return [
kafka.structs.ListOffsetResponsePayload(t... | [
"def",
"decode_list_offset_response",
"(",
"cls",
",",
"response",
")",
":",
"return",
"[",
"kafka",
".",
"structs",
".",
"ListOffsetResponsePayload",
"(",
"topic",
",",
"partition",
",",
"error",
",",
"timestamp",
",",
"offset",
")",
"for",
"topic",
",",
"p... | Decode OffsetResponse_v2 into ListOffsetResponsePayloads
Arguments:
response: OffsetResponse_v2
Returns: list of ListOffsetResponsePayloads | [
"Decode",
"OffsetResponse_v2",
"into",
"ListOffsetResponsePayloads"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/legacy.py#L270-L283 | train | Decode OffsetResponse_v2 into ListOffsetResponsePayloads
| 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/legacy.py | KafkaProtocol.encode_metadata_request | def encode_metadata_request(cls, topics=(), payloads=None):
"""
Encode a MetadataRequest
Arguments:
topics: list of strings
"""
if payloads is not None:
topics = payloads
return kafka.protocol.metadata.MetadataRequest[0](topics) | python | def encode_metadata_request(cls, topics=(), payloads=None):
"""
Encode a MetadataRequest
Arguments:
topics: list of strings
"""
if payloads is not None:
topics = payloads
return kafka.protocol.metadata.MetadataRequest[0](topics) | [
"def",
"encode_metadata_request",
"(",
"cls",
",",
"topics",
"=",
"(",
")",
",",
"payloads",
"=",
"None",
")",
":",
"if",
"payloads",
"is",
"not",
"None",
":",
"topics",
"=",
"payloads",
"return",
"kafka",
".",
"protocol",
".",
"metadata",
".",
"Metadata... | Encode a MetadataRequest
Arguments:
topics: list of strings | [
"Encode",
"a",
"MetadataRequest"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/legacy.py#L287-L297 | train | Encode a MetadataRequest object | 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/legacy.py | KafkaProtocol.encode_consumer_metadata_request | def encode_consumer_metadata_request(cls, client_id, correlation_id, payloads):
"""
Encode a ConsumerMetadataRequest
Arguments:
client_id: string
correlation_id: int
payloads: string (consumer group)
"""
message = []
message.append(cls... | python | def encode_consumer_metadata_request(cls, client_id, correlation_id, payloads):
"""
Encode a ConsumerMetadataRequest
Arguments:
client_id: string
correlation_id: int
payloads: string (consumer group)
"""
message = []
message.append(cls... | [
"def",
"encode_consumer_metadata_request",
"(",
"cls",
",",
"client_id",
",",
"correlation_id",
",",
"payloads",
")",
":",
"message",
"=",
"[",
"]",
"message",
".",
"append",
"(",
"cls",
".",
"_encode_message_header",
"(",
"client_id",
",",
"correlation_id",
","... | Encode a ConsumerMetadataRequest
Arguments:
client_id: string
correlation_id: int
payloads: string (consumer group) | [
"Encode",
"a",
"ConsumerMetadataRequest"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/legacy.py#L304-L319 | train | Encode a ConsumerMetadataRequest object. | 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/legacy.py | KafkaProtocol.decode_consumer_metadata_response | def decode_consumer_metadata_response(cls, data):
"""
Decode bytes to a kafka.structs.ConsumerMetadataResponse
Arguments:
data: bytes to decode
"""
((correlation_id, error, nodeId), cur) = relative_unpack('>ihi', data, 0)
(host, cur) = read_short_string(data,... | python | def decode_consumer_metadata_response(cls, data):
"""
Decode bytes to a kafka.structs.ConsumerMetadataResponse
Arguments:
data: bytes to decode
"""
((correlation_id, error, nodeId), cur) = relative_unpack('>ihi', data, 0)
(host, cur) = read_short_string(data,... | [
"def",
"decode_consumer_metadata_response",
"(",
"cls",
",",
"data",
")",
":",
"(",
"(",
"correlation_id",
",",
"error",
",",
"nodeId",
")",
",",
"cur",
")",
"=",
"relative_unpack",
"(",
"'>ihi'",
",",
"data",
",",
"0",
")",
"(",
"host",
",",
"cur",
")... | Decode bytes to a kafka.structs.ConsumerMetadataResponse
Arguments:
data: bytes to decode | [
"Decode",
"bytes",
"to",
"a",
"kafka",
".",
"structs",
".",
"ConsumerMetadataResponse"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/legacy.py#L322-L333 | train | Decodes bytes to a kafka. structs. ConsumerMetadataResponse object | 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/legacy.py | KafkaProtocol.encode_offset_commit_request | def encode_offset_commit_request(cls, group, payloads):
"""
Encode an OffsetCommitRequest struct
Arguments:
group: string, the consumer group you are committing offsets for
payloads: list of OffsetCommitRequestPayload
"""
return kafka.protocol.commit.Offs... | python | def encode_offset_commit_request(cls, group, payloads):
"""
Encode an OffsetCommitRequest struct
Arguments:
group: string, the consumer group you are committing offsets for
payloads: list of OffsetCommitRequestPayload
"""
return kafka.protocol.commit.Offs... | [
"def",
"encode_offset_commit_request",
"(",
"cls",
",",
"group",
",",
"payloads",
")",
":",
"return",
"kafka",
".",
"protocol",
".",
"commit",
".",
"OffsetCommitRequest",
"[",
"0",
"]",
"(",
"consumer_group",
"=",
"group",
",",
"topics",
"=",
"[",
"(",
"to... | Encode an OffsetCommitRequest struct
Arguments:
group: string, the consumer group you are committing offsets for
payloads: list of OffsetCommitRequestPayload | [
"Encode",
"an",
"OffsetCommitRequest",
"struct"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/legacy.py#L336-L353 | train | Encode an OffsetCommitRequest struct that is used to commit the offsets for the specified 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/protocol/legacy.py | KafkaProtocol.decode_offset_commit_response | def decode_offset_commit_response(cls, response):
"""
Decode OffsetCommitResponse to an OffsetCommitResponsePayload
Arguments:
response: OffsetCommitResponse
"""
return [
kafka.structs.OffsetCommitResponsePayload(topic, partition, error)
for t... | python | def decode_offset_commit_response(cls, response):
"""
Decode OffsetCommitResponse to an OffsetCommitResponsePayload
Arguments:
response: OffsetCommitResponse
"""
return [
kafka.structs.OffsetCommitResponsePayload(topic, partition, error)
for t... | [
"def",
"decode_offset_commit_response",
"(",
"cls",
",",
"response",
")",
":",
"return",
"[",
"kafka",
".",
"structs",
".",
"OffsetCommitResponsePayload",
"(",
"topic",
",",
"partition",
",",
"error",
")",
"for",
"topic",
",",
"partitions",
"in",
"response",
"... | Decode OffsetCommitResponse to an OffsetCommitResponsePayload
Arguments:
response: OffsetCommitResponse | [
"Decode",
"OffsetCommitResponse",
"to",
"an",
"OffsetCommitResponsePayload"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/legacy.py#L356-L367 | train | Decodes an OffsetCommitResponse to an OffsetCommitResponsePayload | 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/legacy.py | KafkaProtocol.encode_offset_fetch_request | def encode_offset_fetch_request(cls, group, payloads, from_kafka=False):
"""
Encode an OffsetFetchRequest struct. The request is encoded using
version 0 if from_kafka is false, indicating a request for Zookeeper
offsets. It is encoded using version 1 otherwise, indicating a request
... | python | def encode_offset_fetch_request(cls, group, payloads, from_kafka=False):
"""
Encode an OffsetFetchRequest struct. The request is encoded using
version 0 if from_kafka is false, indicating a request for Zookeeper
offsets. It is encoded using version 1 otherwise, indicating a request
... | [
"def",
"encode_offset_fetch_request",
"(",
"cls",
",",
"group",
",",
"payloads",
",",
"from_kafka",
"=",
"False",
")",
":",
"version",
"=",
"1",
"if",
"from_kafka",
"else",
"0",
"return",
"kafka",
".",
"protocol",
".",
"commit",
".",
"OffsetFetchRequest",
"[... | Encode an OffsetFetchRequest struct. The request is encoded using
version 0 if from_kafka is false, indicating a request for Zookeeper
offsets. It is encoded using version 1 otherwise, indicating a request
for Kafka offsets.
Arguments:
group: string, the consumer group you a... | [
"Encode",
"an",
"OffsetFetchRequest",
"struct",
".",
"The",
"request",
"is",
"encoded",
"using",
"version",
"0",
"if",
"from_kafka",
"is",
"false",
"indicating",
"a",
"request",
"for",
"Zookeeper",
"offsets",
".",
"It",
"is",
"encoded",
"using",
"version",
"1"... | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/legacy.py#L370-L388 | train | Encode an OffsetFetchRequest struct. | 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/legacy.py | KafkaProtocol.decode_offset_fetch_response | def decode_offset_fetch_response(cls, response):
"""
Decode OffsetFetchResponse to OffsetFetchResponsePayloads
Arguments:
response: OffsetFetchResponse
"""
return [
kafka.structs.OffsetFetchResponsePayload(
topic, partition, offset, metada... | python | def decode_offset_fetch_response(cls, response):
"""
Decode OffsetFetchResponse to OffsetFetchResponsePayloads
Arguments:
response: OffsetFetchResponse
"""
return [
kafka.structs.OffsetFetchResponsePayload(
topic, partition, offset, metada... | [
"def",
"decode_offset_fetch_response",
"(",
"cls",
",",
"response",
")",
":",
"return",
"[",
"kafka",
".",
"structs",
".",
"OffsetFetchResponsePayload",
"(",
"topic",
",",
"partition",
",",
"offset",
",",
"metadata",
",",
"error",
")",
"for",
"topic",
",",
"... | Decode OffsetFetchResponse to OffsetFetchResponsePayloads
Arguments:
response: OffsetFetchResponse | [
"Decode",
"OffsetFetchResponse",
"to",
"OffsetFetchResponsePayloads"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/protocol/legacy.py#L391-L404 | train | Decode OffsetFetchResponse to OffsetFetchResponsePayloads
| 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/vendor/selectors34.py | _BaseSelectorImpl._fileobj_lookup | def _fileobj_lookup(self, fileobj):
"""Return a file descriptor from a file object.
This wraps _fileobj_to_fd() to do an exhaustive search in case
the object is invalid but we still have it in our map. This
is used by unregister() so we can unregister an object that
was previou... | python | def _fileobj_lookup(self, fileobj):
"""Return a file descriptor from a file object.
This wraps _fileobj_to_fd() to do an exhaustive search in case
the object is invalid but we still have it in our map. This
is used by unregister() so we can unregister an object that
was previou... | [
"def",
"_fileobj_lookup",
"(",
"self",
",",
"fileobj",
")",
":",
"try",
":",
"return",
"_fileobj_to_fd",
"(",
"fileobj",
")",
"except",
"ValueError",
":",
"# Do an exhaustive search.",
"for",
"key",
"in",
"self",
".",
"_fd_to_key",
".",
"values",
"(",
")",
"... | Return a file descriptor from a file object.
This wraps _fileobj_to_fd() to do an exhaustive search in case
the object is invalid but we still have it in our map. This
is used by unregister() so we can unregister an object that
was previously registered even if it is closed. It is als... | [
"Return",
"a",
"file",
"descriptor",
"from",
"a",
"file",
"object",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/vendor/selectors34.py#L233-L250 | train | Return a file descriptor from a file object. | 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/sensor.py | Sensor._check_forest | def _check_forest(self, sensors):
"""Validate that this sensor doesn't end up referencing itself."""
if self in sensors:
raise ValueError('Circular dependency in sensors: %s is its own'
'parent.' % (self.name,))
sensors.add(self)
for parent in sel... | python | def _check_forest(self, sensors):
"""Validate that this sensor doesn't end up referencing itself."""
if self in sensors:
raise ValueError('Circular dependency in sensors: %s is its own'
'parent.' % (self.name,))
sensors.add(self)
for parent in sel... | [
"def",
"_check_forest",
"(",
"self",
",",
"sensors",
")",
":",
"if",
"self",
"in",
"sensors",
":",
"raise",
"ValueError",
"(",
"'Circular dependency in sensors: %s is its own'",
"'parent.'",
"%",
"(",
"self",
".",
"name",
",",
")",
")",
"sensors",
".",
"add",
... | Validate that this sensor doesn't end up referencing itself. | [
"Validate",
"that",
"this",
"sensor",
"doesn",
"t",
"end",
"up",
"referencing",
"itself",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/stats/sensor.py#L34-L41 | train | Validate that this sensor doesn t end up referencing itself. | 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/sensor.py | Sensor.record | def record(self, value=1.0, time_ms=None):
"""
Record a value at a known time.
Arguments:
value (double): The value we are recording
time_ms (int): A POSIX timestamp in milliseconds.
Default: The time when record() is evaluated (now)
Raises:
... | python | def record(self, value=1.0, time_ms=None):
"""
Record a value at a known time.
Arguments:
value (double): The value we are recording
time_ms (int): A POSIX timestamp in milliseconds.
Default: The time when record() is evaluated (now)
Raises:
... | [
"def",
"record",
"(",
"self",
",",
"value",
"=",
"1.0",
",",
"time_ms",
"=",
"None",
")",
":",
"if",
"time_ms",
"is",
"None",
":",
"time_ms",
"=",
"time",
".",
"time",
"(",
")",
"*",
"1000",
"self",
".",
"_last_record_time",
"=",
"time_ms",
"with",
... | Record a value at a known time.
Arguments:
value (double): The value we are recording
time_ms (int): A POSIX timestamp in milliseconds.
Default: The time when record() is evaluated (now)
Raises:
QuotaViolationException: if recording this value moves a... | [
"Record",
"a",
"value",
"at",
"a",
"known",
"time",
".",
"Arguments",
":",
"value",
"(",
"double",
")",
":",
"The",
"value",
"we",
"are",
"recording",
"time_ms",
"(",
"int",
")",
":",
"A",
"POSIX",
"timestamp",
"in",
"milliseconds",
".",
"Default",
":"... | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/stats/sensor.py#L55-L76 | train | Record a value at a known 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/stats/sensor.py | Sensor._check_quotas | def _check_quotas(self, time_ms):
"""
Check if we have violated our quota for any metric that
has a configured quota
"""
for metric in self._metrics:
if metric.config and metric.config.quota:
value = metric.value(time_ms)
if not metric.... | python | def _check_quotas(self, time_ms):
"""
Check if we have violated our quota for any metric that
has a configured quota
"""
for metric in self._metrics:
if metric.config and metric.config.quota:
value = metric.value(time_ms)
if not metric.... | [
"def",
"_check_quotas",
"(",
"self",
",",
"time_ms",
")",
":",
"for",
"metric",
"in",
"self",
".",
"_metrics",
":",
"if",
"metric",
".",
"config",
"and",
"metric",
".",
"config",
".",
"quota",
":",
"value",
"=",
"metric",
".",
"value",
"(",
"time_ms",
... | Check if we have violated our quota for any metric that
has a configured quota | [
"Check",
"if",
"we",
"have",
"violated",
"our",
"quota",
"for",
"any",
"metric",
"that",
"has",
"a",
"configured",
"quota"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/stats/sensor.py#L78-L91 | train | Check if we have violated our quota for any of the metrics that have a configured quota. | 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/sensor.py | Sensor.add_compound | def add_compound(self, compound_stat, config=None):
"""
Register a compound statistic with this sensor which
yields multiple measurable quantities (like a histogram)
Arguments:
stat (AbstractCompoundStat): The stat to register
config (MetricConfig): The configura... | python | def add_compound(self, compound_stat, config=None):
"""
Register a compound statistic with this sensor which
yields multiple measurable quantities (like a histogram)
Arguments:
stat (AbstractCompoundStat): The stat to register
config (MetricConfig): The configura... | [
"def",
"add_compound",
"(",
"self",
",",
"compound_stat",
",",
"config",
"=",
"None",
")",
":",
"if",
"not",
"compound_stat",
":",
"raise",
"ValueError",
"(",
"'compound stat must be non-empty'",
")",
"self",
".",
"_stats",
".",
"append",
"(",
"compound_stat",
... | Register a compound statistic with this sensor which
yields multiple measurable quantities (like a histogram)
Arguments:
stat (AbstractCompoundStat): The stat to register
config (MetricConfig): The configuration for this stat.
If None then the stat will use the d... | [
"Register",
"a",
"compound",
"statistic",
"with",
"this",
"sensor",
"which",
"yields",
"multiple",
"measurable",
"quantities",
"(",
"like",
"a",
"histogram",
")"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/stats/sensor.py#L93-L111 | train | Adds a compound stat to this sensor which is a list of measurable quantities. | 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/sensor.py | Sensor.add | def add(self, metric_name, stat, config=None):
"""
Register a metric with this sensor
Arguments:
metric_name (MetricName): The name of the metric
stat (AbstractMeasurableStat): The statistic to keep
config (MetricConfig): A special configuration for this metr... | python | def add(self, metric_name, stat, config=None):
"""
Register a metric with this sensor
Arguments:
metric_name (MetricName): The name of the metric
stat (AbstractMeasurableStat): The statistic to keep
config (MetricConfig): A special configuration for this metr... | [
"def",
"add",
"(",
"self",
",",
"metric_name",
",",
"stat",
",",
"config",
"=",
"None",
")",
":",
"with",
"self",
".",
"_lock",
":",
"metric",
"=",
"KafkaMetric",
"(",
"metric_name",
",",
"stat",
",",
"config",
"or",
"self",
".",
"_config",
")",
"sel... | Register a metric with this sensor
Arguments:
metric_name (MetricName): The name of the metric
stat (AbstractMeasurableStat): The statistic to keep
config (MetricConfig): A special configuration for this metric.
If None use the sensor default configuration. | [
"Register",
"a",
"metric",
"with",
"this",
"sensor"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/stats/sensor.py#L113-L127 | train | Add a metric to the registry. | 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/consumer.py | ConsumerCoordinator.group_protocols | def group_protocols(self):
"""Returns list of preferred (protocols, metadata)"""
if self._subscription.subscription is None:
raise Errors.IllegalStateError('Consumer has not subscribed to topics')
# dpkp note: I really dislike this.
# why? because we are using this strange me... | python | def group_protocols(self):
"""Returns list of preferred (protocols, metadata)"""
if self._subscription.subscription is None:
raise Errors.IllegalStateError('Consumer has not subscribed to topics')
# dpkp note: I really dislike this.
# why? because we are using this strange me... | [
"def",
"group_protocols",
"(",
"self",
")",
":",
"if",
"self",
".",
"_subscription",
".",
"subscription",
"is",
"None",
":",
"raise",
"Errors",
".",
"IllegalStateError",
"(",
"'Consumer has not subscribed to topics'",
")",
"# dpkp note: I really dislike this.",
"# why? ... | Returns list of preferred (protocols, metadata) | [
"Returns",
"list",
"of",
"preferred",
"(",
"protocols",
"metadata",
")"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/coordinator/consumer.py#L136-L156 | train | Returns list of preferred ( protocols metadata ) for all available assignors. | 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/consumer.py | ConsumerCoordinator.poll | def poll(self):
"""
Poll for coordinator events. Only applicable if group_id is set, and
broker version supports GroupCoordinators. This ensures that the
coordinator is known, and if using automatic partition assignment,
ensures that the consumer has joined the group. This also h... | python | def poll(self):
"""
Poll for coordinator events. Only applicable if group_id is set, and
broker version supports GroupCoordinators. This ensures that the
coordinator is known, and if using automatic partition assignment,
ensures that the consumer has joined the group. This also h... | [
"def",
"poll",
"(",
"self",
")",
":",
"if",
"self",
".",
"group_id",
"is",
"None",
"or",
"self",
".",
"config",
"[",
"'api_version'",
"]",
"<",
"(",
"0",
",",
"8",
",",
"2",
")",
":",
"return",
"self",
".",
"_invoke_completed_offset_commit_callbacks",
... | Poll for coordinator events. Only applicable if group_id is set, and
broker version supports GroupCoordinators. This ensures that the
coordinator is known, and if using automatic partition assignment,
ensures that the consumer has joined the group. This also handles
periodic offset commi... | [
"Poll",
"for",
"coordinator",
"events",
".",
"Only",
"applicable",
"if",
"group_id",
"is",
"set",
"and",
"broker",
"version",
"supports",
"GroupCoordinators",
".",
"This",
"ensures",
"that",
"the",
"coordinator",
"is",
"known",
"and",
"if",
"using",
"automatic",... | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/coordinator/consumer.py#L251-L286 | train | Poll for coordinator events. Only applicable if group_id is set and broker version supports GroupCoordinators. | 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/consumer.py | ConsumerCoordinator.time_to_next_poll | def time_to_next_poll(self):
"""Return seconds (float) remaining until :meth:`.poll` should be called again"""
if not self.config['enable_auto_commit']:
return self.time_to_next_heartbeat()
if time.time() > self.next_auto_commit_deadline:
return 0
return min(sel... | python | def time_to_next_poll(self):
"""Return seconds (float) remaining until :meth:`.poll` should be called again"""
if not self.config['enable_auto_commit']:
return self.time_to_next_heartbeat()
if time.time() > self.next_auto_commit_deadline:
return 0
return min(sel... | [
"def",
"time_to_next_poll",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"config",
"[",
"'enable_auto_commit'",
"]",
":",
"return",
"self",
".",
"time_to_next_heartbeat",
"(",
")",
"if",
"time",
".",
"time",
"(",
")",
">",
"self",
".",
"next_auto_commi... | Return seconds (float) remaining until :meth:`.poll` should be called again | [
"Return",
"seconds",
"(",
"float",
")",
"remaining",
"until",
":",
"meth",
":",
".",
"poll",
"should",
"be",
"called",
"again"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/coordinator/consumer.py#L288-L297 | train | Return seconds remaining until the next poll should be called again | 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/consumer.py | ConsumerCoordinator.need_rejoin | def need_rejoin(self):
"""Check whether the group should be rejoined
Returns:
bool: True if consumer should rejoin group, False otherwise
"""
if not self._subscription.partitions_auto_assigned():
return False
if self._auto_assign_all_partitions():
... | python | def need_rejoin(self):
"""Check whether the group should be rejoined
Returns:
bool: True if consumer should rejoin group, False otherwise
"""
if not self._subscription.partitions_auto_assigned():
return False
if self._auto_assign_all_partitions():
... | [
"def",
"need_rejoin",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_subscription",
".",
"partitions_auto_assigned",
"(",
")",
":",
"return",
"False",
"if",
"self",
".",
"_auto_assign_all_partitions",
"(",
")",
":",
"return",
"False",
"# we need to rejoin if... | Check whether the group should be rejoined
Returns:
bool: True if consumer should rejoin group, False otherwise | [
"Check",
"whether",
"the",
"group",
"should",
"be",
"rejoined"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/coordinator/consumer.py#L355-L377 | train | Check whether the consumer should rejoin 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/coordinator/consumer.py | ConsumerCoordinator.refresh_committed_offsets_if_needed | def refresh_committed_offsets_if_needed(self):
"""Fetch committed offsets for assigned partitions."""
if self._subscription.needs_fetch_committed_offsets:
offsets = self.fetch_committed_offsets(self._subscription.assigned_partitions())
for partition, offset in six.iteritems(offse... | python | def refresh_committed_offsets_if_needed(self):
"""Fetch committed offsets for assigned partitions."""
if self._subscription.needs_fetch_committed_offsets:
offsets = self.fetch_committed_offsets(self._subscription.assigned_partitions())
for partition, offset in six.iteritems(offse... | [
"def",
"refresh_committed_offsets_if_needed",
"(",
"self",
")",
":",
"if",
"self",
".",
"_subscription",
".",
"needs_fetch_committed_offsets",
":",
"offsets",
"=",
"self",
".",
"fetch_committed_offsets",
"(",
"self",
".",
"_subscription",
".",
"assigned_partitions",
"... | Fetch committed offsets for assigned partitions. | [
"Fetch",
"committed",
"offsets",
"for",
"assigned",
"partitions",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/coordinator/consumer.py#L379-L387 | train | Fetch committed offsets for 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/coordinator/consumer.py | ConsumerCoordinator.fetch_committed_offsets | def fetch_committed_offsets(self, partitions):
"""Fetch the current committed offsets for specified partitions
Arguments:
partitions (list of TopicPartition): partitions to fetch
Returns:
dict: {TopicPartition: OffsetAndMetadata}
"""
if not partitions:
... | python | def fetch_committed_offsets(self, partitions):
"""Fetch the current committed offsets for specified partitions
Arguments:
partitions (list of TopicPartition): partitions to fetch
Returns:
dict: {TopicPartition: OffsetAndMetadata}
"""
if not partitions:
... | [
"def",
"fetch_committed_offsets",
"(",
"self",
",",
"partitions",
")",
":",
"if",
"not",
"partitions",
":",
"return",
"{",
"}",
"while",
"True",
":",
"self",
".",
"ensure_coordinator_ready",
"(",
")",
"# contact coordinator to fetch committed offsets",
"future",
"="... | Fetch the current committed offsets for specified partitions
Arguments:
partitions (list of TopicPartition): partitions to fetch
Returns:
dict: {TopicPartition: OffsetAndMetadata} | [
"Fetch",
"the",
"current",
"committed",
"offsets",
"for",
"specified",
"partitions"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/coordinator/consumer.py#L389-L414 | train | Fetch the current committed offsets for the specified 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/coordinator/consumer.py | ConsumerCoordinator.close | def close(self, autocommit=True):
"""Close the coordinator, leave the current group,
and reset local generation / member_id.
Keyword Arguments:
autocommit (bool): If auto-commit is configured for this consumer,
this optional flag causes the consumer to attempt to com... | python | def close(self, autocommit=True):
"""Close the coordinator, leave the current group,
and reset local generation / member_id.
Keyword Arguments:
autocommit (bool): If auto-commit is configured for this consumer,
this optional flag causes the consumer to attempt to com... | [
"def",
"close",
"(",
"self",
",",
"autocommit",
"=",
"True",
")",
":",
"try",
":",
"if",
"autocommit",
":",
"self",
".",
"_maybe_auto_commit_offsets_sync",
"(",
")",
"finally",
":",
"super",
"(",
"ConsumerCoordinator",
",",
"self",
")",
".",
"close",
"(",
... | Close the coordinator, leave the current group,
and reset local generation / member_id.
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 offs... | [
"Close",
"the",
"coordinator",
"leave",
"the",
"current",
"group",
"and",
"reset",
"local",
"generation",
"/",
"member_id",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/coordinator/consumer.py#L416-L429 | train | Closes the coordinator and resets local generation and member_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/coordinator/consumer.py | ConsumerCoordinator.commit_offsets_async | def commit_offsets_async(self, offsets, callback=None):
"""Commit specific offsets asynchronously.
Arguments:
offsets (dict {TopicPartition: OffsetAndMetadata}): what to commit
callback (callable, optional): called as callback(offsets, response)
response will be ... | python | def commit_offsets_async(self, offsets, callback=None):
"""Commit specific offsets asynchronously.
Arguments:
offsets (dict {TopicPartition: OffsetAndMetadata}): what to commit
callback (callable, optional): called as callback(offsets, response)
response will be ... | [
"def",
"commit_offsets_async",
"(",
"self",
",",
"offsets",
",",
"callback",
"=",
"None",
")",
":",
"self",
".",
"_invoke_completed_offset_commit_callbacks",
"(",
")",
"if",
"not",
"self",
".",
"coordinator_unknown",
"(",
")",
":",
"future",
"=",
"self",
".",
... | Commit specific offsets asynchronously.
Arguments:
offsets (dict {TopicPartition: OffsetAndMetadata}): what to commit
callback (callable, optional): called as callback(offsets, response)
response will be either an Exception or a OffsetCommitResponse
struc... | [
"Commit",
"specific",
"offsets",
"asynchronously",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/coordinator/consumer.py#L436-L471 | train | Commits specific offsets 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/coordinator/consumer.py | ConsumerCoordinator.commit_offsets_sync | def commit_offsets_sync(self, offsets):
"""Commit specific offsets synchronously.
This method will retry until the commit completes successfully or an
unrecoverable error is encountered.
Arguments:
offsets (dict {TopicPartition: OffsetAndMetadata}): what to commit
... | python | def commit_offsets_sync(self, offsets):
"""Commit specific offsets synchronously.
This method will retry until the commit completes successfully or an
unrecoverable error is encountered.
Arguments:
offsets (dict {TopicPartition: OffsetAndMetadata}): what to commit
... | [
"def",
"commit_offsets_sync",
"(",
"self",
",",
"offsets",
")",
":",
"assert",
"self",
".",
"config",
"[",
"'api_version'",
"]",
">=",
"(",
"0",
",",
"8",
",",
"1",
")",
",",
"'Unsupported Broker API'",
"assert",
"all",
"(",
"map",
"(",
"lambda",
"k",
... | Commit specific offsets synchronously.
This method will retry until the commit completes successfully or an
unrecoverable error is encountered.
Arguments:
offsets (dict {TopicPartition: OffsetAndMetadata}): what to commit
Raises error on failure | [
"Commit",
"specific",
"offsets",
"synchronously",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/coordinator/consumer.py#L485-L516 | train | Commit specific offsets synchronously. | 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/consumer.py | ConsumerCoordinator._send_offset_commit_request | def _send_offset_commit_request(self, offsets):
"""Commit offsets for the specified list of topics and partitions.
This is a non-blocking call which returns a request future that can be
polled in the case of a synchronous commit or ignored in the
asynchronous case.
Arguments:
... | python | def _send_offset_commit_request(self, offsets):
"""Commit offsets for the specified list of topics and partitions.
This is a non-blocking call which returns a request future that can be
polled in the case of a synchronous commit or ignored in the
asynchronous case.
Arguments:
... | [
"def",
"_send_offset_commit_request",
"(",
"self",
",",
"offsets",
")",
":",
"assert",
"self",
".",
"config",
"[",
"'api_version'",
"]",
">=",
"(",
"0",
",",
"8",
",",
"1",
")",
",",
"'Unsupported Broker API'",
"assert",
"all",
"(",
"map",
"(",
"lambda",
... | Commit offsets for the specified list of topics and partitions.
This is a non-blocking call which returns a request future that can be
polled in the case of a synchronous commit or ignored in the
asynchronous case.
Arguments:
offsets (dict of {TopicPartition: OffsetAndMetad... | [
"Commit",
"offsets",
"for",
"the",
"specified",
"list",
"of",
"topics",
"and",
"partitions",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/coordinator/consumer.py#L535-L623 | train | This method is used to send the offset commit request 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/coordinator/consumer.py | ConsumerCoordinator._send_offset_fetch_request | def _send_offset_fetch_request(self, partitions):
"""Fetch the committed offsets for a set of partitions.
This is a non-blocking call. The returned future can be polled to get
the actual offsets returned from the broker.
Arguments:
partitions (list of TopicPartition): the p... | python | def _send_offset_fetch_request(self, partitions):
"""Fetch the committed offsets for a set of partitions.
This is a non-blocking call. The returned future can be polled to get
the actual offsets returned from the broker.
Arguments:
partitions (list of TopicPartition): the p... | [
"def",
"_send_offset_fetch_request",
"(",
"self",
",",
"partitions",
")",
":",
"assert",
"self",
".",
"config",
"[",
"'api_version'",
"]",
">=",
"(",
"0",
",",
"8",
",",
"1",
")",
",",
"'Unsupported Broker API'",
"assert",
"all",
"(",
"map",
"(",
"lambda",... | Fetch the committed offsets for a set of partitions.
This is a non-blocking call. The returned future can be polled to get
the actual offsets returned from the broker.
Arguments:
partitions (list of TopicPartition): the partitions to fetch
Returns:
Future: reso... | [
"Fetch",
"the",
"committed",
"offsets",
"for",
"a",
"set",
"of",
"partitions",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/coordinator/consumer.py#L693-L743 | train | Send an OffsetFetchRequest 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/consumer/subscription_state.py | SubscriptionState.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",
")",
":",
"if",
"self",
".",
"_user_assignment",
"or",
"(",
"topics",
"and",
"pattern",
")",
":",
"raise",
"IllegalStateError",
"(... | 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 assign_from_user()
... | [
"Subscribe",
"to",
"a",
"list",
"of",
"topics",
"or",
"a",
"topic",
"regex",
"pattern",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/subscription_state.py#L76-L124 | train | Subscribe to a list of topics or a 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/subscription_state.py | SubscriptionState._ensure_valid_topic_name | def _ensure_valid_topic_name(self, topic):
""" Ensures that the topic name is valid according to the kafka source. """
# See Kafka Source:
# https://github.com/apache/kafka/blob/39eb31feaeebfb184d98cc5d94da9148c2319d81/clients/src/main/java/org/apache/kafka/common/internals/Topic.java
i... | python | def _ensure_valid_topic_name(self, topic):
""" Ensures that the topic name is valid according to the kafka source. """
# See Kafka Source:
# https://github.com/apache/kafka/blob/39eb31feaeebfb184d98cc5d94da9148c2319d81/clients/src/main/java/org/apache/kafka/common/internals/Topic.java
i... | [
"def",
"_ensure_valid_topic_name",
"(",
"self",
",",
"topic",
")",
":",
"# See Kafka Source:",
"# https://github.com/apache/kafka/blob/39eb31feaeebfb184d98cc5d94da9148c2319d81/clients/src/main/java/org/apache/kafka/common/internals/Topic.java",
"if",
"topic",
"is",
"None",
":",
"raise"... | Ensures that the topic name is valid according to the kafka source. | [
"Ensures",
"that",
"the",
"topic",
"name",
"is",
"valid",
"according",
"to",
"the",
"kafka",
"source",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/subscription_state.py#L126-L142 | train | Ensures that the topic name is valid according to the kafka source. | 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/subscription_state.py | SubscriptionState.change_subscription | def change_subscription(self, topics):
"""Change the topic subscription.
Arguments:
topics (list of str): topics for subscription
Raises:
IllegalStateErrror: if assign_from_user has been used already
TypeError: if a topic is None or a non-str
Val... | python | def change_subscription(self, topics):
"""Change the topic subscription.
Arguments:
topics (list of str): topics for subscription
Raises:
IllegalStateErrror: if assign_from_user has been used already
TypeError: if a topic is None or a non-str
Val... | [
"def",
"change_subscription",
"(",
"self",
",",
"topics",
")",
":",
"if",
"self",
".",
"_user_assignment",
":",
"raise",
"IllegalStateError",
"(",
"self",
".",
"_SUBSCRIPTION_EXCEPTION_MESSAGE",
")",
"if",
"isinstance",
"(",
"topics",
",",
"six",
".",
"string_ty... | Change the topic subscription.
Arguments:
topics (list of str): topics for subscription
Raises:
IllegalStateErrror: if assign_from_user has been used already
TypeError: if a topic is None or a non-str
ValueError: if a topic is an empty string or
... | [
"Change",
"the",
"topic",
"subscription",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/subscription_state.py#L144-L178 | train | Change the topic subscription. | 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/subscription_state.py | SubscriptionState.group_subscribe | def group_subscribe(self, topics):
"""Add topics to the current group subscription.
This is used by the group leader to ensure that it receives metadata
updates for all topics that any member of the group is subscribed to.
Arguments:
topics (list of str): topics to add to t... | python | def group_subscribe(self, topics):
"""Add topics to the current group subscription.
This is used by the group leader to ensure that it receives metadata
updates for all topics that any member of the group is subscribed to.
Arguments:
topics (list of str): topics to add to t... | [
"def",
"group_subscribe",
"(",
"self",
",",
"topics",
")",
":",
"if",
"self",
".",
"_user_assignment",
":",
"raise",
"IllegalStateError",
"(",
"self",
".",
"_SUBSCRIPTION_EXCEPTION_MESSAGE",
")",
"self",
".",
"_group_subscription",
".",
"update",
"(",
"topics",
... | Add topics to the current group subscription.
This is used by the group leader to ensure that it receives metadata
updates for all topics that any member of the group is subscribed to.
Arguments:
topics (list of str): topics to add to the group subscription | [
"Add",
"topics",
"to",
"the",
"current",
"group",
"subscription",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/subscription_state.py#L180-L191 | train | Add topics to the current group subscription. | 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/subscription_state.py | SubscriptionState.reset_group_subscription | def reset_group_subscription(self):
"""Reset the group's subscription to only contain topics subscribed by this consumer."""
if self._user_assignment:
raise IllegalStateError(self._SUBSCRIPTION_EXCEPTION_MESSAGE)
assert self.subscription is not None, 'Subscription required'
s... | python | def reset_group_subscription(self):
"""Reset the group's subscription to only contain topics subscribed by this consumer."""
if self._user_assignment:
raise IllegalStateError(self._SUBSCRIPTION_EXCEPTION_MESSAGE)
assert self.subscription is not None, 'Subscription required'
s... | [
"def",
"reset_group_subscription",
"(",
"self",
")",
":",
"if",
"self",
".",
"_user_assignment",
":",
"raise",
"IllegalStateError",
"(",
"self",
".",
"_SUBSCRIPTION_EXCEPTION_MESSAGE",
")",
"assert",
"self",
".",
"subscription",
"is",
"not",
"None",
",",
"'Subscri... | Reset the group's subscription to only contain topics subscribed by this consumer. | [
"Reset",
"the",
"group",
"s",
"subscription",
"to",
"only",
"contain",
"topics",
"subscribed",
"by",
"this",
"consumer",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/subscription_state.py#L193-L198 | train | Reset the group s subscription to only contain topics subscribed by 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/subscription_state.py | SubscriptionState.assign_from_user | def assign_from_user(self, partitions):
"""Manually assign a list of TopicPartitions to this consumer.
This interface does not allow for incremental assignment and will
replace the previous assignment (if there was one).
Manual topic assignment through this method does not use the cons... | python | def assign_from_user(self, partitions):
"""Manually assign a list of TopicPartitions to this consumer.
This interface does not allow for incremental assignment and will
replace the previous assignment (if there was one).
Manual topic assignment through this method does not use the cons... | [
"def",
"assign_from_user",
"(",
"self",
",",
"partitions",
")",
":",
"if",
"self",
".",
"subscription",
"is",
"not",
"None",
":",
"raise",
"IllegalStateError",
"(",
"self",
".",
"_SUBSCRIPTION_EXCEPTION_MESSAGE",
")",
"if",
"self",
".",
"_user_assignment",
"!=",... | Manually assign a list of TopicPartitions to this consumer.
This interface does not allow for incremental assignment and will
replace the previous assignment (if there was one).
Manual topic assignment through this method does not use the consumer's
group management functionality. As s... | [
"Manually",
"assign",
"a",
"list",
"of",
"TopicPartitions",
"to",
"this",
"consumer",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/subscription_state.py#L200-L231 | train | 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/subscription_state.py | SubscriptionState.assign_from_subscribed | def assign_from_subscribed(self, assignments):
"""Update the assignment to the specified partitions
This method is called by the coordinator to dynamically assign
partitions based on the consumer's topic subscription. This is different
from assign_from_user() which directly sets the ass... | python | def assign_from_subscribed(self, assignments):
"""Update the assignment to the specified partitions
This method is called by the coordinator to dynamically assign
partitions based on the consumer's topic subscription. This is different
from assign_from_user() which directly sets the ass... | [
"def",
"assign_from_subscribed",
"(",
"self",
",",
"assignments",
")",
":",
"if",
"not",
"self",
".",
"partitions_auto_assigned",
"(",
")",
":",
"raise",
"IllegalStateError",
"(",
"self",
".",
"_SUBSCRIPTION_EXCEPTION_MESSAGE",
")",
"for",
"tp",
"in",
"assignments... | Update the assignment to the specified partitions
This method is called by the coordinator to dynamically assign
partitions based on the consumer's topic subscription. This is different
from assign_from_user() which directly sets the assignment from a
user-supplied TopicPartition list.
... | [
"Update",
"the",
"assignment",
"to",
"the",
"specified",
"partitions"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/subscription_state.py#L233-L257 | train | Update the assignment to the specified partitions based on the topic subscription. | 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/subscription_state.py | SubscriptionState.unsubscribe | def unsubscribe(self):
"""Clear all topic subscriptions and partition assignments"""
self.subscription = None
self._user_assignment.clear()
self.assignment.clear()
self.subscribed_pattern = None | python | def unsubscribe(self):
"""Clear all topic subscriptions and partition assignments"""
self.subscription = None
self._user_assignment.clear()
self.assignment.clear()
self.subscribed_pattern = None | [
"def",
"unsubscribe",
"(",
"self",
")",
":",
"self",
".",
"subscription",
"=",
"None",
"self",
".",
"_user_assignment",
".",
"clear",
"(",
")",
"self",
".",
"assignment",
".",
"clear",
"(",
")",
"self",
".",
"subscribed_pattern",
"=",
"None"
] | Clear all topic subscriptions and partition assignments | [
"Clear",
"all",
"topic",
"subscriptions",
"and",
"partition",
"assignments"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/subscription_state.py#L259-L264 | train | Clear all topic subscriptions and partition assignments | 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/subscription_state.py | SubscriptionState.paused_partitions | def paused_partitions(self):
"""Return current set of paused TopicPartitions."""
return set(partition for partition in self.assignment
if self.is_paused(partition)) | python | def paused_partitions(self):
"""Return current set of paused TopicPartitions."""
return set(partition for partition in self.assignment
if self.is_paused(partition)) | [
"def",
"paused_partitions",
"(",
"self",
")",
":",
"return",
"set",
"(",
"partition",
"for",
"partition",
"in",
"self",
".",
"assignment",
"if",
"self",
".",
"is_paused",
"(",
"partition",
")",
")"
] | Return current set of paused TopicPartitions. | [
"Return",
"current",
"set",
"of",
"paused",
"TopicPartitions",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/subscription_state.py#L300-L303 | train | Return current set of paused TopicPartitions. | 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/subscription_state.py | SubscriptionState.fetchable_partitions | def fetchable_partitions(self):
"""Return set of TopicPartitions that should be Fetched."""
fetchable = set()
for partition, state in six.iteritems(self.assignment):
if state.is_fetchable():
fetchable.add(partition)
return fetchable | python | def fetchable_partitions(self):
"""Return set of TopicPartitions that should be Fetched."""
fetchable = set()
for partition, state in six.iteritems(self.assignment):
if state.is_fetchable():
fetchable.add(partition)
return fetchable | [
"def",
"fetchable_partitions",
"(",
"self",
")",
":",
"fetchable",
"=",
"set",
"(",
")",
"for",
"partition",
",",
"state",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"assignment",
")",
":",
"if",
"state",
".",
"is_fetchable",
"(",
")",
":",
"fetc... | Return set of TopicPartitions that should be Fetched. | [
"Return",
"set",
"of",
"TopicPartitions",
"that",
"should",
"be",
"Fetched",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/subscription_state.py#L305-L311 | train | Return set of TopicPartitions that should be Fetched. | 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/subscription_state.py | SubscriptionState.all_consumed_offsets | def all_consumed_offsets(self):
"""Returns consumed offsets as {TopicPartition: OffsetAndMetadata}"""
all_consumed = {}
for partition, state in six.iteritems(self.assignment):
if state.has_valid_position:
all_consumed[partition] = OffsetAndMetadata(state.position, '')... | python | def all_consumed_offsets(self):
"""Returns consumed offsets as {TopicPartition: OffsetAndMetadata}"""
all_consumed = {}
for partition, state in six.iteritems(self.assignment):
if state.has_valid_position:
all_consumed[partition] = OffsetAndMetadata(state.position, '')... | [
"def",
"all_consumed_offsets",
"(",
"self",
")",
":",
"all_consumed",
"=",
"{",
"}",
"for",
"partition",
",",
"state",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"assignment",
")",
":",
"if",
"state",
".",
"has_valid_position",
":",
"all_consumed",
"... | Returns consumed offsets as {TopicPartition: OffsetAndMetadata} | [
"Returns",
"consumed",
"offsets",
"as",
"{",
"TopicPartition",
":",
"OffsetAndMetadata",
"}"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/subscription_state.py#L317-L323 | train | Returns a dict of all consumed offsets as OffsetAndMetadata | 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/subscription_state.py | SubscriptionState.need_offset_reset | def need_offset_reset(self, partition, offset_reset_strategy=None):
"""Mark partition for offset reset using specified or default strategy.
Arguments:
partition (TopicPartition): partition to mark
offset_reset_strategy (OffsetResetStrategy, optional)
"""
if offse... | python | def need_offset_reset(self, partition, offset_reset_strategy=None):
"""Mark partition for offset reset using specified or default strategy.
Arguments:
partition (TopicPartition): partition to mark
offset_reset_strategy (OffsetResetStrategy, optional)
"""
if offse... | [
"def",
"need_offset_reset",
"(",
"self",
",",
"partition",
",",
"offset_reset_strategy",
"=",
"None",
")",
":",
"if",
"offset_reset_strategy",
"is",
"None",
":",
"offset_reset_strategy",
"=",
"self",
".",
"_default_offset_reset_strategy",
"self",
".",
"assignment",
... | Mark partition for offset reset using specified or default strategy.
Arguments:
partition (TopicPartition): partition to mark
offset_reset_strategy (OffsetResetStrategy, optional) | [
"Mark",
"partition",
"for",
"offset",
"reset",
"using",
"specified",
"or",
"default",
"strategy",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/subscription_state.py#L325-L334 | train | Mark the specified topic partition for offset reset. | 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/kafka.py | KafkaProducer._cleanup_factory | def _cleanup_factory(self):
"""Build a cleanup clojure that doesn't increase our ref count"""
_self = weakref.proxy(self)
def wrapper():
try:
_self.close(timeout=0)
except (ReferenceError, AttributeError):
pass
return wrapper | python | def _cleanup_factory(self):
"""Build a cleanup clojure that doesn't increase our ref count"""
_self = weakref.proxy(self)
def wrapper():
try:
_self.close(timeout=0)
except (ReferenceError, AttributeError):
pass
return wrapper | [
"def",
"_cleanup_factory",
"(",
"self",
")",
":",
"_self",
"=",
"weakref",
".",
"proxy",
"(",
"self",
")",
"def",
"wrapper",
"(",
")",
":",
"try",
":",
"_self",
".",
"close",
"(",
"timeout",
"=",
"0",
")",
"except",
"(",
"ReferenceError",
",",
"Attri... | Build a cleanup clojure that doesn't increase our ref count | [
"Build",
"a",
"cleanup",
"clojure",
"that",
"doesn",
"t",
"increase",
"our",
"ref",
"count"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/kafka.py#L415-L423 | train | Build a cleanup clojure that doesn t increase our ref count | 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/kafka.py | KafkaProducer.close | def close(self, timeout=None):
"""Close this producer.
Arguments:
timeout (float, optional): timeout in seconds to wait for completion.
"""
# drop our atexit handler now to avoid leaks
self._unregister_cleanup()
if not hasattr(self, '_closed') or self._clos... | python | def close(self, timeout=None):
"""Close this producer.
Arguments:
timeout (float, optional): timeout in seconds to wait for completion.
"""
# drop our atexit handler now to avoid leaks
self._unregister_cleanup()
if not hasattr(self, '_closed') or self._clos... | [
"def",
"close",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"# drop our atexit handler now to avoid leaks",
"self",
".",
"_unregister_cleanup",
"(",
")",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_closed'",
")",
"or",
"self",
".",
"_closed",
":",
"... | Close this producer.
Arguments:
timeout (float, optional): timeout in seconds to wait for completion. | [
"Close",
"this",
"producer",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/kafka.py#L445-L502 | train | Closes the Kafka 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/producer/kafka.py | KafkaProducer.partitions_for | def partitions_for(self, topic):
"""Returns set of all known partitions for the topic."""
max_wait = self.config['max_block_ms'] / 1000.0
return self._wait_on_metadata(topic, max_wait) | python | def partitions_for(self, topic):
"""Returns set of all known partitions for the topic."""
max_wait = self.config['max_block_ms'] / 1000.0
return self._wait_on_metadata(topic, max_wait) | [
"def",
"partitions_for",
"(",
"self",
",",
"topic",
")",
":",
"max_wait",
"=",
"self",
".",
"config",
"[",
"'max_block_ms'",
"]",
"/",
"1000.0",
"return",
"self",
".",
"_wait_on_metadata",
"(",
"topic",
",",
"max_wait",
")"
] | Returns set of all known partitions for the topic. | [
"Returns",
"set",
"of",
"all",
"known",
"partitions",
"for",
"the",
"topic",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/kafka.py#L504-L507 | train | Returns set of all known partitions for the 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/producer/kafka.py | KafkaProducer.send | def send(self, topic, value=None, key=None, headers=None, partition=None, timestamp_ms=None):
"""Publish a message to a topic.
Arguments:
topic (str): topic where the message will be published
value (optional): message value. Must be type bytes, or be
serializabl... | python | def send(self, topic, value=None, key=None, headers=None, partition=None, timestamp_ms=None):
"""Publish a message to a topic.
Arguments:
topic (str): topic where the message will be published
value (optional): message value. Must be type bytes, or be
serializabl... | [
"def",
"send",
"(",
"self",
",",
"topic",
",",
"value",
"=",
"None",
",",
"key",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"partition",
"=",
"None",
",",
"timestamp_ms",
"=",
"None",
")",
":",
"assert",
"value",
"is",
"not",
"None",
"or",
"sel... | Publish a message to a topic.
Arguments:
topic (str): topic where the message will be published
value (optional): message value. Must be type bytes, or be
serializable to bytes via configured value_serializer. If value
is None, key is required and message... | [
"Publish",
"a",
"message",
"to",
"a",
"topic",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/kafka.py#L526-L610 | train | Publish a message to 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/producer/kafka.py | KafkaProducer.flush | def flush(self, timeout=None):
"""
Invoking this method makes all buffered records immediately available
to send (even if linger_ms is greater than 0) and blocks on the
completion of the requests associated with these records. The
post-condition of :meth:`~kafka.KafkaProducer.flu... | python | def flush(self, timeout=None):
"""
Invoking this method makes all buffered records immediately available
to send (even if linger_ms is greater than 0) and blocks on the
completion of the requests associated with these records. The
post-condition of :meth:`~kafka.KafkaProducer.flu... | [
"def",
"flush",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"\"Flushing accumulated records in producer.\"",
")",
"# trace",
"self",
".",
"_accumulator",
".",
"begin_flush",
"(",
")",
"self",
".",
"_sender",
".",
"wakeup",
"... | Invoking this method makes all buffered records immediately available
to send (even if linger_ms is greater than 0) and blocks on the
completion of the requests associated with these records. The
post-condition of :meth:`~kafka.KafkaProducer.flush` is that any
previously sent record will... | [
"Invoking",
"this",
"method",
"makes",
"all",
"buffered",
"records",
"immediately",
"available",
"to",
"send",
"(",
"even",
"if",
"linger_ms",
"is",
"greater",
"than",
"0",
")",
"and",
"blocks",
"on",
"the",
"completion",
"of",
"the",
"requests",
"associated",... | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/kafka.py#L612-L637 | train | This method flushes all buffered records from the Kafka broker to the 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/producer/kafka.py | KafkaProducer._ensure_valid_record_size | def _ensure_valid_record_size(self, size):
"""Validate that the record size isn't too large."""
if size > self.config['max_request_size']:
raise Errors.MessageSizeTooLargeError(
"The message is %d bytes when serialized which is larger than"
" the maximum reque... | python | def _ensure_valid_record_size(self, size):
"""Validate that the record size isn't too large."""
if size > self.config['max_request_size']:
raise Errors.MessageSizeTooLargeError(
"The message is %d bytes when serialized which is larger than"
" the maximum reque... | [
"def",
"_ensure_valid_record_size",
"(",
"self",
",",
"size",
")",
":",
"if",
"size",
">",
"self",
".",
"config",
"[",
"'max_request_size'",
"]",
":",
"raise",
"Errors",
".",
"MessageSizeTooLargeError",
"(",
"\"The message is %d bytes when serialized which is larger tha... | Validate that the record size isn't too large. | [
"Validate",
"that",
"the",
"record",
"size",
"isn",
"t",
"too",
"large",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/kafka.py#L639-L650 | train | Validate that the record size isn t too large. | 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/kafka.py | KafkaProducer._wait_on_metadata | def _wait_on_metadata(self, topic, max_wait):
"""
Wait for cluster metadata including partitions for the given topic to
be available.
Arguments:
topic (str): topic we want metadata for
max_wait (float): maximum time in secs for waiting on the metadata
Re... | python | def _wait_on_metadata(self, topic, max_wait):
"""
Wait for cluster metadata including partitions for the given topic to
be available.
Arguments:
topic (str): topic we want metadata for
max_wait (float): maximum time in secs for waiting on the metadata
Re... | [
"def",
"_wait_on_metadata",
"(",
"self",
",",
"topic",
",",
"max_wait",
")",
":",
"# add topic to metadata topic list if it is not there already.",
"self",
".",
"_sender",
".",
"add_topic",
"(",
"topic",
")",
"begin",
"=",
"time",
".",
"time",
"(",
")",
"elapsed",... | Wait for cluster metadata including partitions for the given topic to
be available.
Arguments:
topic (str): topic we want metadata for
max_wait (float): maximum time in secs for waiting on the metadata
Returns:
set: partition ids for the topic
Raise... | [
"Wait",
"for",
"cluster",
"metadata",
"including",
"partitions",
"for",
"the",
"given",
"topic",
"to",
"be",
"available",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/kafka.py#L652-L695 | train | Wait for the cluster metadata including partitions for the given topic to be available. | 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/kafka.py | KafkaProducer.metrics | def metrics(self, raw=False):
"""Get metrics on producer performance.
This is ported from the Java Producer, for details see:
https://kafka.apache.org/documentation/#producer_monitoring
Warning:
This is an unstable interface. It may change in future
releases wit... | python | def metrics(self, raw=False):
"""Get metrics on producer performance.
This is ported from the Java Producer, for details see:
https://kafka.apache.org/documentation/#producer_monitoring
Warning:
This is an unstable interface. It may change in future
releases wit... | [
"def",
"metrics",
"(",
"self",
",",
"raw",
"=",
"False",
")",
":",
"if",
"raw",
":",
"return",
"self",
".",
"_metrics",
".",
"metrics",
".",
"copy",
"(",
")",
"metrics",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"six",
".",
"iteritems",
"(",
"... | Get metrics on producer performance.
This is ported from the Java Producer, for details see:
https://kafka.apache.org/documentation/#producer_monitoring
Warning:
This is an unstable interface. It may change in future
releases without warning. | [
"Get",
"metrics",
"on",
"producer",
"performance",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/kafka.py#L717-L737 | train | Get metrics on producer performance. | 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/simple.py | SimpleConsumer.reset_partition_offset | def reset_partition_offset(self, partition):
"""Update offsets using auto_offset_reset policy (smallest|largest)
Arguments:
partition (int): the partition for which offsets should be updated
Returns: Updated offset on success, None on failure
"""
LATEST = -1
... | python | def reset_partition_offset(self, partition):
"""Update offsets using auto_offset_reset policy (smallest|largest)
Arguments:
partition (int): the partition for which offsets should be updated
Returns: Updated offset on success, None on failure
"""
LATEST = -1
... | [
"def",
"reset_partition_offset",
"(",
"self",
",",
"partition",
")",
":",
"LATEST",
"=",
"-",
"1",
"EARLIEST",
"=",
"-",
"2",
"if",
"self",
".",
"auto_offset_reset",
"==",
"'largest'",
":",
"reqs",
"=",
"[",
"OffsetRequestPayload",
"(",
"self",
".",
"topic... | Update offsets using auto_offset_reset policy (smallest|largest)
Arguments:
partition (int): the partition for which offsets should be updated
Returns: Updated offset on success, None on failure | [
"Update",
"offsets",
"using",
"auto_offset_reset",
"policy",
"(",
"smallest|largest",
")"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/simple.py#L149-L186 | train | Reset the offset for the specified 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/simple.py | SimpleConsumer.seek | def seek(self, offset, whence=None, partition=None):
"""
Alter the current offset in the consumer, similar to fseek
Arguments:
offset: how much to modify the offset
whence: where to modify it from, default is None
* None is an absolute offset
... | python | def seek(self, offset, whence=None, partition=None):
"""
Alter the current offset in the consumer, similar to fseek
Arguments:
offset: how much to modify the offset
whence: where to modify it from, default is None
* None is an absolute offset
... | [
"def",
"seek",
"(",
"self",
",",
"offset",
",",
"whence",
"=",
"None",
",",
"partition",
"=",
"None",
")",
":",
"if",
"whence",
"is",
"None",
":",
"# set an absolute offset",
"if",
"partition",
"is",
"None",
":",
"for",
"tmp_partition",
"in",
"self",
"."... | Alter the current offset in the consumer, similar to fseek
Arguments:
offset: how much to modify the offset
whence: where to modify it from, default is None
* None is an absolute offset
* 0 is relative to the earliest available offset (head)
... | [
"Alter",
"the",
"current",
"offset",
"in",
"the",
"consumer",
"similar",
"to",
"fseek"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/simple.py#L188-L258 | train | Seeks the consumer to the specified offset in the 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/simple.py | SimpleConsumer.get_messages | def get_messages(self, count=1, block=True, timeout=0.1):
"""
Fetch the specified number of messages
Keyword Arguments:
count: Indicates the maximum number of messages to be fetched
block: If True, the API will block till all messages are fetched.
If bloc... | python | def get_messages(self, count=1, block=True, timeout=0.1):
"""
Fetch the specified number of messages
Keyword Arguments:
count: Indicates the maximum number of messages to be fetched
block: If True, the API will block till all messages are fetched.
If bloc... | [
"def",
"get_messages",
"(",
"self",
",",
"count",
"=",
"1",
",",
"block",
"=",
"True",
",",
"timeout",
"=",
"0.1",
")",
":",
"messages",
"=",
"[",
"]",
"if",
"timeout",
"is",
"not",
"None",
":",
"timeout",
"+=",
"time",
".",
"time",
"(",
")",
"ne... | Fetch the specified number of messages
Keyword Arguments:
count: Indicates the maximum number of messages to be fetched
block: If True, the API will block till all messages are fetched.
If block is a positive integer the API will block until that
many mes... | [
"Fetch",
"the",
"specified",
"number",
"of",
"messages"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/simple.py#L260-L302 | train | Fetch the specified number of messages from the API. | 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/simple.py | SimpleConsumer._get_message | def _get_message(self, block=True, timeout=0.1, get_partition_info=None,
update_offset=True):
"""
If no messages can be fetched, returns None.
If get_partition_info is None, it defaults to self.partition_info
If get_partition_info is True, returns (partition, message... | python | def _get_message(self, block=True, timeout=0.1, get_partition_info=None,
update_offset=True):
"""
If no messages can be fetched, returns None.
If get_partition_info is None, it defaults to self.partition_info
If get_partition_info is True, returns (partition, message... | [
"def",
"_get_message",
"(",
"self",
",",
"block",
"=",
"True",
",",
"timeout",
"=",
"0.1",
",",
"get_partition_info",
"=",
"None",
",",
"update_offset",
"=",
"True",
")",
":",
"start_at",
"=",
"time",
".",
"time",
"(",
")",
"while",
"self",
".",
"queue... | If no messages can be fetched, returns None.
If get_partition_info is None, it defaults to self.partition_info
If get_partition_info is True, returns (partition, message)
If get_partition_info is False, returns message | [
"If",
"no",
"messages",
"can",
"be",
"fetched",
"returns",
"None",
".",
"If",
"get_partition_info",
"is",
"None",
"it",
"defaults",
"to",
"self",
".",
"partition_info",
"If",
"get_partition_info",
"is",
"True",
"returns",
"(",
"partition",
"message",
")",
"If"... | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/simple.py#L307-L344 | train | Get a message from the queue. | 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 | benchmarks/varint_speed.py | encode_varint_1 | def encode_varint_1(num):
""" 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:
num (int): Value to encode
Returns:
bytearray: Encoded presentation of i... | python | def encode_varint_1(num):
""" 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:
num (int): Value to encode
Returns:
bytearray: Encoded presentation of i... | [
"def",
"encode_varint_1",
"(",
"num",
")",
":",
"# Shift sign to the end of number",
"num",
"=",
"(",
"num",
"<<",
"1",
")",
"^",
"(",
"num",
">>",
"63",
")",
"# Max 10 bytes. We assert those are allocated",
"buf",
"=",
"bytearray",
"(",
"10",
")",
"for",
"i",... | 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:
num (int): Value to encode
Returns:
bytearray: Encoded presentation of integer with length from 1 to 10
... | [
"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/benchmarks/varint_speed.py#L87-L114 | 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 | benchmarks/varint_speed.py | size_of_varint_1 | def size_of_varint_1(value):
""" Number of bytes needed to encode an integer in variable-length format.
"""
value = (value << 1) ^ (value >> 63)
res = 0
while True:
res += 1
value = value >> 7
if value == 0:
break
return res | python | def size_of_varint_1(value):
""" Number of bytes needed to encode an integer in variable-length format.
"""
value = (value << 1) ^ (value >> 63)
res = 0
while True:
res += 1
value = value >> 7
if value == 0:
break
return res | [
"def",
"size_of_varint_1",
"(",
"value",
")",
":",
"value",
"=",
"(",
"value",
"<<",
"1",
")",
"^",
"(",
"value",
">>",
"63",
")",
"res",
"=",
"0",
"while",
"True",
":",
"res",
"+=",
"1",
"value",
"=",
"value",
">>",
"7",
"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/benchmarks/varint_speed.py#L262-L272 | 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 | benchmarks/varint_speed.py | size_of_varint_2 | def size_of_varint_2(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:
retur... | python | def size_of_varint_2(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:
retur... | [
"def",
"size_of_varint_2",
"(",
"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/benchmarks/varint_speed.py#L277-L299 | 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 | benchmarks/varint_speed.py | decode_varint_1 | def decode_varint_1(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 (bytes-like): any object acceptable by ``memoryview``
pos (int... | python | def decode_varint_1(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 (bytes-like): any object acceptable by ``memoryview``
pos (int... | [
"def",
"decode_varint_1",
"(",
"buffer",
",",
"pos",
"=",
"0",
")",
":",
"value",
"=",
"0",
"shift",
"=",
"0",
"memview",
"=",
"memoryview",
"(",
"buffer",
")",
"for",
"i",
"in",
"range",
"(",
"pos",
",",
"pos",
"+",
"10",
")",
":",
"try",
":",
... | 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 (bytes-like): any object acceptable by ``memoryview``
pos (int): optional position to read from
R... | [
"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/benchmarks/varint_speed.py#L322-L352 | 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/metrics/stats/sampled_stat.py | AbstractSampledStat.purge_obsolete_samples | def purge_obsolete_samples(self, config, now):
"""
Timeout any windows that have expired in the absence of any events
"""
expire_age = config.samples * config.time_window_ms
for sample in self._samples:
if now - sample.last_window_ms >= expire_age:
sam... | python | def purge_obsolete_samples(self, config, now):
"""
Timeout any windows that have expired in the absence of any events
"""
expire_age = config.samples * config.time_window_ms
for sample in self._samples:
if now - sample.last_window_ms >= expire_age:
sam... | [
"def",
"purge_obsolete_samples",
"(",
"self",
",",
"config",
",",
"now",
")",
":",
"expire_age",
"=",
"config",
".",
"samples",
"*",
"config",
".",
"time_window_ms",
"for",
"sample",
"in",
"self",
".",
"_samples",
":",
"if",
"now",
"-",
"sample",
".",
"l... | Timeout any windows that have expired in the absence of any events | [
"Timeout",
"any",
"windows",
"that",
"have",
"expired",
"in",
"the",
"absence",
"of",
"any",
"events"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/stats/sampled_stat.py#L66-L73 | train | Purge obsolete samples that have expired in the absence of any events. | 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/admin/client.py | KafkaAdminClient.close | def close(self):
"""Close the KafkaAdminClient connection to the Kafka broker."""
if not hasattr(self, '_closed') or self._closed:
log.info("KafkaAdminClient already closed.")
return
self._metrics.close()
self._client.close()
self._closed = True
l... | python | def close(self):
"""Close the KafkaAdminClient connection to the Kafka broker."""
if not hasattr(self, '_closed') or self._closed:
log.info("KafkaAdminClient already closed.")
return
self._metrics.close()
self._client.close()
self._closed = True
l... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_closed'",
")",
"or",
"self",
".",
"_closed",
":",
"log",
".",
"info",
"(",
"\"KafkaAdminClient already closed.\"",
")",
"return",
"self",
".",
"_metrics",
".",
"close",
"... | Close the KafkaAdminClient connection to the Kafka broker. | [
"Close",
"the",
"KafkaAdminClient",
"connection",
"to",
"the",
"Kafka",
"broker",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/admin/client.py#L208-L217 | train | Close the KafkaAdminClient connection to the 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/admin/client.py | KafkaAdminClient._matching_api_version | def _matching_api_version(self, operation):
"""Find the latest version of the protocol operation supported by both
this library and the broker.
This resolves to the lesser of either the latest api version this
library supports, or the max version supported by the broker.
:param... | python | def _matching_api_version(self, operation):
"""Find the latest version of the protocol operation supported by both
this library and the broker.
This resolves to the lesser of either the latest api version this
library supports, or the max version supported by the broker.
:param... | [
"def",
"_matching_api_version",
"(",
"self",
",",
"operation",
")",
":",
"version",
"=",
"min",
"(",
"len",
"(",
"operation",
")",
"-",
"1",
",",
"self",
".",
"_client",
".",
"get_api_versions",
"(",
")",
"[",
"operation",
"[",
"0",
"]",
".",
"API_KEY"... | Find the latest version of the protocol operation supported by both
this library and the broker.
This resolves to the lesser of either the latest api version this
library supports, or the max version supported by the broker.
:param operation: A list of protocol operation versions from ... | [
"Find",
"the",
"latest",
"version",
"of",
"the",
"protocol",
"operation",
"supported",
"by",
"both",
"this",
"library",
"and",
"the",
"broker",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/admin/client.py#L219-L237 | train | Find the latest version of the protocol operation supported by both this library and 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/admin/client.py | KafkaAdminClient._refresh_controller_id | def _refresh_controller_id(self):
"""Determine the Kafka cluster controller."""
version = self._matching_api_version(MetadataRequest)
if 1 <= version <= 6:
request = MetadataRequest[version]()
response = self._send_request_to_node(self._client.least_loaded_node(), request... | python | def _refresh_controller_id(self):
"""Determine the Kafka cluster controller."""
version = self._matching_api_version(MetadataRequest)
if 1 <= version <= 6:
request = MetadataRequest[version]()
response = self._send_request_to_node(self._client.least_loaded_node(), request... | [
"def",
"_refresh_controller_id",
"(",
"self",
")",
":",
"version",
"=",
"self",
".",
"_matching_api_version",
"(",
"MetadataRequest",
")",
"if",
"1",
"<=",
"version",
"<=",
"6",
":",
"request",
"=",
"MetadataRequest",
"[",
"version",
"]",
"(",
")",
"response... | Determine the Kafka cluster controller. | [
"Determine",
"the",
"Kafka",
"cluster",
"controller",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/admin/client.py#L247-L264 | train | Determine the Kafka cluster controller. | 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/admin/client.py | KafkaAdminClient._find_group_coordinator_id | def _find_group_coordinator_id(self, group_id):
"""Find the broker node_id of the coordinator of the given group.
Sends a FindCoordinatorRequest message to the cluster. Will block until
the FindCoordinatorResponse is received. Any errors are immediately
raised.
:param group_id:... | python | def _find_group_coordinator_id(self, group_id):
"""Find the broker node_id of the coordinator of the given group.
Sends a FindCoordinatorRequest message to the cluster. Will block until
the FindCoordinatorResponse is received. Any errors are immediately
raised.
:param group_id:... | [
"def",
"_find_group_coordinator_id",
"(",
"self",
",",
"group_id",
")",
":",
"# Note: Java may change how this is implemented in KAFKA-6791.",
"#",
"# TODO add support for dynamically picking version of",
"# GroupCoordinatorRequest which was renamed to FindCoordinatorRequest.",
"# When I exp... | Find the broker node_id of the coordinator of the given group.
Sends a FindCoordinatorRequest message to the cluster. Will block until
the FindCoordinatorResponse is received. Any errors are immediately
raised.
:param group_id: The consumer group ID. This is typically the group
... | [
"Find",
"the",
"broker",
"node_id",
"of",
"the",
"coordinator",
"of",
"the",
"given",
"group",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/admin/client.py#L266-L302 | train | This method finds the broker node_id of the broker that is the coordinator of the given 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/admin/client.py | KafkaAdminClient._send_request_to_node | def _send_request_to_node(self, node_id, request):
"""Send a Kafka protocol message to a specific broker.
Will block until the message result is received.
:param node_id: The broker id to which to send the message.
:param request: The message to send.
:return: The Kafka protoco... | python | def _send_request_to_node(self, node_id, request):
"""Send a Kafka protocol message to a specific broker.
Will block until the message result is received.
:param node_id: The broker id to which to send the message.
:param request: The message to send.
:return: The Kafka protoco... | [
"def",
"_send_request_to_node",
"(",
"self",
",",
"node_id",
",",
"request",
")",
":",
"while",
"not",
"self",
".",
"_client",
".",
"ready",
"(",
"node_id",
")",
":",
"# poll until the connection to broker is ready, otherwise send()",
"# will fail with NodeNotReadyError",... | Send a Kafka protocol message to a specific broker.
Will block until the message result is received.
:param node_id: The broker id to which to send the message.
:param request: The message to send.
:return: The Kafka protocol response for the message.
:exception: The exception ... | [
"Send",
"a",
"Kafka",
"protocol",
"message",
"to",
"a",
"specific",
"broker",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/admin/client.py#L304-L323 | train | Send a request to 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/admin/client.py | KafkaAdminClient._send_request_to_controller | def _send_request_to_controller(self, request):
"""Send a Kafka protocol message to the cluster controller.
Will block until the message result is received.
:param request: The message to send.
:return: The Kafka protocol response for the message.
"""
tries = 2 # in ca... | python | def _send_request_to_controller(self, request):
"""Send a Kafka protocol message to the cluster controller.
Will block until the message result is received.
:param request: The message to send.
:return: The Kafka protocol response for the message.
"""
tries = 2 # in ca... | [
"def",
"_send_request_to_controller",
"(",
"self",
",",
"request",
")",
":",
"tries",
"=",
"2",
"# in case our cached self._controller_id is outdated",
"while",
"tries",
":",
"tries",
"-=",
"1",
"response",
"=",
"self",
".",
"_send_request_to_node",
"(",
"self",
"."... | Send a Kafka protocol message to the cluster controller.
Will block until the message result is received.
:param request: The message to send.
:return: The Kafka protocol response for the message. | [
"Send",
"a",
"Kafka",
"protocol",
"message",
"to",
"the",
"cluster",
"controller",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/admin/client.py#L325-L363 | train | Send a request to the Kafka cluster controller. | 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/admin/client.py | KafkaAdminClient.create_topics | def create_topics(self, new_topics, timeout_ms=None, validate_only=False):
"""Create new topics in the cluster.
:param new_topics: A list of NewTopic objects.
:param timeout_ms: Milliseconds to wait for new topics to be created
before the broker returns.
:param validate_only... | python | def create_topics(self, new_topics, timeout_ms=None, validate_only=False):
"""Create new topics in the cluster.
:param new_topics: A list of NewTopic objects.
:param timeout_ms: Milliseconds to wait for new topics to be created
before the broker returns.
:param validate_only... | [
"def",
"create_topics",
"(",
"self",
",",
"new_topics",
",",
"timeout_ms",
"=",
"None",
",",
"validate_only",
"=",
"False",
")",
":",
"version",
"=",
"self",
".",
"_matching_api_version",
"(",
"CreateTopicsRequest",
")",
"timeout_ms",
"=",
"self",
".",
"_valid... | Create new topics in the cluster.
:param new_topics: A list of NewTopic objects.
:param timeout_ms: Milliseconds to wait for new topics to be created
before the broker returns.
:param validate_only: If True, don't actually create new topics.
Not supported by all versions... | [
"Create",
"new",
"topics",
"in",
"the",
"cluster",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/admin/client.py#L379-L412 | train | Create new topics in the 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/admin/client.py | KafkaAdminClient.delete_topics | def delete_topics(self, topics, timeout_ms=None):
"""Delete topics from the cluster.
:param topics: A list of topic name strings.
:param timeout_ms: Milliseconds to wait for topics to be deleted
before the broker returns.
:return: Appropriate version of DeleteTopicsResponse ... | python | def delete_topics(self, topics, timeout_ms=None):
"""Delete topics from the cluster.
:param topics: A list of topic name strings.
:param timeout_ms: Milliseconds to wait for topics to be deleted
before the broker returns.
:return: Appropriate version of DeleteTopicsResponse ... | [
"def",
"delete_topics",
"(",
"self",
",",
"topics",
",",
"timeout_ms",
"=",
"None",
")",
":",
"version",
"=",
"self",
".",
"_matching_api_version",
"(",
"DeleteTopicsRequest",
")",
"timeout_ms",
"=",
"self",
".",
"_validate_timeout",
"(",
"timeout_ms",
")",
"i... | Delete topics from the cluster.
:param topics: A list of topic name strings.
:param timeout_ms: Milliseconds to wait for topics to be deleted
before the broker returns.
:return: Appropriate version of DeleteTopicsResponse class. | [
"Delete",
"topics",
"from",
"the",
"cluster",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/admin/client.py#L414-L434 | train | Delete topics from 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/admin/client.py | KafkaAdminClient.describe_configs | def describe_configs(self, config_resources, include_synonyms=False):
"""Fetch configuration parameters for one or more Kafka resources.
:param config_resources: An list of ConfigResource objects.
Any keys in ConfigResource.configs dict will be used to filter the
result. Setting... | python | def describe_configs(self, config_resources, include_synonyms=False):
"""Fetch configuration parameters for one or more Kafka resources.
:param config_resources: An list of ConfigResource objects.
Any keys in ConfigResource.configs dict will be used to filter the
result. Setting... | [
"def",
"describe_configs",
"(",
"self",
",",
"config_resources",
",",
"include_synonyms",
"=",
"False",
")",
":",
"version",
"=",
"self",
".",
"_matching_api_version",
"(",
"DescribeConfigsRequest",
")",
"if",
"version",
"==",
"0",
":",
"if",
"include_synonyms",
... | Fetch configuration parameters for one or more Kafka resources.
:param config_resources: An list of ConfigResource objects.
Any keys in ConfigResource.configs dict will be used to filter the
result. Setting the configs dict to None will get all values. An
empty dict will get... | [
"Fetch",
"configuration",
"parameters",
"for",
"one",
"or",
"more",
"Kafka",
"resources",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/admin/client.py#L464-L493 | train | Fetch configuration parameters for one or more Kafka 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/admin/client.py | KafkaAdminClient.alter_configs | def alter_configs(self, config_resources):
"""Alter configuration parameters of one or more Kafka resources.
Warning:
This is currently broken for BROKER resources because those must be
sent to that specific broker, versus this always picks the
least-loaded node. See... | python | def alter_configs(self, config_resources):
"""Alter configuration parameters of one or more Kafka resources.
Warning:
This is currently broken for BROKER resources because those must be
sent to that specific broker, versus this always picks the
least-loaded node. See... | [
"def",
"alter_configs",
"(",
"self",
",",
"config_resources",
")",
":",
"version",
"=",
"self",
".",
"_matching_api_version",
"(",
"AlterConfigsRequest",
")",
"if",
"version",
"==",
"0",
":",
"request",
"=",
"AlterConfigsRequest",
"[",
"version",
"]",
"(",
"re... | Alter configuration parameters of one or more Kafka resources.
Warning:
This is currently broken for BROKER resources because those must be
sent to that specific broker, versus this always picks the
least-loaded node. See the comment in the source code for details.
... | [
"Alter",
"configuration",
"parameters",
"of",
"one",
"or",
"more",
"Kafka",
"resources",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/admin/client.py#L505-L532 | train | Send an AlterConfigs request to the broker that the broker has already set up. | 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/admin/client.py | KafkaAdminClient.create_partitions | def create_partitions(self, topic_partitions, timeout_ms=None, validate_only=False):
"""Create additional partitions for an existing topic.
:param topic_partitions: A map of topic name strings to NewPartition objects.
:param timeout_ms: Milliseconds to wait for new partitions to be
... | python | def create_partitions(self, topic_partitions, timeout_ms=None, validate_only=False):
"""Create additional partitions for an existing topic.
:param topic_partitions: A map of topic name strings to NewPartition objects.
:param timeout_ms: Milliseconds to wait for new partitions to be
... | [
"def",
"create_partitions",
"(",
"self",
",",
"topic_partitions",
",",
"timeout_ms",
"=",
"None",
",",
"validate_only",
"=",
"False",
")",
":",
"version",
"=",
"self",
".",
"_matching_api_version",
"(",
"CreatePartitionsRequest",
")",
"timeout_ms",
"=",
"self",
... | Create additional partitions for an existing topic.
:param topic_partitions: A map of topic name strings to NewPartition objects.
:param timeout_ms: Milliseconds to wait for new partitions to be
created before the broker returns.
:param validate_only: If True, don't actually create ... | [
"Create",
"additional",
"partitions",
"for",
"an",
"existing",
"topic",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/admin/client.py#L550-L572 | train | Create additional partitions for an existing 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/admin/client.py | KafkaAdminClient.describe_consumer_groups | def describe_consumer_groups(self, group_ids, group_coordinator_id=None):
"""Describe a set of consumer groups.
Any errors are immediately raised.
:param group_ids: A list of consumer group IDs. These are typically the
group names as strings.
:param group_coordinator_id: Th... | python | def describe_consumer_groups(self, group_ids, group_coordinator_id=None):
"""Describe a set of consumer groups.
Any errors are immediately raised.
:param group_ids: A list of consumer group IDs. These are typically the
group names as strings.
:param group_coordinator_id: Th... | [
"def",
"describe_consumer_groups",
"(",
"self",
",",
"group_ids",
",",
"group_coordinator_id",
"=",
"None",
")",
":",
"group_descriptions",
"=",
"[",
"]",
"version",
"=",
"self",
".",
"_matching_api_version",
"(",
"DescribeGroupsRequest",
")",
"for",
"group_id",
"... | Describe a set of consumer groups.
Any errors are immediately raised.
:param group_ids: A list of consumer group IDs. These are typically the
group names as strings.
:param group_coordinator_id: The node_id of the groups' coordinator
broker. If set to None, it will quer... | [
"Describe",
"a",
"set",
"of",
"consumer",
"groups",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/admin/client.py#L589-L644 | train | This method returns a list of consumer groups and their associated 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/admin/client.py | KafkaAdminClient.list_consumer_groups | def list_consumer_groups(self, broker_ids=None):
"""List all consumer groups known to the cluster.
This returns a list of Consumer Group tuples. The tuples are
composed of the consumer group name and the consumer group protocol
type.
Only consumer groups that store their offset... | python | def list_consumer_groups(self, broker_ids=None):
"""List all consumer groups known to the cluster.
This returns a list of Consumer Group tuples. The tuples are
composed of the consumer group name and the consumer group protocol
type.
Only consumer groups that store their offset... | [
"def",
"list_consumer_groups",
"(",
"self",
",",
"broker_ids",
"=",
"None",
")",
":",
"# While we return a list, internally use a set to prevent duplicates",
"# because if a group coordinator fails after being queried, and its",
"# consumer groups move to new brokers that haven't yet been qu... | List all consumer groups known to the cluster.
This returns a list of Consumer Group tuples. The tuples are
composed of the consumer group name and the consumer group protocol
type.
Only consumer groups that store their offsets in Kafka are returned.
The protocol type will be a... | [
"List",
"all",
"consumer",
"groups",
"known",
"to",
"the",
"cluster",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/admin/client.py#L646-L693 | train | This method returns a list of consumer groups known 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/admin/client.py | KafkaAdminClient.list_consumer_group_offsets | def list_consumer_group_offsets(self, group_id, group_coordinator_id=None,
partitions=None):
"""Fetch Consumer Group Offsets.
Note:
This does not verify that the group_id or partitions actually exist
in the cluster.
As soon as any error is en... | python | def list_consumer_group_offsets(self, group_id, group_coordinator_id=None,
partitions=None):
"""Fetch Consumer Group Offsets.
Note:
This does not verify that the group_id or partitions actually exist
in the cluster.
As soon as any error is en... | [
"def",
"list_consumer_group_offsets",
"(",
"self",
",",
"group_id",
",",
"group_coordinator_id",
"=",
"None",
",",
"partitions",
"=",
"None",
")",
":",
"group_offsets_listing",
"=",
"{",
"}",
"if",
"group_coordinator_id",
"is",
"None",
":",
"group_coordinator_id",
... | Fetch Consumer Group Offsets.
Note:
This does not verify that the group_id or partitions actually exist
in the cluster.
As soon as any error is encountered, it is immediately raised.
:param group_id: The consumer group id name for which to fetch offsets.
:param group_c... | [
"Fetch",
"Consumer",
"Group",
"Offsets",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/admin/client.py#L695-L763 | train | Fetch the offsets for a specific 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/record/_crc32c.py | crc_update | def crc_update(crc, data):
"""Update CRC-32C checksum with data.
Args:
crc: 32-bit checksum to update as long.
data: byte array, string or iterable over bytes.
Returns:
32-bit updated CRC-32C as long.
"""
if type(data) != array.array or data.itemsize != 1:
buf = array... | python | def crc_update(crc, data):
"""Update CRC-32C checksum with data.
Args:
crc: 32-bit checksum to update as long.
data: byte array, string or iterable over bytes.
Returns:
32-bit updated CRC-32C as long.
"""
if type(data) != array.array or data.itemsize != 1:
buf = array... | [
"def",
"crc_update",
"(",
"crc",
",",
"data",
")",
":",
"if",
"type",
"(",
"data",
")",
"!=",
"array",
".",
"array",
"or",
"data",
".",
"itemsize",
"!=",
"1",
":",
"buf",
"=",
"array",
".",
"array",
"(",
"\"B\"",
",",
"data",
")",
"else",
":",
... | Update CRC-32C checksum with data.
Args:
crc: 32-bit checksum to update as long.
data: byte array, string or iterable over bytes.
Returns:
32-bit updated CRC-32C as long. | [
"Update",
"CRC",
"-",
"32C",
"checksum",
"with",
"data",
".",
"Args",
":",
"crc",
":",
"32",
"-",
"bit",
"checksum",
"to",
"update",
"as",
"long",
".",
"data",
":",
"byte",
"array",
"string",
"or",
"iterable",
"over",
"bytes",
".",
"Returns",
":",
"3... | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/record/_crc32c.py#L100-L116 | train | Update CRC - 32C checksum with data. | 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/record_accumulator.py | ProducerBatch.maybe_expire | def maybe_expire(self, request_timeout_ms, retry_backoff_ms, linger_ms, is_full):
"""Expire batches if metadata is not available
A batch whose metadata is not available should be expired if one
of the following is true:
* the batch is not in retry AND request timeout has elapsed afte... | python | def maybe_expire(self, request_timeout_ms, retry_backoff_ms, linger_ms, is_full):
"""Expire batches if metadata is not available
A batch whose metadata is not available should be expired if one
of the following is true:
* the batch is not in retry AND request timeout has elapsed afte... | [
"def",
"maybe_expire",
"(",
"self",
",",
"request_timeout_ms",
",",
"retry_backoff_ms",
",",
"linger_ms",
",",
"is_full",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"since_append",
"=",
"now",
"-",
"self",
".",
"last_append",
"since_ready",
"=",
... | Expire batches if metadata is not available
A batch whose metadata is not available should be expired if one
of the following is true:
* the batch is not in retry AND request timeout has elapsed after
it is ready (full or linger.ms has reached).
* the batch is in retry... | [
"Expire",
"batches",
"if",
"metadata",
"is",
"not",
"available"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/record_accumulator.py#L84-L116 | train | Expire batches if metadata is not available. | 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/record_accumulator.py | RecordAccumulator.append | def append(self, tp, timestamp_ms, key, value, headers, max_time_to_block_ms,
estimated_size=0):
"""Add a record to the accumulator, return the append result.
The append result will contain the future metadata, and flag for
whether the appended batch is full or a new batch is cre... | python | def append(self, tp, timestamp_ms, key, value, headers, max_time_to_block_ms,
estimated_size=0):
"""Add a record to the accumulator, return the append result.
The append result will contain the future metadata, and flag for
whether the appended batch is full or a new batch is cre... | [
"def",
"append",
"(",
"self",
",",
"tp",
",",
"timestamp_ms",
",",
"key",
",",
"value",
",",
"headers",
",",
"max_time_to_block_ms",
",",
"estimated_size",
"=",
"0",
")",
":",
"assert",
"isinstance",
"(",
"tp",
",",
"TopicPartition",
")",
",",
"'not TopicP... | Add a record to the accumulator, return the append result.
The append result will contain the future metadata, and flag for
whether the appended batch is full or a new batch is created
Arguments:
tp (TopicPartition): The topic/partition to which this record is
being... | [
"Add",
"a",
"record",
"to",
"the",
"accumulator",
"return",
"the",
"append",
"result",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/record_accumulator.py#L200-L275 | train | Append a record to the accumulator. | 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/record_accumulator.py | RecordAccumulator.abort_expired_batches | def abort_expired_batches(self, request_timeout_ms, cluster):
"""Abort the batches that have been sitting in RecordAccumulator for
more than the configured request_timeout due to metadata being
unavailable.
Arguments:
request_timeout_ms (int): milliseconds to timeout
... | python | def abort_expired_batches(self, request_timeout_ms, cluster):
"""Abort the batches that have been sitting in RecordAccumulator for
more than the configured request_timeout due to metadata being
unavailable.
Arguments:
request_timeout_ms (int): milliseconds to timeout
... | [
"def",
"abort_expired_batches",
"(",
"self",
",",
"request_timeout_ms",
",",
"cluster",
")",
":",
"expired_batches",
"=",
"[",
"]",
"to_remove",
"=",
"[",
"]",
"count",
"=",
"0",
"for",
"tp",
"in",
"list",
"(",
"self",
".",
"_batches",
".",
"keys",
"(",
... | Abort the batches that have been sitting in RecordAccumulator for
more than the configured request_timeout due to metadata being
unavailable.
Arguments:
request_timeout_ms (int): milliseconds to timeout
cluster (ClusterMetadata): current metadata for kafka cluster
... | [
"Abort",
"the",
"batches",
"that",
"have",
"been",
"sitting",
"in",
"RecordAccumulator",
"for",
"more",
"than",
"the",
"configured",
"request_timeout",
"due",
"to",
"metadata",
"being",
"unavailable",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/record_accumulator.py#L277-L334 | train | Abort the batches that have been sitting in RecordAccumulator for more than the configured request_timeout_ms. | 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/record_accumulator.py | RecordAccumulator.reenqueue | def reenqueue(self, batch):
"""Re-enqueue the given record batch in the accumulator to retry."""
now = time.time()
batch.attempts += 1
batch.last_attempt = now
batch.last_append = now
batch.set_retry()
assert batch.topic_partition in self._tp_locks, 'TopicPartitio... | python | def reenqueue(self, batch):
"""Re-enqueue the given record batch in the accumulator to retry."""
now = time.time()
batch.attempts += 1
batch.last_attempt = now
batch.last_append = now
batch.set_retry()
assert batch.topic_partition in self._tp_locks, 'TopicPartitio... | [
"def",
"reenqueue",
"(",
"self",
",",
"batch",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"batch",
".",
"attempts",
"+=",
"1",
"batch",
".",
"last_attempt",
"=",
"now",
"batch",
".",
"last_append",
"=",
"now",
"batch",
".",
"set_retry",
"("... | Re-enqueue the given record batch in the accumulator to retry. | [
"Re",
"-",
"enqueue",
"the",
"given",
"record",
"batch",
"in",
"the",
"accumulator",
"to",
"retry",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/record_accumulator.py#L336-L347 | train | Re - enqueue the given record batch in the accumulator to retry. | 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/record_accumulator.py | RecordAccumulator.ready | def ready(self, cluster):
"""
Get a list of nodes whose partitions are ready to be sent, and the
earliest time at which any non-sendable partition will be ready;
Also return the flag for whether there are any unknown leaders for the
accumulated partition batches.
A desti... | python | def ready(self, cluster):
"""
Get a list of nodes whose partitions are ready to be sent, and the
earliest time at which any non-sendable partition will be ready;
Also return the flag for whether there are any unknown leaders for the
accumulated partition batches.
A desti... | [
"def",
"ready",
"(",
"self",
",",
"cluster",
")",
":",
"ready_nodes",
"=",
"set",
"(",
")",
"next_ready_check",
"=",
"9999999.99",
"unknown_leaders_exist",
"=",
"False",
"now",
"=",
"time",
".",
"time",
"(",
")",
"exhausted",
"=",
"bool",
"(",
"self",
".... | Get a list of nodes whose partitions are ready to be sent, and the
earliest time at which any non-sendable partition will be ready;
Also return the flag for whether there are any unknown leaders for the
accumulated partition batches.
A destination node is ready to send if:
* T... | [
"Get",
"a",
"list",
"of",
"nodes",
"whose",
"partitions",
"are",
"ready",
"to",
"be",
"sent",
"and",
"the",
"earliest",
"time",
"at",
"which",
"any",
"non",
"-",
"sendable",
"partition",
"will",
"be",
"ready",
";",
"Also",
"return",
"the",
"flag",
"for",... | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/record_accumulator.py#L349-L428 | train | Returns a list of nodes whose partitions are ready to be sent and the earliest time at which any non - sendable partition will 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/producer/record_accumulator.py | RecordAccumulator.has_unsent | def has_unsent(self):
"""Return whether there is any unsent record in the accumulator."""
for tp in list(self._batches.keys()):
with self._tp_locks[tp]:
dq = self._batches[tp]
if len(dq):
return True
return False | python | def has_unsent(self):
"""Return whether there is any unsent record in the accumulator."""
for tp in list(self._batches.keys()):
with self._tp_locks[tp]:
dq = self._batches[tp]
if len(dq):
return True
return False | [
"def",
"has_unsent",
"(",
"self",
")",
":",
"for",
"tp",
"in",
"list",
"(",
"self",
".",
"_batches",
".",
"keys",
"(",
")",
")",
":",
"with",
"self",
".",
"_tp_locks",
"[",
"tp",
"]",
":",
"dq",
"=",
"self",
".",
"_batches",
"[",
"tp",
"]",
"if... | Return whether there is any unsent record in the accumulator. | [
"Return",
"whether",
"there",
"is",
"any",
"unsent",
"record",
"in",
"the",
"accumulator",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/record_accumulator.py#L430-L437 | train | Return whether there is any unsent record in the accumulator. | 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/record_accumulator.py | RecordAccumulator.drain | def drain(self, cluster, nodes, max_size):
"""
Drain all the data for the given nodes and collate them into a list of
batches that will fit within the specified size on a per-node basis.
This method attempts to avoid choosing the same topic-node repeatedly.
Arguments:
... | python | def drain(self, cluster, nodes, max_size):
"""
Drain all the data for the given nodes and collate them into a list of
batches that will fit within the specified size on a per-node basis.
This method attempts to avoid choosing the same topic-node repeatedly.
Arguments:
... | [
"def",
"drain",
"(",
"self",
",",
"cluster",
",",
"nodes",
",",
"max_size",
")",
":",
"if",
"not",
"nodes",
":",
"return",
"{",
"}",
"now",
"=",
"time",
".",
"time",
"(",
")",
"batches",
"=",
"{",
"}",
"for",
"node_id",
"in",
"nodes",
":",
"size"... | Drain all the data for the given nodes and collate them into a list of
batches that will fit within the specified size on a per-node basis.
This method attempts to avoid choosing the same topic-node repeatedly.
Arguments:
cluster (ClusterMetadata): The current cluster metadata
... | [
"Drain",
"all",
"the",
"data",
"for",
"the",
"given",
"nodes",
"and",
"collate",
"them",
"into",
"a",
"list",
"of",
"batches",
"that",
"will",
"fit",
"within",
"the",
"specified",
"size",
"on",
"a",
"per",
"-",
"node",
"basis",
".",
"This",
"method",
"... | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/record_accumulator.py#L439-L502 | train | Drain all the data for the given nodes and return a list of ProducerBatches that will fit within the specified size. | 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/record_accumulator.py | RecordAccumulator.deallocate | def deallocate(self, batch):
"""Deallocate the record batch."""
self._incomplete.remove(batch)
self._free.deallocate(batch.buffer()) | python | def deallocate(self, batch):
"""Deallocate the record batch."""
self._incomplete.remove(batch)
self._free.deallocate(batch.buffer()) | [
"def",
"deallocate",
"(",
"self",
",",
"batch",
")",
":",
"self",
".",
"_incomplete",
".",
"remove",
"(",
"batch",
")",
"self",
".",
"_free",
".",
"deallocate",
"(",
"batch",
".",
"buffer",
"(",
")",
")"
] | Deallocate the record batch. | [
"Deallocate",
"the",
"record",
"batch",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/record_accumulator.py#L504-L507 | train | Deallocate the record 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/producer/record_accumulator.py | RecordAccumulator.await_flush_completion | def await_flush_completion(self, timeout=None):
"""
Mark all partitions as ready to send and block until the send is complete
"""
try:
for batch in self._incomplete.all():
log.debug('Waiting on produce to %s',
batch.produce_future.top... | python | def await_flush_completion(self, timeout=None):
"""
Mark all partitions as ready to send and block until the send is complete
"""
try:
for batch in self._incomplete.all():
log.debug('Waiting on produce to %s',
batch.produce_future.top... | [
"def",
"await_flush_completion",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"try",
":",
"for",
"batch",
"in",
"self",
".",
"_incomplete",
".",
"all",
"(",
")",
":",
"log",
".",
"debug",
"(",
"'Waiting on produce to %s'",
",",
"batch",
".",
"prod... | Mark all partitions as ready to send and block until the send is complete | [
"Mark",
"all",
"partitions",
"as",
"ready",
"to",
"send",
"and",
"block",
"until",
"the",
"send",
"is",
"complete"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/record_accumulator.py#L520-L536 | train | Wait until all partitions are ready to send and block until the send is complete. | 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/record_accumulator.py | RecordAccumulator.abort_incomplete_batches | def abort_incomplete_batches(self):
"""
This function is only called when sender is closed forcefully. It will fail all the
incomplete batches and return.
"""
# We need to keep aborting the incomplete batch until no thread is trying to append to
# 1. Avoid losing batches.... | python | def abort_incomplete_batches(self):
"""
This function is only called when sender is closed forcefully. It will fail all the
incomplete batches and return.
"""
# We need to keep aborting the incomplete batch until no thread is trying to append to
# 1. Avoid losing batches.... | [
"def",
"abort_incomplete_batches",
"(",
"self",
")",
":",
"# We need to keep aborting the incomplete batch until no thread is trying to append to",
"# 1. Avoid losing batches.",
"# 2. Free up memory in case appending threads are blocked on buffer full.",
"# This is a tight loop but should be able ... | This function is only called when sender is closed forcefully. It will fail all the
incomplete batches and return. | [
"This",
"function",
"is",
"only",
"called",
"when",
"sender",
"is",
"closed",
"forcefully",
".",
"It",
"will",
"fail",
"all",
"the",
"incomplete",
"batches",
"and",
"return",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/record_accumulator.py#L538-L555 | train | Aborts all the incomplete batches and returns. | 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/record_accumulator.py | RecordAccumulator._abort_batches | def _abort_batches(self):
"""Go through incomplete batches and abort them."""
error = Errors.IllegalStateError("Producer is closed forcefully.")
for batch in self._incomplete.all():
tp = batch.topic_partition
# Close the batch before aborting
with self._tp_loc... | python | def _abort_batches(self):
"""Go through incomplete batches and abort them."""
error = Errors.IllegalStateError("Producer is closed forcefully.")
for batch in self._incomplete.all():
tp = batch.topic_partition
# Close the batch before aborting
with self._tp_loc... | [
"def",
"_abort_batches",
"(",
"self",
")",
":",
"error",
"=",
"Errors",
".",
"IllegalStateError",
"(",
"\"Producer is closed forcefully.\"",
")",
"for",
"batch",
"in",
"self",
".",
"_incomplete",
".",
"all",
"(",
")",
":",
"tp",
"=",
"batch",
".",
"topic_par... | Go through incomplete batches and abort them. | [
"Go",
"through",
"incomplete",
"batches",
"and",
"abort",
"them",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/producer/record_accumulator.py#L557-L566 | train | Abort all incomplete batches and deallocate them. | 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/memory_records.py | MemoryRecordsBuilder.append | def append(self, timestamp, key, value, headers=[]):
""" Append a message to the buffer.
Returns: RecordMetadata or None if unable to append
"""
if self._closed:
return None
offset = self._next_offset
metadata = self._builder.append(offset, timestamp, key, v... | python | def append(self, timestamp, key, value, headers=[]):
""" Append a message to the buffer.
Returns: RecordMetadata or None if unable to append
"""
if self._closed:
return None
offset = self._next_offset
metadata = self._builder.append(offset, timestamp, key, v... | [
"def",
"append",
"(",
"self",
",",
"timestamp",
",",
"key",
",",
"value",
",",
"headers",
"=",
"[",
"]",
")",
":",
"if",
"self",
".",
"_closed",
":",
"return",
"None",
"offset",
"=",
"self",
".",
"_next_offset",
"metadata",
"=",
"self",
".",
"_builde... | Append a message to the buffer.
Returns: RecordMetadata or None if unable to append | [
"Append",
"a",
"message",
"to",
"the",
"buffer",
"."
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/record/memory_records.py#L132-L147 | train | Append a new record to the 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/default_records.py | DefaultRecordBatchBuilder.append | def append(self, offset, timestamp, key, value, headers,
# Cache for LOAD_FAST opcodes
encode_varint=encode_varint, size_of_varint=size_of_varint,
get_type=type, type_int=int, time_time=time.time,
byte_like=(bytes, bytearray, memoryview),
bytear... | python | def append(self, offset, timestamp, key, value, headers,
# Cache for LOAD_FAST opcodes
encode_varint=encode_varint, size_of_varint=size_of_varint,
get_type=type, type_int=int, time_time=time.time,
byte_like=(bytes, bytearray, memoryview),
bytear... | [
"def",
"append",
"(",
"self",
",",
"offset",
",",
"timestamp",
",",
"key",
",",
"value",
",",
"headers",
",",
"# Cache for LOAD_FAST opcodes",
"encode_varint",
"=",
"encode_varint",
",",
"size_of_varint",
"=",
"size_of_varint",
",",
"get_type",
"=",
"type",
",",... | Write message to messageset buffer with MsgVersion 2 | [
"Write",
"message",
"to",
"messageset",
"buffer",
"with",
"MsgVersion",
"2"
] | f6a8a38937688ea2cc5dc13d3d1039493be5c9b5 | https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/record/default_records.py#L391-L476 | train | Append a new entry to the messageset. | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.