Search in sources :

Example 6 with DataflowExecutionState

use of org.apache.beam.runners.dataflow.worker.DataflowOperationContext.DataflowExecutionState in project beam by apache.

the class IsmReaderTest method setUp.

@Before
public void setUp() {
    cache = CacheBuilder.newBuilder().weigher(Weighers.fixedWeightKeys(1)).maximumWeight(10_000).build();
    executionContext = BatchModeExecutionContext.forTesting(PipelineOptionsFactory.as(DataflowPipelineOptions.class), "testStage");
    DataflowExecutionState state = executionContext.getExecutionStateRegistry().getState(NameContextsForTests.nameContextForTest(), "test", null, NoopProfileScope.NOOP);
    stateCloseable = executionContext.getExecutionStateTracker().enterState(state);
}
Also used : DataflowExecutionState(org.apache.beam.runners.dataflow.worker.DataflowOperationContext.DataflowExecutionState) Before(org.junit.Before)

Example 7 with DataflowExecutionState

use of org.apache.beam.runners.dataflow.worker.DataflowOperationContext.DataflowExecutionState in project beam by apache.

the class DataflowWorkerLoggingHandler method publish.

@Override
public synchronized void publish(LogRecord record) {
    DataflowExecutionState currrentDataflowState = null;
    ExecutionState currrentState = ExecutionStateTracker.getCurrentExecutionState();
    if (currrentState instanceof DataflowExecutionState) {
        currrentDataflowState = (DataflowExecutionState) currrentState;
    }
    // It's okay to pass in the null state, publish() handles and tests this.
    publish(currrentDataflowState, record);
}
Also used : ExecutionState(org.apache.beam.runners.core.metrics.ExecutionStateTracker.ExecutionState) DataflowExecutionState(org.apache.beam.runners.dataflow.worker.DataflowOperationContext.DataflowExecutionState) DataflowExecutionState(org.apache.beam.runners.dataflow.worker.DataflowOperationContext.DataflowExecutionState)

Example 8 with DataflowExecutionState

use of org.apache.beam.runners.dataflow.worker.DataflowOperationContext.DataflowExecutionState in project beam by apache.

the class DataflowSideInputReadCounter method updateCurrentStateIfOutdated.

private void updateCurrentStateIfOutdated() {
    DataflowExecutionState currentState = (DataflowExecutionState) executionContext.getExecutionStateTracker().getCurrentState();
    if (currentState == null || currentState.getStepName().originalName() == null || Objects.equals(latestConsumingStepName, currentState.getStepName())) {
        // In this case, the step has not changed, and we'll just return.
        return;
    }
    if (!byteCounters.containsKey(currentState.getStepName())) {
        byteCounters.put(currentState.getStepName(), executionContext.getCounterFactory().longSum(CounterName.named("read-sideinput-byte-count").withOriginalName(declaringOperationContext.nameContext()).withOrigin("SYSTEM").withOriginalRequestingStepName(currentState.getStepName().originalName()).withInputIndex(sideInputIndex)));
        executionStates.put(currentState.getStepName(), executionContext.getExecutionStateRegistry().getIOState(declaringOperationContext.nameContext(), "read-sideinput", currentState.getStepName().originalName(), sideInputIndex, currentState.getMetricsContainer(), currentState.getProfileScope()));
    }
    currentCounter = byteCounters.get(currentState.getStepName());
    currentExecutionState = executionStates.get(currentState.getStepName());
    latestConsumingStepName = currentState.getStepName();
}
Also used : DataflowExecutionState(org.apache.beam.runners.dataflow.worker.DataflowOperationContext.DataflowExecutionState)

Example 9 with DataflowExecutionState

use of org.apache.beam.runners.dataflow.worker.DataflowOperationContext.DataflowExecutionState in project beam by apache.

the class GroupingShuffleReaderTest method setCurrentExecutionState.

private void setCurrentExecutionState(String mockOriginalName) {
    DataflowExecutionState state = new TestDataflowExecutionState(NameContext.create(MOCK_STAGE_NAME, mockOriginalName, MOCK_SYSTEM_NAME, MOCK_USER_NAME), "activity");
    tracker.enterState(state);
}
Also used : TestDataflowExecutionState(org.apache.beam.runners.dataflow.worker.TestOperationContext.TestDataflowExecutionState) TestDataflowExecutionState(org.apache.beam.runners.dataflow.worker.TestOperationContext.TestDataflowExecutionState) DataflowExecutionState(org.apache.beam.runners.dataflow.worker.DataflowOperationContext.DataflowExecutionState)

Example 10 with DataflowExecutionState

use of org.apache.beam.runners.dataflow.worker.DataflowOperationContext.DataflowExecutionState in project beam by apache.

the class IsmReaderFactoryTest method setUp.

@Before
public void setUp() {
    options = PipelineOptionsFactory.as(DataflowPipelineOptions.class);
    executionContext = BatchModeExecutionContext.forTesting(PipelineOptionsFactory.as(DataflowPipelineOptions.class), NameContextsForTests.nameContextForTest().stageName());
    DataflowExecutionState state = executionContext.getExecutionStateRegistry().getState(NameContextsForTests.nameContextForTest(), "test", null, /*container */
    NoopProfileScope.NOOP);
    operationContext = executionContext.createOperationContext(NameContextsForTests.nameContextForTest());
    stateCloseable = executionContext.getExecutionStateTracker().enterState(state);
}
Also used : DataflowPipelineOptions(org.apache.beam.runners.dataflow.options.DataflowPipelineOptions) DataflowExecutionState(org.apache.beam.runners.dataflow.worker.DataflowOperationContext.DataflowExecutionState) Before(org.junit.Before)

Aggregations

DataflowExecutionState (org.apache.beam.runners.dataflow.worker.DataflowOperationContext.DataflowExecutionState)12 Test (org.junit.Test)5 ExecutionStateTracker (org.apache.beam.runners.core.metrics.ExecutionStateTracker)4 TestDataflowExecutionState (org.apache.beam.runners.dataflow.worker.TestOperationContext.TestDataflowExecutionState)3 CounterFactory (org.apache.beam.runners.dataflow.worker.counters.CounterFactory)3 NameContext (org.apache.beam.runners.dataflow.worker.counters.NameContext)3 CounterName (org.apache.beam.runners.dataflow.worker.counters.CounterName)2 Before (org.junit.Before)2 CounterMetadata (com.google.api.services.dataflow.model.CounterMetadata)1 CounterStructuredName (com.google.api.services.dataflow.model.CounterStructuredName)1 CounterStructuredNameAndMetadata (com.google.api.services.dataflow.model.CounterStructuredNameAndMetadata)1 CounterUpdate (com.google.api.services.dataflow.model.CounterUpdate)1 Source (com.google.api.services.dataflow.model.Source)1 SplitInt64 (com.google.api.services.dataflow.model.SplitInt64)1 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 Closeable (java.io.Closeable)1 ArrayList (java.util.ArrayList)1 ExecutionState (org.apache.beam.runners.core.metrics.ExecutionStateTracker.ExecutionState)1 DataflowPipelineOptions (org.apache.beam.runners.dataflow.options.DataflowPipelineOptions)1 NameContextsForTests.nameContextForTest (org.apache.beam.runners.dataflow.worker.NameContextsForTests.nameContextForTest)1