diff --git a/pulsar-functions/bin/pulsar b/pulsar-functions/bin/pulsar index cea40c07750f4..cc5466accf2b3 100755 --- a/pulsar-functions/bin/pulsar +++ b/pulsar-functions/bin/pulsar @@ -45,18 +45,19 @@ else fi # exclude tests jar -RELEASE_JAR=`ls $PULSAR_HOME/pulsar-*.jar 2> /dev/null | grep -v tests | tail -1` +RELEASE_JAR=`ls $PULSAR_HOME/lib/*pulsar-functions-worker*.jar 2> /dev/null | grep -v tests | tail -1` if [ $? == 0 ]; then PULSAR_JAR=$RELEASE_JAR fi # exclude tests jar -BUILT_JAR=`ls $PULSAR_HOME/worker/target/pulsar-*.jar 2> /dev/null | grep -v tests | tail -1` -if [ $? != 0 ] && [ ! -e "$PULSAR_JAR" ]; then - echo "\nCouldn't find pulsar jar."; - echo "Make sure you've run 'mvn package'\n"; - exit 1; -elif [ -e "$BUILT_JAR" ]; then +if [ -z "$PULSAR_JAR" ]; then + BUILT_JAR=`ls $PULSAR_HOME/worker/target/pulsar-*.jar 2> /dev/null | grep -v tests | tail -1` + if [ -z "${BUILT_JAR}" ]; then + echo "\nCouldn't find pulsar jar."; + echo "Make sure you've run 'mvn package'\n"; + exit 1; + fi PULSAR_JAR=$BUILT_JAR fi @@ -64,26 +65,24 @@ fi if [ ! -f "${JAVA_INSTANCE_JAR}" ]; then # didn't find a released jar, then search the built jar BUILT_JAVA_INSTANCE_JAR="${PULSAR_HOME}/runtime/target/java-instance.jar" - if [ -f "${BUILT_JAVA_INSTANCE_JAR}" ]; then - JAVA_INSTANCE_JAR=${BUILT_JAVA_INSTANCE_JAR} - else + if [ -z "${BUILT_JAVA_INSTANCE_JAR}" ]; then echo "\nCouldn't find pulsar java instance jar."; echo "Make sure you've run 'mvn package'\n"; exit 1; fi + JAVA_INSTANCE_JAR=${BUILT_JAVA_INSTANCE_JAR} fi # find the python instance location if [ ! -f "${PY_INSTANCE_FILE}" ]; then # didn't find a released python instance, then search the built python instance BUILT_PY_INSTANCE_FILE="${PULSAR_HOME}/runtime/target/python-instance/python_instance_main.py" - if [ -f "${BUILT_PY_INSTANCE_FILE}" ]; then - PY_INSTANCE_FILE=${BUILT_PY_INSTANCE_FILE} - else + if [ -z "${BUILT_PY_INSTANCE_FILE}" ]; then echo "\nCouldn't find pulsar python instance."; echo "Make sure you've run 'mvn package'\n"; exit 1; fi + PY_INSTANCE_FILE=${BUILT_PY_INSTANCE_FILE} fi pulsar_help() { diff --git a/pulsar-functions/bin/pulsar-functions b/pulsar-functions/bin/pulsar-functions index 4cb6e7fa60b96..81d137849cab4 100755 --- a/pulsar-functions/bin/pulsar-functions +++ b/pulsar-functions/bin/pulsar-functions @@ -74,7 +74,7 @@ add_maven_deps_to_classpath() { } if [ -d "$PULSAR_HOME/lib" ]; then - PULSAR_CLASSPATH="$PULSAR_CLASSPATH:$PULSAR_HOME/lib/*" + PULSAR_CLASSPATH="$PULSAR_CLASSPATH:$PULSAR_HOME/lib/*" else add_maven_deps_to_classpath fi diff --git a/pulsar-functions/dist/pom.xml b/pulsar-functions/dist/pom.xml new file mode 100644 index 0000000000000..0d199f93c9f1f --- /dev/null +++ b/pulsar-functions/dist/pom.xml @@ -0,0 +1,104 @@ + + + 4.0.0 + + + org.apache.pulsar + pulsar-functions + 2.0.0-incubating-SNAPSHOT + .. + + + pulsar-functions-dist + Pulsar Functions :: Distribution + pom + + + + org.apache.pulsar + pulsar-functions-worker + ${project.version} + + + + org.apache.pulsar + pulsar-functions-cli + ${project.version} + + + + org.apache.pulsar + pulsar-functions-api-examples + ${project.version} + + provided + + + + org.apache.logging.log4j + log4j-slf4j-impl + + + org.apache.logging.log4j + log4j-api + + + org.apache.logging.log4j + log4j-core + + + + + + + + maven-assembly-plugin + + + functions-dist-assembly + package + + single + + + true + posix + apache-pulsar-functions-${project.version} + + src/assemble/bin.xml + src/assemble/src.xml + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + + diff --git a/pulsar-functions/dist/src/assemble/bin.xml b/pulsar-functions/dist/src/assemble/bin.xml new file mode 100644 index 0000000000000..3e9d8ce20ec09 --- /dev/null +++ b/pulsar-functions/dist/src/assemble/bin.xml @@ -0,0 +1,83 @@ + + + bin + + tar.gz + + true + + + true + + + + + ${basedir}/../conf + + + ${basedir}/../bin + 755 + + + ${basedir}/../runtime/target/python-instance + instances + + + + + ${basedir}/../runtime/target/java-instance.jar + java-instance.jar + instances + + + ${basedir}/../java-examples/target/pulsar-functions-api-examples.jar + api-examples.jar + examples + + + + + lib + false + compile + false + + ${artifact.groupId}-${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension} + + + + io.netty:netty-common + io.netty:netty-resolver + io.netty:netty-buffer + io.netty:netty-codec-http + io.netty:netty-codec + io.netty:netty-transport + io.netty:netty-handler + io.netty:netty-codec-http + + + + diff --git a/pulsar-functions/dist/src/assemble/src.xml b/pulsar-functions/dist/src/assemble/src.xml new file mode 100644 index 0000000000000..0c0526358e515 --- /dev/null +++ b/pulsar-functions/dist/src/assemble/src.xml @@ -0,0 +1,92 @@ + + + src + + tar.gz + + true + + + .. + true + + **/README.md + **/DISCLAIMER + **/LICENSE + **/NOTICE + **/pom.xml + **/src/** + **/pulsar-client-cpp/** + **/conf/** + **/bin/** + **/*.txt + docker/** + dashboard/** + deployment/** + + + .git/** + **/.gitignore + **/.svn + **/*.iws + **/*.ipr + **/*.iml + **/*.cbp + **/*.pyc + **/.classpath + **/.project + **/.settings + **/target/** + **/CMakeFiles/** + **/CMakeCache.txt + **/cmake_install.cmake + pulsar-client-cpp/**/Makefile + pulsar-client-cpp/tests/main + pulsar-client-cpp/examples/SampleAsyncProducer + pulsar-client-cpp/examples/SampleConsumer + pulsar-client-cpp/examples/SampleConsumerListener + pulsar-client-cpp/examples/SampleProducer + pulsar-client-cpp/perf/perfProducer + pulsar-client-cpp/perf/perfConsumer + + **/python/dist/** + **/python/wheelhouse/** + **/python/MANIFEST + **/*.egg-info/** + + **/*.log + **/build/** + **/file:/** + **/SecurityAuth.audit* + **/site/** + **/.idea/** + **/*.a + **/*.so + **/*.so.* + **/*.dylib + + + + diff --git a/pulsar-functions/pom.xml b/pulsar-functions/pom.xml index 75cb878a594bd..6f1881c0d227f 100644 --- a/pulsar-functions/pom.xml +++ b/pulsar-functions/pom.xml @@ -42,6 +42,7 @@ cli java-examples api-composition-java + dist diff --git a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/FunctionMetadataSetup.java b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/FunctionMetadataSetup.java index 5b54eb631db12..1d606dedc1a21 100644 --- a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/FunctionMetadataSetup.java +++ b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/FunctionMetadataSetup.java @@ -56,6 +56,7 @@ public static URI setupFunctionMetadata(WorkerConfig workerConfig) admin.clusters().getClusters(); break; } catch (PulsarAdminException e) { + log.warn("Failed to retrieve clusters from pulsar service", e); log.warn("Retry to connect to Pulsar service at {}", workerConfig.getPulsarWebServiceUrl()); if (retries >= maxRetries) { log.error("Failed to connect to Pulsar service at {} after {} attempts",