Search in sources :

Example 26 with DataflowStepContext

use of org.apache.beam.runners.dataflow.worker.DataflowExecutionContext.DataflowStepContext in project beam by apache.

the class UserMonitoringInfoToCounterUpdateTransformerTest method testTransformReturnsNullIfMonitoringInfoWithUnknownPTransformLabelPresent.

@Test
public void testTransformReturnsNullIfMonitoringInfoWithUnknownPTransformLabelPresent() {
    Map<String, DataflowStepContext> stepContextMapping = new HashMap<>();
    MonitoringInfo monitoringInfo = MonitoringInfo.newBuilder().setUrn(Urns.USER_SUM_INT64).setType(TypeUrns.SUM_INT64_TYPE).putLabels(MonitoringInfoConstants.Labels.NAME, "anyName").putLabels(MonitoringInfoConstants.Labels.NAMESPACE, "anyNamespace").putLabels(MonitoringInfoConstants.Labels.PTRANSFORM, "anyValue").build();
    UserMonitoringInfoToCounterUpdateTransformer testObject = new UserMonitoringInfoToCounterUpdateTransformer(mockSpecValidator, stepContextMapping);
    when(mockSpecValidator.validate(any())).thenReturn(Optional.empty());
    assertNull(testObject.transform(monitoringInfo));
}
Also used : MonitoringInfo(org.apache.beam.model.pipeline.v1.MetricsApi.MonitoringInfo) HashMap(java.util.HashMap) DataflowStepContext(org.apache.beam.runners.dataflow.worker.DataflowExecutionContext.DataflowStepContext) Test(org.junit.Test)

Aggregations

DataflowStepContext (org.apache.beam.runners.dataflow.worker.DataflowExecutionContext.DataflowStepContext)26 Test (org.junit.Test)16 HashMap (java.util.HashMap)12 MonitoringInfo (org.apache.beam.model.pipeline.v1.MetricsApi.MonitoringInfo)11 CounterUpdate (com.google.api.services.dataflow.model.CounterUpdate)7 NameContext (org.apache.beam.runners.dataflow.worker.counters.NameContext)5 CounterMetadata (com.google.api.services.dataflow.model.CounterMetadata)3 CounterStructuredName (com.google.api.services.dataflow.model.CounterStructuredName)3 CounterStructuredNameAndMetadata (com.google.api.services.dataflow.model.CounterStructuredNameAndMetadata)3 InstructionRequest (org.apache.beam.model.fnexecution.v1.BeamFnApi.InstructionRequest)3 InstructionResponse (org.apache.beam.model.fnexecution.v1.BeamFnApi.InstructionResponse)3 CloudObject (org.apache.beam.runners.dataflow.util.CloudObject)3 ParDoFn (org.apache.beam.runners.dataflow.worker.util.common.worker.ParDoFn)3 InstructionRequestHandler (org.apache.beam.runners.fnexecution.control.InstructionRequestHandler)3 Nullable (org.checkerframework.checker.nullness.qual.Nullable)3 Instant (org.joda.time.Instant)3 CompletableFuture (java.util.concurrent.CompletableFuture)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 StateKey (org.apache.beam.model.fnexecution.v1.BeamFnApi.StateKey)2 StateRequest (org.apache.beam.model.fnexecution.v1.BeamFnApi.StateRequest)2