Skip to content

Commit

Permalink
removed extra old code (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradmiro authored Sep 16, 2020
1 parent 3f68184 commit 1a60125
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 33 deletions.
29 changes: 0 additions & 29 deletions dataproc/snippets/src/main/java/Quickstart.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,6 @@

public class Quickstart {

public static Job waitForJobCompletion(
JobControllerClient jobControllerClient, String projectId, String region, String jobId) {
while (true) {
// Poll the service periodically until the Job is in a finished state.
Job jobInfo = jobControllerClient.getJob(projectId, region, jobId);
switch (jobInfo.getStatus().getState()) {
case DONE:
case CANCELLED:
case ERROR:
return jobInfo;
default:
try {
// Wait a second in between polling attempts.
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
}

public static void quickstart(
String projectId, String region, String clusterName, String jobFilePath)
throws IOException, InterruptedException {
Expand Down Expand Up @@ -130,16 +109,8 @@ public static void quickstart(
Job job = Job.newBuilder().setPlacement(jobPlacement).setPysparkJob(pySparkJob).build();

// Submit an asynchronous request to execute the job.
Job request = jobControllerClient.submitJob(projectId, region, job);
String jobId = request.getReference().getJobId();
System.out.println(String.format("Submitting job \"%s\"", jobId));

// Wait for the job to finish.
System.out.println(String.format("Job %s finished successfully.", jobId));

OperationFuture<Job, JobMetadata> submitJobAsOperationAsyncRequest =
jobControllerClient.submitJobAsOperationAsync(projectId, region, job);

Job jobResponse = submitJobAsOperationAsyncRequest.get();

// Print output from Google Cloud Storage.
Expand Down
3 changes: 0 additions & 3 deletions dataproc/snippets/src/main/java/SubmitJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
// [START dataproc_submit_job]

import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.dataproc.v1.HadoopJob;
import com.google.cloud.dataproc.v1.Job;
import com.google.cloud.dataproc.v1.JobControllerClient;
import com.google.cloud.dataproc.v1.JobControllerSettings;
Expand All @@ -28,8 +27,6 @@
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.ExecutionException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down
1 change: 0 additions & 1 deletion dataproc/snippets/src/test/java/QuickstartTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public void quickstartTest() throws IOException, InterruptedException {
String output = bout.toString();

assertThat(output, CoreMatchers.containsString("Cluster created successfully"));
assertThat(output, CoreMatchers.containsString("Submitting job"));
assertThat(output, CoreMatchers.containsString("Job finished successfully:"));
assertThat(output, CoreMatchers.containsString("successfully deleted"));
}
Expand Down

0 comments on commit 1a60125

Please sign in to comment.