dataproc: clean proto formatting a bit
@@ -41,12 +41,8 @@ func instantiateInlineWorkflowTemplate(w io.Writer, projectID, region string) er
return fmt.Errorf("dataproc.NewWorkflowTemplateClient: %v", err)
}
- // Create the Instantiate Inline Workflow Template Request.
- req := &dataprocpb.InstantiateInlineWorkflowTemplateRequest{
- Parent: fmt.Sprintf("projects/%s/regions/%s", projectID, region),
- Template: &dataprocpb.WorkflowTemplate{
- Jobs: []*dataprocpb.OrderedJob{
- {
+ // Create jobs for the workflow.
+ teragenJob := &dataprocpb.OrderedJob{
JobType: &dataprocpb.OrderedJob_HadoopJob{
HadoopJob: &dataprocpb.HadoopJob{
Driver: &dataprocpb.HadoopJob_MainJarFileUri{
@@ -60,8 +56,9 @@ func instantiateInlineWorkflowTemplate(w io.Writer, projectID, region string) er
},
},
StepId: "teragen",
- },
- {
+ }
+
+ terasortJob := &dataprocpb.OrderedJob{
JobType: &dataprocpb.OrderedJob_HadoopJob{
HadoopJob: &dataprocpb.HadoopJob{
Driver: &dataprocpb.HadoopJob_MainJarFileUri{
@@ -78,9 +75,10 @@ func instantiateInlineWorkflowTemplate(w io.Writer, projectID, region string) er
PrerequisiteStepIds: []string{
"teragen",
},
- },
- },
- Placement: &dataprocpb.WorkflowTemplatePlacement{
+ }
+
+ // Create the cluster placement.
+ clusterPlacement := &dataprocpb.WorkflowTemplatePlacement{
Placement: &dataprocpb.WorkflowTemplatePlacement_ManagedCluster{
ManagedCluster: &dataprocpb.ManagedCluster{
ClusterName: "my-managed-cluster",
@@ -93,7 +91,17 @@ func instantiateInlineWorkflowTemplate(w io.Writer, projectID, region string) er
},
},
},
+ }
+
+ // Create the Instantiate Inline Workflow Template Request.
+ req := &dataprocpb.InstantiateInlineWorkflowTemplateRequest{
+ Parent: fmt.Sprintf("projects/%s/regions/%s", projectID, region),
+ Template: &dataprocpb.WorkflowTemplate{
+ Jobs: []*dataprocpb.OrderedJob{
+ teragenJob,
+ terasortJob,
},
+ Placement: clusterPlacement,
},
}
