【问题标题】:Passing Parameters to template While Launching using Dataflow API使用 Dataflow API 启动时将参数传递给模板
【发布时间】:2018-04-28 04:50:47
【问题描述】:

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 路径、位置和有效性,但不能像在云函数中那样设置参数。是使用 java 设置参数的任何方法吗?因为在 Python 中它是可能的,所以我认为在 Java 中也是如此。

【问题讨论】:

  • 您能否详细说明“在云函数中设置参数”是什么意思?您应该能够为您的模板设置所有参数,就像 gcs 路径等。
  • 忽略上面的问题,我想我知道你在问什么。刚刚查了一下 API。

标签: java google-app-engine google-cloud-platform google-cloud-dataflow apache-beam


【解决方案1】:

传递我使用的参数-: 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();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-05-17
    • 2015-09-22
    • 1970-01-01
    • 2014-03-31
    • 1970-01-01
    • 2016-01-13
    • 1970-01-01
    相关资源
    最近更新 更多