Search in sources :

Example 31 with WorkItemStatus

use of com.google.api.services.dataflow.model.WorkItemStatus in project beam by apache.

the class WorkItemStatusClientTest method reportSuccess.

@Test
public void reportSuccess() throws IOException {
    when(worker.extractMetricUpdates()).thenReturn(Collections.emptyList());
    statusClient.setWorker(worker, executionContext);
    statusClient.reportSuccess();
    verify(workUnitClient).reportWorkItemStatus(statusCaptor.capture());
    WorkItemStatus workStatus = statusCaptor.getValue();
    assertThat(workStatus.getWorkItemId(), equalTo(Long.toString(WORK_ID)));
    assertThat(workStatus.getCompleted(), equalTo(true));
    assertThat(workStatus.getReportIndex(), equalTo(INITIAL_REPORT_INDEX));
    assertThat(workStatus.getErrors(), nullValue());
}
Also used : WorkItemStatus(com.google.api.services.dataflow.model.WorkItemStatus) Test(org.junit.Test)

Example 32 with WorkItemStatus

use of com.google.api.services.dataflow.model.WorkItemStatus in project beam by apache.

the class WorkItemStatusClientTest method populateProgress.

@Test
public void populateProgress() throws Exception {
    WorkItemStatus status = new WorkItemStatus();
    Progress progress = cloudProgressToReaderProgress(ReaderTestUtils.approximateProgressAtIndex(42L));
    when(worker.getWorkerProgress()).thenReturn(progress);
    statusClient.setWorker(worker, executionContext);
    statusClient.populateProgress(status);
    assertThat(status.getReportedProgress(), equalTo(ReaderTestUtils.approximateProgressAtIndex(42L)));
}
Also used : SourceTranslationUtils.cloudProgressToReaderProgress(org.apache.beam.runners.dataflow.worker.SourceTranslationUtils.cloudProgressToReaderProgress) Progress(org.apache.beam.runners.dataflow.worker.util.common.worker.NativeReader.Progress) WorkItemStatus(com.google.api.services.dataflow.model.WorkItemStatus) Test(org.junit.Test)

Aggregations

WorkItemStatus (com.google.api.services.dataflow.model.WorkItemStatus)32 Test (org.junit.Test)24 CounterUpdate (com.google.api.services.dataflow.model.CounterUpdate)9 Status (com.google.api.services.dataflow.model.Status)5 CounterStructuredName (com.google.api.services.dataflow.model.CounterStructuredName)3 ParallelInstruction (com.google.api.services.dataflow.model.ParallelInstruction)3 ReportWorkItemStatusRequest (com.google.api.services.dataflow.model.ReportWorkItemStatusRequest)3 ReportWorkItemStatusResponse (com.google.api.services.dataflow.model.ReportWorkItemStatusResponse)3 ArrayList (java.util.ArrayList)3 ByteString (org.apache.beam.vendor.grpc.v1p43p2.com.google.protobuf.ByteString)3 CounterMetadata (com.google.api.services.dataflow.model.CounterMetadata)2 CounterStructuredNameAndMetadata (com.google.api.services.dataflow.model.CounterStructuredNameAndMetadata)2 MapTask (com.google.api.services.dataflow.model.MapTask)2 NameAndKind (com.google.api.services.dataflow.model.NameAndKind)2 WorkItem (com.google.api.services.dataflow.model.WorkItem)2 Map (java.util.Map)2 AtomicLong (java.util.concurrent.atomic.AtomicLong)2 CounterSet (org.apache.beam.runners.dataflow.worker.counters.CounterSet)2 WorkItemCommitRequest (org.apache.beam.runners.dataflow.worker.windmill.Windmill.WorkItemCommitRequest)2 MetricShortId (com.google.api.services.dataflow.model.MetricShortId)1