private TestJobSubmitHandler() { super(JobSubmitHeaders.getInstance()); }
@Override protected CompletableFuture<JobSubmitResponseBody> handleRequest(@Nonnull HandlerRequest<JobSubmitRequestBody, EmptyMessageParameters> request, @Nonnull DispatcherGateway gateway) throws RestHandlerException { jobSubmitted = true; return CompletableFuture.completedFuture(new JobSubmitResponseBody("/url")); } }
private TestJobExecutionResultHandler( final Object... jobExecutionResults) { super(JobExecutionResultHeaders.getInstance()); checkArgument(Arrays.stream(jobExecutionResults) .allMatch(object -> object instanceof JobExecutionResultResponseBody || object instanceof RestHandlerException)); this.jobExecutionResults = Arrays.asList(jobExecutionResults).iterator(); }
artifactFileNames.add(new JobSubmitRequestBody.DistributedCacheFile(artifacts.getKey(), new Path(artifacts.getValue().filePath).getName())); filesToUpload.add(new FileUpload(Paths.get(artifacts.getValue().filePath), RestConstants.CONTENT_TYPE_BINARY)); final JobSubmitRequestBody requestBody = new JobSubmitRequestBody( jobGraphFile.getFileName().toString(), jarFileNames, JobSubmitHeaders.getInstance(), EmptyMessageParameters.getInstance(), requestAndFileUploads.f0,
/** * Requests the job details. * * @param jobId The job id * @return Job details */ public CompletableFuture<JobDetailsInfo> getJobDetails(JobID jobId) { final JobDetailsHeaders detailsHeaders = JobDetailsHeaders.getInstance(); final JobMessageParameters params = new JobMessageParameters(); params.jobPathParameter.resolve(jobId); return sendRequest( detailsHeaders, params); }
@Override public SubtaskAttemptMessageParameters getUnresolvedMessageParameters() { return new SubtaskAttemptMessageParameters(); }
new TestJobExecutionResultHandler( new RestHandlerException("should trigger retry", HttpResponseStatus.SERVICE_UNAVAILABLE), JobExecutionResultResponseBody.inProgress(), JobExecutionResultResponseBody.created(new JobResult.Builder() .applicationStatus(ApplicationStatus.SUCCEEDED) .jobId(jobId) .accumulatorResults(Collections.singletonMap("testName", new SerializedValue<>(OptionalFailure.of(1.0)))) .build()), JobExecutionResultResponseBody.created(new JobResult.Builder() .applicationStatus(ApplicationStatus.FAILED) .jobId(jobId)
@Override public SubtaskMessageParameters getUnresolvedMessageParameters() { return new SubtaskMessageParameters(); }
private static void waitUntilJobIsRunning(RestClusterClient<ApplicationId> restClusterClient, JobID jobId) throws Exception { waitUntilCondition( () -> { final JobDetailsInfo jobDetails = restClusterClient.getJobDetails(jobId).get(); return jobDetails.getJobVertexInfos() .stream() .map(toExecutionState()) .allMatch(isRunning()); }, Deadline.fromNow(TIMEOUT)); }
TestJobExecutionResultHandler testJobExecutionResultHandler = new TestJobExecutionResultHandler( JobExecutionResultResponseBody.created(new JobResult.Builder() .applicationStatus(ApplicationStatus.SUCCEEDED) .jobId(jobId)
/** * Requests the {@link JobResult} for the given {@link JobID}. The method retries multiple * times to poll the {@link JobResult} before giving up. * * @param jobId specifying the job for which to retrieve the {@link JobResult} * @return Future which is completed with the {@link JobResult} once the job has completed or * with a failure if the {@link JobResult} could not be retrieved. */ @Override public CompletableFuture<JobResult> requestJobResult(@Nonnull JobID jobId) { return pollResourceAsync( () -> { final JobMessageParameters messageParameters = new JobMessageParameters(); messageParameters.jobPathParameter.resolve(jobId); return sendRequest( JobExecutionResultHeaders.getInstance(), messageParameters); }); }
public JobSubmitHandler( CompletableFuture<String> localRestAddress, GatewayRetriever<? extends DispatcherGateway> leaderRetriever, Time timeout, Map<String, String> headers, Executor executor, Configuration configuration) { super(localRestAddress, leaderRetriever, timeout, headers, JobSubmitHeaders.getInstance()); this.executor = executor; this.configuration = configuration; }
@Override public SubtaskAttemptMessageParameters getUnresolvedMessageParameters() { return new SubtaskAttemptMessageParameters(); }
@Override public SubtaskMessageParameters getUnresolvedMessageParameters() { return new SubtaskMessageParameters(); }
public JobExecutionResultHandler( final CompletableFuture<String> localRestAddress, final GatewayRetriever<? extends RestfulGateway> leaderRetriever, final Time timeout, final Map<String, String> responseHeaders) { super( localRestAddress, leaderRetriever, timeout, responseHeaders, JobExecutionResultHeaders.getInstance()); }
public JobSubmitHandler( CompletableFuture<String> localRestAddress, GatewayRetriever<? extends DispatcherGateway> leaderRetriever, Time timeout, Map<String, String> headers, Executor executor, Configuration configuration) { super(localRestAddress, leaderRetriever, timeout, headers, JobSubmitHeaders.getInstance()); this.executor = executor; this.configuration = configuration; }
@Override public SubtaskAttemptMessageParameters getUnresolvedMessageParameters() { return new SubtaskAttemptMessageParameters(); }
public JobExecutionResultHandler( final CompletableFuture<String> localRestAddress, final GatewayRetriever<? extends RestfulGateway> leaderRetriever, final Time timeout, final Map<String, String> responseHeaders) { super( localRestAddress, leaderRetriever, timeout, responseHeaders, JobExecutionResultHeaders.getInstance()); }
public JobSubmitHandler( CompletableFuture<String> localRestAddress, GatewayRetriever<? extends DispatcherGateway> leaderRetriever, Time timeout, Map<String, String> headers, Executor executor, Configuration configuration) { super(localRestAddress, leaderRetriever, timeout, headers, JobSubmitHeaders.getInstance()); this.executor = executor; this.configuration = configuration; }
public JobExecutionResultHandler( final CompletableFuture<String> localRestAddress, final GatewayRetriever<? extends RestfulGateway> leaderRetriever, final Time timeout, final Map<String, String> responseHeaders) { super( localRestAddress, leaderRetriever, timeout, responseHeaders, JobExecutionResultHeaders.getInstance()); }