You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently tried Apache Kafka with Kafka Python (confluent-kafka Python package).
Latest Gramine (v1.6) works without any problems, at least on the example Kafka Producer and Kafka Consumer Python scripts that I was given.
Here I'll describe how to adapt our existing Python CI example to Kafka Python. Unfortunately I was given a private Kafka instance, with closed-source Python scripts. So I anonymize these parts.
Preparation
I tried on Ubuntu 20.04, with Gramine v1.6. First, install Kafka:
# sudo needed to install into system-wide Python dirs where Gramine Python example looks for files
$ sudo pip3 install confluent-kafka
For Kafka Python example, I copy-pasted the existing Gramine Python example into a new dir:
cd gramine/CI-Examples
cp -r python kafka-python
cd kafka-python
There are the new files I added:
$ gramine/CI-Examples/kafka-python$ tree
├── python.manifest.template # modified, see diff below
├── example.json # kafka-producer.py sends contents of this file to Kafka
├── kafka-ca.pem # Kafka's CA certificate
├── kafka-user.key # my user's private key to log in Kafka
├── kafka-user.pem # my user's certificate to log in Kafka
├── ...
└── scripts
├── kafka-consumer.py
├── kafka-producer.py
├── ...
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I recently tried Apache Kafka with Kafka Python (
confluent-kafka
Python package).Latest Gramine (v1.6) works without any problems, at least on the example Kafka Producer and Kafka Consumer Python scripts that I was given.
Here I'll describe how to adapt our existing Python CI example to Kafka Python. Unfortunately I was given a private Kafka instance, with closed-source Python scripts. So I anonymize these parts.
Preparation
I tried on Ubuntu 20.04, with Gramine v1.6. First, install Kafka:
# sudo needed to install into system-wide Python dirs where Gramine Python example looks for files $ sudo pip3 install confluent-kafka
For Kafka Python example, I copy-pasted the existing Gramine Python example into a new dir:
There are the new files I added:
The
kafka-consumer.py
script basically does this:The
kafka-producer.py
script basically does this:Gramine manifest
The manifest is modified like this:
NOTE: Many parts of the original Python manifest can be removed, as they are not required by Kafka. Left as an exercise for readers.
Running
I ran my example scripts like this:
Beta Was this translation helpful? Give feedback.
All reactions