gpt4 book ai didi

java - 使用 Dataflow API 启动时将参数传递给模板

转载 作者:行者123 更新时间:2023-12-02 12:00:24 25 4
gpt4 key购买 nike

App Engine 数据流作业中使用数据流 API 启动时,我必须将参数传递给模板。

 com.google.api.services.dataflow.Dataflow.Projects.Locations.Templates.Launch request1 = 


dataflowService.projects().locations().templates().launch(projectId,"us-central1",null);

request1.setGcsPath(template);
request1.setLocation("us-central1");
request1.setValidateOnly(false);

//Storing launch Response
LaunchTemplateResponse response1 = request1.execute();

在我的代码中,我能够设置 GCS 路径、位置和有效性,但无法像在 Cloud Function 中那样设置参数。有没有使用 java.lang.Settings 参数设置的方法?因为在 Python 中它是可能的,所以我认为在 Java 中也是如此。

最佳答案

传递我使用的参数 -:LaunchTemplateParameters 参数 = new LaunchTemplateParameters();

LaunchTemplateParameters parameters = new LaunchTemplateParameters();
Map<String,String> map = new HashMap<String,String>();
map.put("inputFile", "gs://xyz-bucket/Temp.txt");
parameters.setParameters(map);
com.google.api.services.dataflow.Dataflow.Projects.Locations.Templates.Launch request1 =
dataflowService.projects().locations().templates().launch(projectId,"us-central1",parameters);

request1.setGcsPath(template);
request1.setLocation("us-central1");
request1.setValidateOnly(false);


LaunchTemplateResponse response1 = request1.execute();

关于java - 使用 Dataflow API 启动时将参数传递给模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47299341/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com