Search in sources :

Example 1 with ComputationCommitWorkRequest

use of org.apache.beam.runners.dataflow.worker.windmill.Windmill.ComputationCommitWorkRequest in project beam by apache.

the class FakeWindmillServer method commitWork.

@Override
public CommitWorkResponse commitWork(Windmill.CommitWorkRequest request) {
    LOG.debug("commitWorkRequest: {}", request);
    validateCommitWorkRequest(request);
    for (ComputationCommitWorkRequest computationRequest : request.getRequestsList()) {
        for (WorkItemCommitRequest commit : computationRequest.getRequestsList()) {
            commitsReceived.put(commit.getWorkToken(), commit);
        }
    }
    CommitWorkResponse response = CommitWorkResponse.newBuilder().build();
    LOG.debug("commitWorkResponse: {}", response);
    return response;
}
Also used : WorkItemCommitRequest(org.apache.beam.runners.dataflow.worker.windmill.Windmill.WorkItemCommitRequest) CommitWorkResponse(org.apache.beam.runners.dataflow.worker.windmill.Windmill.CommitWorkResponse) ComputationCommitWorkRequest(org.apache.beam.runners.dataflow.worker.windmill.Windmill.ComputationCommitWorkRequest)

Example 2 with ComputationCommitWorkRequest

use of org.apache.beam.runners.dataflow.worker.windmill.Windmill.ComputationCommitWorkRequest in project beam by apache.

the class FakeWindmillServer method validateCommitWorkRequest.

private void validateCommitWorkRequest(Windmill.CommitWorkRequest request) {
    for (ComputationCommitWorkRequest computationRequest : request.getRequestsList()) {
        for (WorkItemCommitRequest commit : computationRequest.getRequestsList()) {
            errorCollector.checkThat(commit.hasWorkToken(), equalTo(true));
            errorCollector.checkThat(commit.getShardingKey(), allOf(greaterThan(0L), lessThan(Long.MAX_VALUE)));
            errorCollector.checkThat(commit.getCacheToken(), not(equalTo(0L)));
        }
    }
}
Also used : WorkItemCommitRequest(org.apache.beam.runners.dataflow.worker.windmill.Windmill.WorkItemCommitRequest) ComputationCommitWorkRequest(org.apache.beam.runners.dataflow.worker.windmill.Windmill.ComputationCommitWorkRequest)

Aggregations

ComputationCommitWorkRequest (org.apache.beam.runners.dataflow.worker.windmill.Windmill.ComputationCommitWorkRequest)2 WorkItemCommitRequest (org.apache.beam.runners.dataflow.worker.windmill.Windmill.WorkItemCommitRequest)2 CommitWorkResponse (org.apache.beam.runners.dataflow.worker.windmill.Windmill.CommitWorkResponse)1