use of org.apache.beam.runners.dataflow.worker.util.common.worker.StubbedExecutor in project beam by apache.
the class DataflowWorkProgressUpdaterTest method initMocksAndWorkflowServiceAndWorkerAndWork.
@Before
public void initMocksAndWorkflowServiceAndWorkerAndWork() {
MockitoAnnotations.initMocks(this);
startTime = 0L;
clock = new FixedClock(startTime);
executor = new StubbedExecutor(clock);
options = PipelineOptionsFactory.create().as(DataflowPipelineOptions.class);
options.setHotKeyLoggingEnabled(true);
WorkItem workItem = new WorkItem();
workItem.setProjectId(PROJECT_ID);
workItem.setJobId(JOB_ID);
workItem.setId(WORK_ID);
workItem.setLeaseExpireTime(toCloudTime(new Instant(clock.currentTimeMillis() + 1000)));
workItem.setReportStatusInterval(toCloudDuration(Duration.millis(300)));
workItem.setInitialReportIndex(1L);
when(workItemStatusClient.getExecutionContext()).thenReturn(context);
when(context.getKey()).thenReturn(HOT_KEY);
progressUpdater = new DataflowWorkProgressUpdater(workItemStatusClient, workItem, worker, executor.getExecutor(), clock, hotKeyLogger, options) {
// Shorten reporting interval boundaries for faster testing.
@Override
protected long getMinReportingInterval() {
return 100;
}
@Override
protected long getLeaseRenewalLatencyMargin() {
return 150;
}
};
}
Aggregations