public Job launch()

in src/main/java/com/google/cloud/dfmetrics/pipelinemanager/FlexTemplateClient.java [46:77]


  public Job launch(String project, String region, TemplateConfig templateConfig)
      throws IOException {
    LOG.info(
        "Launching {} using spec {} in region {} under {}",
        templateConfig.jobName(),
        templateConfig.specPath(),
        region,
        project);

    LaunchFlexTemplateParameter parameter =
        new LaunchFlexTemplateParameter()
            .setJobName(templateConfig.jobName())
            .setParameters(templateConfig.parameters())
            .setContainerSpecGcsPath(templateConfig.specPath())
            .setEnvironment(buildEnvironment(templateConfig));

    LaunchFlexTemplateRequest request =
        new LaunchFlexTemplateRequest().setLaunchParameter(parameter);

    LaunchFlexTemplateResponse response =
        Failsafe.with(RetryUtil.clientRetryPolicy())
            .get(
                () ->
                    dataflowClient
                        .projects()
                        .locations()
                        .flexTemplates()
                        .launch(project, region, request)
                        .execute());

    return response.getJob();
  }