Ottomata has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/324751

Change subject: Convert api_version to tuple for kafka-python handlers
......................................................................

Convert api_version to tuple for kafka-python handlers

Change-Id: I196983f697e57b8d8b71fdb0e8d1b8229512e598
---
M config/schemas
M eventlogging/handlers.py
2 files changed, 13 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/eventlogging 
refs/changes/51/324751/1

diff --git a/config/schemas b/config/schemas
index f0ee5e8..03f7ed7 160000
--- a/config/schemas
+++ b/config/schemas
@@ -1 +1 @@
-Subproject commit f0ee5e8922f53b4934c61a7471c676e0ee3c72b8
+Subproject commit 03f7ed74e9d97d5c1db4930977a7993e1b336a38
diff --git a/eventlogging/handlers.py b/eventlogging/handlers.py
index 4b6ff3d..1971c1d 100644
--- a/eventlogging/handlers.py
+++ b/eventlogging/handlers.py
@@ -163,9 +163,12 @@
     if not async and 'batch_size' not in kafka_args:
         kafka_args['batch_size'] = 0
 
-    # If specifying api_version, it should be a string!
+    # kafka-python expects api_version to be a tuple of ints.
+    # Convert the semvar string.
     if 'api_version' in kafka_args:
-        kafka_args['api_version'] = str(kafka_args['api_version'])
+        kafka_args['api_version'] = tuple(
+            [int(i) for i in str(kafka_args['api_version']).split('.')]
+        )
 
     # Set default retries to 3.
     if 'retries' not in kafka_args:
@@ -665,6 +668,13 @@
         if k in KafkaConsumer.DEFAULT_CONFIG
     }
 
+    # kafka-python expects api_version to be a tuple of ints.
+    # Convert the semvar string.
+    if 'api_version' in kafka_args:
+        kafka_args['api_version'] = tuple(
+            [int(i) for i in str(kafka_args['api_version']).split('.')]
+        )
+
     # Be flexible with auto_offset_reset values.  The enum names
     # have changed in different clients and versions, but the int
     # values have never changed.  Allow setting this by int value on

-- 
To view, visit https://gerrit.wikimedia.org/r/324751
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I196983f697e57b8d8b71fdb0e8d1b8229512e598
Gerrit-PatchSet: 1
Gerrit-Project: eventlogging
Gerrit-Branch: master
Gerrit-Owner: Ottomata <o...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to