public Job launch()

in src/main/java/com/google/cloud/dfmetrics/pipelinemanager/ClassicTemplateClient.java [45:74]


  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);

    CreateJobFromTemplateRequest templateRequest =
        new CreateJobFromTemplateRequest()
            .setJobName(templateConfig.jobName())
            .setParameters(templateConfig.parameters())
            .setLocation(region)
            .setGcsPath(templateConfig.specPath());

    if (templateConfig.environment() != null) {
      templateRequest.setEnvironment(buildEnvironment(templateConfig));
    }

    return Failsafe.with(RetryUtil.clientRetryPolicy())
        .get(
            () ->
                dataflowClient
                    .projects()
                    .locations()
                    .templates()
                    .create(project, region, templateRequest)
                    .execute());
  }