flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tillrohrmann <...@git.apache.org>
Subject [GitHub] flink pull request #5207: [FLINK-8299][flip6] Poll JobExecutionResult after ...
Date Mon, 08 Jan 2018 12:25:21 GMT
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5207#discussion_r160125031
  
    --- Diff: flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java
---
    @@ -148,6 +181,39 @@ private void submitJob(JobGraph jobGraph) throws JobSubmissionException
{
     		}
     	}
     
    +	private JobExecutionResult waitForJobExecutionResult(
    +			final JobID jobId) throws ProgramInvocationException {
    +
    +		final JobMessageParameters messageParameters = new JobMessageParameters();
    +		messageParameters.jobPathParameter.resolve(jobId);
    +		JobExecutionResultResponseBody jobExecutionResultResponseBody;
    +		try {
    +			long attempt = 0;
    +			do {
    +				final CompletableFuture<JobExecutionResultResponseBody> responseFuture =
    +					restClient.sendRequest(
    +						restClusterClientConfiguration.getRestServerAddress(),
    +						restClusterClientConfiguration.getRestServerPort(),
    +						JobExecutionResultHeaders.getInstance(),
    +						messageParameters);
    +				jobExecutionResultResponseBody = responseFuture.get(timeout.toMillis(), TimeUnit.MILLISECONDS);
    +				Thread.sleep(waitStrategy.sleepTime(attempt));
    +				attempt++;
    +			}
    +			while (jobExecutionResultResponseBody.getStatus().getStatusId() != QueueStatus.StatusId.COMPLETED);
    --- End diff --
    
    `getStatus().getStatusId()` looks not so nice tbh.


---

Mime
View raw message