Hi everyone, I am new to flink and using these lib...
# troubleshooting
b
Hi everyone, I am new to flink and using these libraries.
Copy code
apache-flink==1.14.4
apache-flink-libraries==1.14.4
pyflink==1.0
I am facing an error regarding
from pyflink.connector.gcp.pubsub import PubSubSource
ModuleNotFoundError: No module named 'pyflink.connector'
. I want to use the pubsub connector to stream the data to SIEM servers. I came across this documentation https://nightlies.apache.org/flink/flink-docs-release-1.17/api/python/reference/pyflink.datastream/connectors.html and wanted to know that is there any available implementation for pubsub connector in flink for python?
a
You do notice that the python libs are not 1.17? Not sure if this affects it.
b
I have also updated the libraries
apache-flink==1.17.0
apache-flink-libraries==1.17.0
That didn't help.
m
b
Thanks for responding, Actually I have application in which I want to integrate Flink and the app is deployed in docker containers. Is there any official guide for integrating the pyflink with my app which is running on dockerized environment? I added
apache-flink
in my requirements.txt and I am able to import pyflink.datastream but not the pyflink.connector.
b
yes I am able to run the docker container using the instruction but not sure how to include pubsub connector in the package.
d
@Bhavya Soni Hey, Pubsub is still not supported in PyFlink. I’m curious where the exception comes from.
There is a open PR, however, not been updated: https://github.com/apache/flink/pull/20627
b
Oh I see, So I will need to define the tasks to stream data from pubsub manually, right? thanks for the update @Dian Fu
d
@Bhavya Soni In PyFlink, connector is just a wrapper of the Java ones. So I think you could just write one and could refer to https://github.com/apache/flink/pull/20627 as an example.
b
Sure @Dian Fu, I was exploring the code and tried to run the same code on my dockerized environment. I have built the image from
flink:1.17.1
and I assume that all the necessary jar files will be available inside the container environment to build the connector/wrapper.
I came across this error
TypeError: Could not found the Java class 'org.apache.flink.streaming.connectors.gcp.pubsub.PubSubSource.newBuilder'. The Java dependencies could be specified via command line argument '--jarfile' or the config option 'pipeline.jars'
in the same environment so I tried to add the jar files manually under
/dist-packages/pyflink/lib
directory. That also didn't solve the error.
m
Connectors aren’t bundled with Flink
b
As I said I tried to add the jar files manually under
/dist-packages/pyflink/lib
directory. That also didn't solve the error.
I am new to this, so my questions may seem basic or straightforward.
m
I don’t know PyFlink, but in order to load connectors the JARs must be in the
lib
folder
But I don’t recognize the path you provided as the Flink path
b
The path I have provided is for lib directory under my python pyflink package. Is this where we add the JARs?
m
Wish I knew :)
b
I found this similar issue on stack-overflow https://stackoverflow.com/questions/69335471/typeerror-could-not-found-the-java-class-org-apache-flink-streaming-connectors and added the JARs at the given destination directory but didn't work.
I tried to add the JAR file
flink-connector-gcp-pubsub-3.0.1-1.17.jar
using https://nightlies.apache.org/flink/flink-docs-release-1.17/docs/dev/python/dependency_management/ but it also didn't help.
d
@Bhavya Soni You need to add the transitive dependencies as well…
b
@Dian Fu can you please brief me about the transitive dependencies, what else will be needed?