简体   繁体   中英

Adding support for JS UDF in Google Dataflow template

I have this code from Google Cloud Platform Dataflow Templates.

I wish to add more functionalities to it, namely, I wish to add support for JavaScript UDF. When I try to compile the file, using this:

mvn compile exec:java \
-Dexec.mainClass=com.google.cloud.teleport.templates.${PIPELINE_NAME} \
-Dexec.cleanupDaemonThreads=false \
-Dexec.args=" \
--project=${PROJECT_ID} \
--stagingLocation=gs://${PROJECT_ID}/dataflow/${PIPELINE_FOLDER}/staging \
--tempLocation=gs://${PROJECT_ID}/dataflow/${PIPELINE_FOLDER}/temp \
--runner=DataflowRunner \
--windowDuration=2m \
--numShards=1 \
--topic=projects/${PROJECT_ID}/topics/windowed-files \
--outputDirectory=gs://${PROJECT_ID}/temp/ \
--outputFilenamePrefix=windowed-file \
--outputFilenameSuffix=.txt"

When compiling the file, I get the following error:

An exception occured while executing the Java class. Class interface com.google.cloud.teleport.templates.PubsubToText$Options missing a property named 'topic'. -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project google-cloud-teleport-java: An exception occured while executing the Java class. Class interface com.google.cloud.teleport.templates.PubsubToText$Options missing a property named 'topic'.

Even though, I've passed the --topic flag with appropriate values plugged in.

The example at the top is wrong. You have to pass --inputTopic instead of --topic . You can see this in the code where the ValueProvider is defined:

@Description("The Cloud Pub/Sub topic to read from.")
@Required
ValueProvider<String> getInputTopic();
void setInputTopic(ValueProvider<String> value);

You can also run the template from the Console UI and the job details will show that the option is indeed inputTopic :

在此处输入图片说明

现在,javadoc中的调用示例应该在此处反映正确的输入参数(--inputTopic)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM