I am working on google app engine project, I have created one class for google cloud dataflow job and tried to follow the steps https://cloud.google.com/dataflow/docs/guides/templates/creating-templates#creating-and-staging-templates? But when I try to execute the command provided in the link my dataflow job start execution immediately, I dont want to start execution I just want to create a template and execute it later on
Command that I tried to execute and create template:
mvn compile exec:java -Dexec.mainClass=com.testUtils.TimeSpentDataFlow -Dexec.args="--runner=DataflowRunner --project=my-project-id --stagingLocation=gs://staging --templateLocation=gs://MyTemplateData16Apr19"
I have also try with Custom Option Class but no luck. below is my code snippet
public static void main(String[] args) {
logger.info("main start");
init();
logger.info("main end");
}
private static void init() {
DataflowPipelineOptions dataflowOptions = PipelineOptionsFactory.as(DataflowPipelineOptions.class);
dataflowOptions.setGcpTempLocation("gs://gcpTempLocation/");
dataflowOptions.setProject("my-project-id");
dataflowOptions.setStagingLocation("gs://stagingLocation/");
dataflowOptions.setRunner(DataflowRunner.class);
FileSystems.setDefaultPipelineOptions(dataflowOptions);
Pipeline p = Pipeline.create(dataflowOptions);
p.apply(Create.of("5435798895722496"))
.apply(new PrintData());
p.run().waitUntilFinish();
}
When I try to execute the command for default wordcount program the template get created but if I try the same command with my custom Class it start executing