Skip to content

Commit

Permalink
[FLINK-33557] Externalize Cassandra Python connector code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferenc Csaky committed Jan 29, 2024
1 parent 20c5f50 commit d19afa4
Show file tree
Hide file tree
Showing 12 changed files with 1,224 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,18 @@ tools/flink
tools/flink-*
tools/releasing/release
tools/japicmp-output

# Generated files, do not store in git
flink-python/apache_flink_connectors_cassandra.egg-info/
flink-python/.tox/
flink-python/build
flink-python/dist
flink-python/dev/download
flink-python/dev/.conda/
flink-python/dev/log/
flink-python/dev/.stage.txt
flink-python/dev/install_command.sh
flink-python/dev/lint-python.sh
flink-python/dev/build-wheels.sh
flink-python/dev/glibc_version_fix.h
flink-python/dev/dev-requirements.txt
1 change: 0 additions & 1 deletion flink-connector-cassandra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ under the License.

<!-- Allow users to pass custom connector versions -->
<properties>
<scala.binary.version>2.12</scala.binary.version>
<scala-library.version>2.12.7</scala-library.version>
<slf4j.version>1.7.36</slf4j.version>
<log4j.version>2.17.1</log4j.version>
Expand Down
20 changes: 20 additions & 0 deletions flink-python/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
################################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

graft pyflink
global-exclude *.py[cod] __pycache__ .DS_Store
14 changes: 14 additions & 0 deletions flink-python/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
This is official Apache Flink Cassandra Python connector.

For the latest information about Flink connector, please visit our website at:

https://flink.apache.org

and our GitHub Account for Cassandra connector

https://github.com/apache/flink-connector-cassandra

If you have any questions, ask on our Mailing lists:

[email protected]
[email protected]
50 changes: 50 additions & 0 deletions flink-python/dev/integration_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
################################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

function test_module() {
module="$FLINK_PYTHON_DIR/pyflink/$1"
echo "test module $module"
pytest --durations=20 ${module} $2
if [[ $? -ne 0 ]]; then
echo "test module $module failed"
exit 1
fi
}

function test_all_modules() {
# test datastream module
test_module "datastream"
}

# CURRENT_DIR is "<root-project-folder>/flink-python/dev/"
CURRENT_DIR="$(cd "$( dirname "$0" )" && pwd)"

# FLINK_PYTHON_DIR is "<root-project-folder>/flink-python/"
FLINK_PYTHON_DIR=$(dirname "$CURRENT_DIR")

# set the FLINK_TEST_LIB_DIR to "<root-project-folder>/flink-connector-cassandra/flink-python-connector-cassandra/target/dep..."
export FLINK_TEST_LIBS="${FLINK_PYTHON_DIR}/target/test-dependencies/*"

# Temporarily update the installed 'pyflink_gateway_server.py' files with the new one
# Needed only until Flink 1.19 release
echo "Checking ${FLINK_PYTHON_DIR} for 'pyflink_gateway_server.py'"
find "${FLINK_PYTHON_DIR}/.tox" -name pyflink_gateway_server.py -exec cp "${FLINK_PYTHON_DIR}/pyflink/pyflink_gateway_server.py" {} \;

# python test
test_all_modules
212 changes: 212 additions & 0 deletions flink-python/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-cassandra-parent</artifactId>
<version>4.0-SNAPSHOT</version>
</parent>

<artifactId>flink-connector-cassandra-python</artifactId>
<name>Flink : Connectors : Cassandra : Python</name>

<packaging>pom</packaging>

<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-cassandra_${scala.binary.version}</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-runtime</artifactId>
<version>${flink.version}</version>
</dependency>

<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-test-utils</artifactId>
<version>${flink.version}</version>
</dependency>

<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-test-utils</artifactId>
<version>${flink.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>clean</id>
<phase>clean</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<delete dir="${project.basedir}/.tox"/>
<delete
dir="${project.basedir}/apache_flink_connectors_cassandra.egg-info"/>
<delete dir="${project.basedir}/dev/.conda"/>
<delete dir="${project.basedir}/dev/download"/>
<delete dir="${project.basedir}/dev/log"/>
<delete dir="${project.basedir}/build"/>
<delete dir="${project.basedir}/dist"/>
<delete dir="${project.basedir}/pyflink/lib"/>
<delete file="${project.basedir}/dev/.stage.txt"/>
<delete file="${project.basedir}/dev/install_command.sh"/>
<delete file="${project.basedir}/dev/lint-python.sh"/>
<delete file="${project.basedir}/dev/build-wheels.sh"/>
<delete file="${project.basedir}/dev/glibc_version_fix.h"/>
<delete file="${project.basedir}/dev/dev-requirements.txt"/>
<delete
file="${project.basedir}/pyflink/datastream/connectors/cassandra_connector_version.py"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-cassandra_${scala.binary.version}</artifactId>
</artifactItem>
<artifactItem>
<groupId>org.apache.flink</groupId>
<artifactId>flink-runtime</artifactId>
<!-- Don't use test-jar type because of a bug in the plugin (MDEP-587). -->
<classifier>tests</classifier>
</artifactItem>
<artifactItem>
<groupId>org.apache.flink</groupId>
<artifactId>flink-test-utils</artifactId>
</artifactItem>
<artifactItem>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-test-utils</artifactId>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/test-dependencies</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>junit</includeGroupIds>
<outputDirectory>${project.build.directory}/test-dependencies</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- Download the testing infra sources from the Flink main repository -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>2.0.2</version>
<executions>
<execution>
<id>download-install</id>
<phase>validate</phase>
<goals>
<goal>download-single</goal>
</goals>
<configuration>
<url>
https://raw.githubusercontent.com/apache/flink-connector-shared-utils/ci_utils/python/install_command.sh
</url>
<toDir>${project.basedir}/dev</toDir>
<skip>${python.infra.download.skip}</skip>
</configuration>
</execution>
<execution>
<id>download-lint</id>
<phase>validate</phase>
<goals>
<goal>download-single</goal>
</goals>
<configuration>
<url>
https://raw.githubusercontent.com/apache/flink-connector-shared-utils/ci_utils/python/lint-python.sh
</url>
<toDir>${project.basedir}/dev</toDir>
<skip>${python.infra.download.skip}</skip>
</configuration>
</execution>
<execution>
<id>download-build-wheels</id>
<phase>validate</phase>
<goals>
<goal>download-single</goal>
</goals>
<configuration>
<url>
https://raw.githubusercontent.com/apache/flink-connector-shared-utils/ci_utils/python/build-wheels.sh
</url>
<toDir>${project.basedir}/dev</toDir>
<skip>${python.infra.download.skip}</skip>
</configuration>
</execution>
<execution>
<id>download-build-version-header</id>
<phase>validate</phase>
<goals>
<goal>download-single</goal>
</goals>
<configuration>
<url>
https://raw.githubusercontent.com/apache/flink-connector-shared-utils/ci_utils/python/glibc_version_fix.h
</url>
<toDir>${project.basedir}/dev</toDir>
<skip>${python.infra.download.skip}</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit d19afa4

Please sign in to comment.